Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/ftp * idle(): rename to idlecmd(). certain linux dis...



details:   https://anonhg.NetBSD.org/src/rev/3176bc7f0898
branches:  trunk
changeset: 476780:3176bc7f0898
user:      lukem <lukem%NetBSD.org@localhost>
date:      Mon Sep 27 23:09:42 1999 +0000

description:
* idle(): rename to idlecmd(). certain linux distributions have an incompatible
  prototype for idle() in <unistd.h> (which i thought was against namespace
  and sensibility guidelines, but...)
* consistently use xsignal() instead of signal(). we get known behaviour
  in all cases (SA_RESTART), which is good for some borken foreign systems.
* remove signal.h from most files; it's unnecessary now
* fetch_url(): use `long chunksize' instead of ssize_t; it's more portable, and
  we're setting chunksize with strtol() anyway
* xsignal(): only use SA_RESTART if it exists. SunOS 4.x doesn't have it
  but has the inverse (SA_INTERRUPT). the original function i was inspired
  from had this support (lib/signal.c, W. Richard Stevens' `UNP 2nd ed Vol 1').
* remove <termios.h> from util.c; it should be unnecessary now

diffstat:

 usr.bin/ftp/cmds.c      |   51 +++++++++++-----------
 usr.bin/ftp/cmdtab.c    |    7 +-
 usr.bin/ftp/complete.c  |    5 +-
 usr.bin/ftp/domacro.c   |    5 +-
 usr.bin/ftp/fetch.c     |   23 +++++-----
 usr.bin/ftp/ftp.c       |  105 +++++++++++++++++++++++------------------------
 usr.bin/ftp/main.c      |   17 +++----
 usr.bin/ftp/ruserpass.c |    5 +-
 usr.bin/ftp/util.c      |   11 +++-
 9 files changed, 113 insertions(+), 116 deletions(-)

diffs (truncated from 883 to 300 lines):

diff -r 3ef34a648e82 -r 3176bc7f0898 usr.bin/ftp/cmds.c
--- a/usr.bin/ftp/cmds.c        Mon Sep 27 22:58:56 1999 +0000
+++ b/usr.bin/ftp/cmds.c        Mon Sep 27 23:09:42 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cmds.c,v 1.61 1999/09/24 14:28:14 lukem Exp $  */
+/*     $NetBSD: cmds.c,v 1.62 1999/09/27 23:09:42 lukem Exp $  */
 
 /*
  * Copyright (C) 1997 and 1998 WIDE Project.
@@ -107,7 +107,7 @@
 #if 0
 static char sccsid[] = "@(#)cmds.c     8.6 (Berkeley) 10/9/94";
 #else
-__RCSID("$NetBSD: cmds.c,v 1.61 1999/09/24 14:28:14 lukem Exp $");
+__RCSID("$NetBSD: cmds.c,v 1.62 1999/09/27 23:09:42 lukem Exp $");
 #endif
 #endif /* not lint */
 
@@ -121,7 +121,6 @@
 #include <arpa/ftp.h>
 
 #include <ctype.h>
-#include <signal.h>
 #include <err.h>
 #include <glob.h>
 #include <limits.h>
@@ -396,7 +395,7 @@
        }
        mname = argv[0];
        mflag = 1;
-       oldintr = signal(SIGINT, mabort);
+       oldintr = xsignal(SIGINT, mabort);
        (void)setjmp(jabort);
        if (proxy) {
                char *cp, *tp2, tmpbuf[MAXPATHLEN];
@@ -445,7 +444,7 @@
                                }
                        }
                }
-               (void)signal(SIGINT, oldintr);
+               (void)xsignal(SIGINT, oldintr);
                mflag = 0;
                return;
        }
@@ -497,7 +496,7 @@
                }
                globfree(&gl);
        }
-       (void)signal(SIGINT, oldintr);
+       (void)xsignal(SIGINT, oldintr);
        mflag = 0;
 }
 
@@ -657,7 +656,7 @@
        }
        mname = argv[0];
        mflag = 1;
-       oldintr = signal(SIGINT, mabort);
+       oldintr = xsignal(SIGINT, mabort);
        (void)setjmp(jabort);
        while ((cp = remglob(argv, proxy, NULL)) != NULL) {
                if (*cp == '\0') {
@@ -690,7 +689,7 @@
                        }
                }
        }
-       (void)signal(SIGINT, oldintr);
+       (void)xsignal(SIGINT, oldintr);
        mflag = 0;
 }
 
@@ -1153,7 +1152,7 @@
        }
        mname = argv[0];
        mflag = 1;
