remember current server type setting, don't change until doing
[unix-history] / usr / src / usr.bin / ftp / main.c
index 3128800..2c9fdf5 100644 (file)
@@ -1,18 +1,29 @@
 /*
 /*
- * Copyright (c) 1985 Regents of the University of California.
- * All rights reserved.  The Berkeley software License Agreement
- * specifies the terms and conditions for redistribution.
+ * Copyright (c) 1985, 1989 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 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  */
 
 #ifndef lint
 char copyright[] =
  */
 
 #ifndef lint
 char copyright[] =
-"@(#) Copyright (c) 1985 Regents of the University of California.\n\
+"@(#) Copyright (c) 1985, 1989 Regents of the University of California.\n\
  All rights reserved.\n";
  All rights reserved.\n";
-#endif not lint
+#endif /* not lint */
 
 #ifndef lint
 
 #ifndef lint
-static char sccsid[] = "@(#)main.c     5.8 (Berkeley) %G%";
-#endif not lint
+static char sccsid[] = "@(#)main.c     5.14 (Berkeley) %G%";
+#endif /* not lint */
 
 /*
  * FTP User Program -- Command Interface.
 
 /*
  * FTP User Program -- Command Interface.
@@ -92,14 +103,6 @@ main(argc, argv)
                argc--, argv++;
        }
        fromatty = isatty(fileno(stdin));
                argc--, argv++;
        }
        fromatty = isatty(fileno(stdin));
-       /*
-        * Set up defaults for FTP.
-        */
-       (void) strcpy(typename, "ascii"), type = TYPE_A;
-       (void) strcpy(formname, "non-print"), form = FORM_N;
-       (void) strcpy(modename, "stream"), mode = MODE_S;
-       (void) strcpy(structname, "file"), stru = STRU_F;
-       (void) strcpy(bytename, "8"), bytesize = 8;
        if (fromatty)
                verbose++;
        cpend = 0;           /* no pending replies */
        if (fromatty)
                verbose++;
        cpend = 0;           /* no pending replies */
@@ -208,7 +211,7 @@ cmdscanner(top)
                        (void) fflush(stdout);
                }
                if (gets(line) == 0) {
                        (void) fflush(stdout);
                }
                if (gets(line) == 0) {
-                       if (feof(stdin))
+                       if (feof(stdin) || ferror(stdin))
                                quit();
                        break;
                }
                                quit();
                        break;
                }
@@ -233,7 +236,7 @@ cmdscanner(top)
                }
                (*c->c_handler)(margc, margv);
                if (bell && c->c_bell)
                }
                (*c->c_handler)(margc, margv);
                if (bell && c->c_bell)
-                       (void) putchar(CTRL('g'));
+                       (void) putchar('\007');
                if (c->c_handler != help)
                        break;
        }
                if (c->c_handler != help)
                        break;
        }
@@ -310,7 +313,7 @@ slurpstring()
                                slrflag++;
                                stringbase++;
                                return ((*sb == '!') ? "!" : "$");
                                slrflag++;
                                stringbase++;
                                return ((*sb == '!') ? "!" : "$");
-                               break;
+                               /* NOTREACHED */
                        case 1:
                                slrflag++;
                                altarg = stringbase;
                        case 1:
                                slrflag++;
                                altarg = stringbase;