/*
- * Copyright (c) 1985 Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1985, 1993
+ * The Regents of the University of California. All rights reserved.
*
- * Redistribution and use in source and binary forms are permitted
- * provided that the above copyright notice and this paragraph are
- * duplicated in all such forms and that any documentation,
- * advertising materials, and other materials related to such
- * distribution and use acknowledge that the software was developed
- * by the University of California, Berkeley. The name of the
- * University may not be used to endorse or promote products derived
- * from this software without specific prior written permission.
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+ * %sccs.include.redist.c%
*/
#ifndef lint
-static char sccsid[] = "@(#)domacro.c 1.5 (Berkeley) %G%";
+static char sccsid[] = "@(#)domacro.c 8.2 (Berkeley) %G%";
#endif /* not lint */
-#include "ftp_var.h"
-
+#include <ctype.h>
#include <signal.h>
#include <stdio.h>
-#include <errno.h>
-#include <ctype.h>
-#include <sys/ttychars.h>
+#include <strings.h>
+#include "ftp_var.h"
+
+void
domacro(argc, argv)
int argc;
char *argv[];
{
- register int i, j;
- register char *cp1, *cp2;
- int count = 2, loopflg = 0;
- char line2[200];
- extern char **glob(), *globerr;
- struct cmd *getcmd(), *c;
- extern struct cmd cmdtab[];
+ int i, j, count = 2, loopflg = 0;
+ char *cp1, *cp2, line2[200];
+ struct cmd *c;
- if (argc < 2) {
- (void) strcat(line, " ");
- printf("(macro name) ");
- (void) gets(&line[strlen(line)]);
- makeargv();
- argc = margc;
- argv = margv;
- }
- if (argc < 2) {
+ if (argc < 2 && !another(&argc, &argv, "macro name")) {
printf("Usage: %s macro_name.\n", argv[0]);
code = -1;
return;
}
(*c->c_handler)(margc, margv);
if (bell && c->c_bell) {
- (void) putchar(CTRL('g'));
+ (void) putchar('\007');
}
(void) strcpy(line, line2);
makeargv();