-       oldintr = signal(SIGINT, mabort);
+       oldintr = xsignal(SIGINT, mabort);
        (void)setjmp(jabort);
        while ((cp = remglob(argv, 0, NULL)) != NULL) {
                if (*cp == '\0') {
@@ -1172,7 +1171,7 @@
                        }
                }
        }
-       (void)signal(SIGINT, oldintr);
+       (void)xsignal(SIGINT, oldintr);
        mflag = 0;
 }
 
@@ -1271,7 +1270,7 @@
        dolist = strcmp(argv[0], "mls");
        mname = argv[0];
        mflag = 1;
-       oldintr = signal(SIGINT, mabort);
+       oldintr = xsignal(SIGINT, mabort);
        (void)setjmp(jabort);
        for (i = 1; mflag && i < argc-1; ++i) {
                *mode = (i == 1) ? 'w' : 'a';
@@ -1286,7 +1285,7 @@
                        interactive = ointer;
                }
        }
-       (void)signal(SIGINT, oldintr);
+       (void)xsignal(SIGINT, oldintr);
        mflag = 0;
        if (dest != odest)                      /* free up after globulize() */
                free(dest);
@@ -1306,13 +1305,13 @@
        char shellnam[MAXPATHLEN], *shell, *namep;
        int wait_status;
 
-       old1 = signal (SIGINT, SIG_IGN);
-       old2 = signal (SIGQUIT, SIG_IGN);
+       old1 = xsignal(SIGINT, SIG_IGN);
+       old2 = xsignal(SIGQUIT, SIG_IGN);
        if ((pid = fork()) == 0) {
                for (pid = 3; pid < 20; pid++)
                        (void)close(pid);
-               (void)signal(SIGINT, SIG_DFL);
-               (void)signal(SIGQUIT, SIG_DFL);
+               (void)xsignal(SIGINT, SIG_DFL);
+               (void)xsignal(SIGQUIT, SIG_DFL);
                shell = getenv("SHELL");
                if (shell == NULL)
                        shell = _PATH_BSHELL;
@@ -1341,8 +1340,8 @@
        if (pid > 0)
                while (wait(&wait_status) != pid)
                        ;
-       (void)signal(SIGINT, old1);
-       (void)signal(SIGQUIT, old2);
+       (void)xsignal(SIGINT, old1);
+       (void)xsignal(SIGQUIT, old2);
        if (pid == -1) {
                warn("Try again later");
                code = -1;
@@ -1589,7 +1588,7 @@
 }
 
 void
-idle(argc, argv)
+idlecmd(argc, argv)
        int argc;
        char *argv[];
 {
@@ -1731,12 +1730,12 @@
                code = -1;
                return;
        }
-       oldintr = signal(SIGINT, proxabort);
+       oldintr = xsignal(SIGINT, proxabort);
        pswitch(1);
        if (c->c_conn && !connected) {
                fputs("Not connected.\n", ttyout);
                pswitch(0);
-               (void)signal(SIGINT, oldintr);
+               (void)xsignal(SIGINT, oldintr);
                code = -1;
                return;
        }
@@ -1751,7 +1750,7 @@
                proxflag = 0;
        }
        pswitch(0);
-       (void)signal(SIGINT, oldintr);
+       (void)xsignal(SIGINT, oldintr);
 }
 
 void
@@ -2108,8 +2107,8 @@
        } else
                incr = DEFAULTINCR;
 
-       oldusr1 = signal(SIGUSR1, SIG_IGN);
-       oldusr2 = signal(SIGUSR2, SIG_IGN);
+       oldusr1 = xsignal(SIGUSR1, SIG_IGN);
+       oldusr2 = xsignal(SIGUSR2, SIG_IGN);
        if (dir & RATE_GET) {
                if (!showonly) {
                        rate_get = max;
@@ -2130,8 +2129,8 @@
                "Put transfer rate throttle: %s; maximum: %d; increment %d.\n",
                            onoff(rate_put), rate_put, rate_put_incr);
        }
-       (void)signal(SIGUSR1, oldusr1);
-       (void)signal(SIGUSR2, oldusr2);
+       (void)xsignal(SIGUSR1, oldusr1);
+       (void)xsignal(SIGUSR2, oldusr2);
        return 0;
 }
 
