* Copyright (c) 1985, 1993
* The Regents of the University of California. All rights reserved.
* %sccs.include.redist.c%
static char sccsid
[] = "@(#)domacro.c 8.2 (Berkeley) %G%";
int i
, j
, count
= 2, loopflg
= 0;
char *cp1
, *cp2
, line2
[200];
if (argc
< 2 && !another(&argc
, &argv
, "macro name")) {
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
) {