fix problem building own hostent
[unix-history] / usr / src / usr.bin / ftp / main.c
index 554f45c..fad94de 100644 (file)
@@ -1,6 +1,18 @@
+/*
+ * Copyright (c) 1983 Regents of the University of California.
+ * All rights reserved.  The Berkeley software License Agreement
+ * specifies the terms and conditions for redistribution.
+ */
+
 #ifndef lint
 #ifndef lint
-static char sccsid[] = "@(#)main.c     4.7 (Berkeley) %G%";
-#endif
+char copyright[] =
+"@(#) Copyright (c) 1983 Regents of the University of California.\n\
+ All rights reserved.\n";
+#endif not lint
+
+#ifndef lint
+static char sccsid[] = "@(#)main.c     5.1 (Berkeley) %G%";
+#endif not lint
 
 /*
  * FTP User Program -- Command Interface.
 
 /*
  * FTP User Program -- Command Interface.
@@ -101,14 +113,14 @@ main(argc, argv)
        if (argc > 0) {
                if (setjmp(toplevel))
                        exit(0);
        if (argc > 0) {
                if (setjmp(toplevel))
                        exit(0);
-               sigset(SIGINT, intr);
-               sigset(SIGPIPE, lostpeer);
+               signal(SIGINT, intr);
+               signal(SIGPIPE, lostpeer);
                setpeer(argc + 1, argv - 1);
        }
        top = setjmp(toplevel) == 0;
        if (top) {
                setpeer(argc + 1, argv - 1);
        }
        top = setjmp(toplevel) == 0;
        if (top) {
-               sigset(SIGINT, intr);
-               sigset(SIGPIPE, lostpeer);
+               signal(SIGINT, intr);
+               signal(SIGPIPE, lostpeer);
        }
        for (;;) {
                cmdscanner(top);
        }
        for (;;) {
                cmdscanner(top);
@@ -178,8 +190,15 @@ cmdscanner(top)
                        printf("ftp> ");
                        fflush(stdout);
                }
                        printf("ftp> ");
                        fflush(stdout);
                }
-               if (gets(line) == 0)
+               if (gets(line) == 0) {
+                       if (feof(stdin)) {
+                               if (!fromatty)
+                                       quit();
+                               clearerr(stdin);
+                               putchar('\n');
+                       }
                        break;
                        break;
+               }
                if (line[0] == 0)
                        break;
                makeargv();
                if (line[0] == 0)
                        break;
                makeargv();