diff -r 3ef34a648e82 -r 3176bc7f0898 usr.bin/ftp/cmdtab.c
--- a/usr.bin/ftp/cmdtab.c      Mon Sep 27 22:58:56 1999 +0000
+++ b/usr.bin/ftp/cmdtab.c      Mon Sep 27 23:09:42 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cmdtab.c,v 1.26 1999/09/22 07:18:32 lukem Exp $        */
+/*     $NetBSD: cmdtab.c,v 1.27 1999/09/27 23:09:42 lukem Exp $        */
 
 /*
  * Copyright (c) 1985, 1989, 1993, 1994
@@ -38,12 +38,11 @@
 #if 0
 static char sccsid[] = "@(#)cmdtab.c   8.4 (Berkeley) 10/9/94";
 #else
-__RCSID("$NetBSD: cmdtab.c,v 1.26 1999/09/22 07:18:32 lukem Exp $");
+__RCSID("$NetBSD: cmdtab.c,v 1.27 1999/09/27 23:09:42 lukem Exp $");
 #endif
 #endif /* not lint */
 
 #include <stdio.h>
-#include <signal.h>
 #include "ftp_var.h"
 
 /*
@@ -170,7 +169,7 @@
        { "glob",       globhelp,       0, 0, 0, CMPL0          setglob },
        { "hash",       hashhelp,       0, 0, 0, CMPL0          sethash },
        { "help",       helphelp,       0, 0, 1, CMPL(C)        help },
-       { "idle",       idlehelp,       0, 1, 1, CMPL0          idle },
+       { "idle",       idlehelp,       0, 1, 1, CMPL0          idlecmd },
        { "image",      binaryhelp,     0, 1, 1, CMPL0          setbinary },
        { "lcd",        lcdhelp,        0, 0, 0, CMPL(l)        lcd },
        { "less",       pagehelp,       1, 1, 1, CMPL(r)        page },
diff -r 3ef34a648e82 -r 3176bc7f0898 usr.bin/ftp/complete.c
--- a/usr.bin/ftp/complete.c    Mon Sep 27 22:58:56 1999 +0000
+++ b/usr.bin/ftp/complete.c    Mon Sep 27 23:09:42 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: complete.c,v 1.30 1999/09/26 02:00:12 lukem Exp $      */
+/*     $NetBSD: complete.c,v 1.31 1999/09/27 23:09:43 lukem Exp $      */
 
 /*-
  * Copyright (c) 1997, 1998, 1999 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: complete.c,v 1.30 1999/09/26 02:00:12 lukem Exp $");
+__RCSID("$NetBSD: complete.c,v 1.31 1999/09/27 23:09:43 lukem Exp $");
 #endif /* not lint */
 
 /*
@@ -46,7 +46,6 @@
  */
 
 #include <sys/stat.h>
-#include <signal.h>
 
 #include <ctype.h>
 #include <err.h>
diff -r 3ef34a648e82 -r 3176bc7f0898 usr.bin/ftp/domacro.c
--- a/usr.bin/ftp/domacro.c     Mon Sep 27 22:58:56 1999 +0000
+++ b/usr.bin/ftp/domacro.c     Mon Sep 27 23:09:42 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: domacro.c,v 1.12 1998/06/04 08:28:35 lukem Exp $       */
+/*     $NetBSD: domacro.c,v 1.13 1999/09/27 23:09:43 lukem Exp $       */
 
 /*
  * Copyright (c) 1985, 1993, 1994
@@ -38,12 +38,11 @@
 #if 0
 static char sccsid[] = "@(#)domacro.c  8.3 (Berkeley) 4/2/94";
 #else
-__RCSID("$NetBSD: domacro.c,v 1.12 1998/06/04 08:28:35 lukem Exp $");
+__RCSID("$NetBSD: domacro.c,v 1.13 1999/09/27 23:09:43 lukem Exp $");
 #endif
 #endif /* not lint */
 
 #include <ctype.h>
-#include <signal.h>
 #include <stdio.h>
 #include <string.h>
 
diff -r 3ef34a648e82 -r 3176bc7f0898 usr.bin/ftp/fetch.c
--- a/usr.bin/ftp/fetch.c       Mon Sep 27 22:58:56 1999 +0000
+++ b/usr.bin/ftp/fetch.c       Mon Sep 27 23:09:42 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fetch.c,v 1.76 1999/09/26 02:00:12 lukem Exp $ */
+/*     $NetBSD: fetch.c,v 1.77 1999/09/27 23:09:43 lukem Exp $ */
 
 /*-
  * Copyright (c) 1997, 1998, 1999 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: fetch.c,v 1.76 1999/09/26 02:00:12 lukem Exp $");
+__RCSID("$NetBSD: fetch.c,v 1.77 1999/09/27 23:09:43 lukem Exp $");
 #endif /* not lint */
 
 /*
@@ -62,7 +62,6 @@
 #include <errno.h>
 #include <netdb.h>
 #include <fcntl.h>
-#include <signal.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -1024,7 +1023,7 @@
        if (strcmp(savefile, "-") == 0) {



Home | Main Index | Thread Index | Old Index