* Copyright (c) 1985 Regents of the University of California.
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
static char sccsid
[] = "@(#)domacro.c 1.2 (Berkeley) 3/7/86";
#include <sys/ttychars.h>
register char *cp1
, *cp2
;
int count
= 2, loopflg
= 0;
extern char **glob(), *globerr
;
struct cmd
*getcmd(), *c
;
extern struct cmd cmdtab
[];
(void) strcat(line
, " ");
(void) gets(&line
[strlen(line
)]);
printf("Usage: %s macro_name.\n", argv
[0]);
for (i
= 0; i
< macnum
; ++i
) {
if (!strncmp(argv
[1], macros
[i
].mac_name
, 9)) {
printf("'%s' macro not found.\n", argv
[1]);
(void) strcpy(line2
, line
);
cp1
= macros
[i
].mac_start
;
while (cp1
!= macros
[i
].mac_end
) {
while (isdigit(*++cp1
)) {
(void) strcpy(cp2
, argv
[j
+1]);
cp2
+= strlen(argv
[j
+1]);
(void) strcpy(cp2
, argv
[count
]);
cp2
+= strlen(argv
[count
]);
/* intentional drop through */
if (c
== (struct cmd
*)-1) {
printf("?Ambiguous command\n");
printf("?Invalid command\n");
else if (c
->c_conn
&& !connected
) {
printf("Not connected.\n");
(*c
->c_handler
)(margc
, margv
);
(void) strcpy(line
, line2
);
if (cp1
!= macros
[i
].mac_end
) {
if (loopflg
&& ++count
< argc
) {