Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. =================================================================== RCS file: /ftp/cvs/cvsroot/src/usr.bin/ftp/main.c,v rcsdiff: /ftp/cvs/cvsroot/src/usr.bin/ftp/main.c,v: warning: Unknown phrases like `commitid ...;' are present. retrieving revision 1.17 retrieving revision 1.18 diff -u -p -r1.17 -r1.18 --- src/usr.bin/ftp/main.c 1997/02/01 10:45:07 1.17 +++ src/usr.bin/ftp/main.c 1997/03/13 06:23:19 1.18 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.17 1997/02/01 10:45:07 lukem Exp $ */ +/* $NetBSD: main.c,v 1.18 1997/03/13 06:23:19 lukem Exp $ */ /* * Copyright (c) 1985, 1989, 1993, 1994 @@ -43,7 +43,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)main.c 8.6 (Berkeley) 10/9/94"; #else -static char rcsid[] = "$NetBSD: main.c,v 1.17 1997/02/01 10:45:07 lukem Exp $"; +static char rcsid[] = "$NetBSD: main.c,v 1.18 1997/03/13 06:23:19 lukem Exp $"; #endif #endif /* not lint */ @@ -89,6 +89,9 @@ main(argc, argv) preserve = 1; verbose = 0; progress = 0; +#ifndef SMALLFTP + editing = 0; +#endif mark = HASHBYTES; marg_sl = sl_init(); @@ -98,12 +101,16 @@ main(argc, argv) passivemode = 1; fromatty = isatty(fileno(stdin)); - if (fromatty) + if (fromatty) { verbose = 1; /* verbose if from a tty */ +#ifndef SMALLFTP + editing = 1; /* editing mode on if from a tty */ +#endif + } if (isatty(fileno(stdout))) progress = 1; /* progress bar on if going to a tty */ - while ((ch = getopt(argc, argv, "adginpP:tvV")) != EOF) { + while ((ch = getopt(argc, argv, "adeginpP:tvV")) != -1) { switch (ch) { case 'a': anonftp = 1; @@ -114,6 +121,12 @@ main(argc, argv) debug++; break; + case 'e': +#ifndef SMALLFTP + editing = 0; +#endif + break; + case 'g': doglob = 0; break; @@ -133,7 +146,7 @@ main(argc, argv) case 'P': port = atoi(optarg); if (port <= 0) - warnx("bad port number: %s", optarg); + warnx("bad port number: %s (ignored)", optarg); else ftpport = htons(port); break; @@ -172,13 +185,11 @@ main(argc, argv) pw = getpwuid(getuid()); if (pw != NULL) { home = homedir; - (void) strcpy(home, pw->pw_dir); + (void)strcpy(home, pw->pw_dir); } #ifndef SMALLFTP - editing = 0; /* command line editing off */ if (fromatty) { - editing = 1; /* editing mode on if a tty */ el = el_init(__progname, stdin, stdout); /* init editline */ hist = history_init(); /* init the builtin history */ @@ -199,7 +210,7 @@ main(argc, argv) #endif /* !SMALLFTP */ setttywidth(0); - (void) signal(SIGWINCH, setttywidth); + (void)signal(SIGWINCH, setttywidth); if (argc > 0) { if (strchr(argv[0], ':') != NULL) { @@ -212,8 +223,8 @@ main(argc, argv) if (setjmp(toplevel)) exit(0); - (void) signal(SIGINT, intr); - (void) signal(SIGPIPE, lostpeer); + (void)signal(SIGINT, (sig_t)intr); + (void)signal(SIGPIPE, (sig_t)lostpeer); xargv[0] = __progname; xargv[1] = argv[0]; xargv[2] = argv[1]; @@ -224,8 +235,8 @@ main(argc, argv) } top = setjmp(toplevel) == 0; if (top) { - (void) signal(SIGINT, intr); - (void) signal(SIGPIPE, lostpeer); + (void)signal(SIGINT, (sig_t)intr); + (void)signal(SIGPIPE, (sig_t)lostpeer); } for (;;) { cmdscanner(top); @@ -248,13 +259,13 @@ lostpeer() alarmtimer(0); if (connected) { if (cout != NULL) { - (void) shutdown(fileno(cout), 1+1); - (void) fclose(cout); + (void)shutdown(fileno(cout), 1+1); + (void)fclose(cout); cout = NULL; } if (data >= 0) { - (void) shutdown(data, 1+1); - (void) close(data); + (void)shutdown(data, 1+1); + (void)close(data); data = -1; } connected = 0; @@ -262,8 +273,8 @@ lostpeer() pswitch(1); if (connected) { if (cout != NULL) { - (void) shutdown(fileno(cout), 1+1); - (void) fclose(cout); + (void)shutdown(fileno(cout), 1+1); + (void)fclose(cout); cout = NULL; } connected = 0; @@ -296,14 +307,14 @@ cmdscanner(top) && !editing #endif /* !SMALLFTP */ ) - (void) putchar('\n'); + (void)putchar('\n'); for (;;) { #ifndef SMALLFTP if (!editing) { #endif /* !SMALLFTP */ if (fromatty) { - printf("%s", prompt()); - (void) fflush(stdout); + fputs(prompt(), stdout); + (void)fflush(stdout); } if (fgets(line, sizeof(line), stdin) == NULL) quit(0, 0); @@ -315,7 +326,7 @@ cmdscanner(top) break; line[num] = '\0'; } else if (num == sizeof(line) - 2) { - printf("sorry, input line too long\n"); + puts("sorry, input line too long."); while ((num = getchar()) != '\n' && num != EOF) /* void */; break; @@ -331,7 +342,7 @@ cmdscanner(top) if (num == 0) break; } else if (num >= sizeof(line)) { - printf("sorry, input line too long\n"); + puts("sorry, input line too long."); break; } memcpy(line, buf, num); @@ -353,26 +364,26 @@ cmdscanner(top) #endif /* !SMALLFTP */ c = getcmd(margv[0]); if (c == (struct cmd *)-1) { - printf("?Ambiguous command\n"); + puts("?Ambiguous command."); continue; } if (c == 0) { - printf("?Invalid command\n"); + puts("?Invalid command."); continue; } if (c->c_conn && !connected) { - printf("Not connected.\n"); + puts("Not connected."); continue; } confirmrest = 0; (*c->c_handler)(margc, margv); if (bell && c->c_bell) - (void) putchar('\007'); + (void)putchar('\007'); if (c->c_handler != help) break; } - (void) signal(SIGINT, intr); - (void) signal(SIGPIPE, lostpeer); + (void)signal(SIGINT, (sig_t)intr); + (void)signal(SIGPIPE, (sig_t)lostpeer); } struct cmd * @@ -609,7 +620,7 @@ help(argc, argv) return; } -#define HELPINDENT ((int) sizeof ("disconnect")) +#define HELPINDENT ((int) sizeof("disconnect")) while (--argc > 0) { char *arg; @@ -630,7 +641,7 @@ void usage() { (void)fprintf(stderr, - "usage: %s [-adginptvV] [host [port]]\n" + "usage: %s [-adeginptvV] [host [port]]\n" " %s host:path[/]\n" " %s ftp://host[:port]/path[/]\n" " %s http://host[:port]/file\n",