From: franklahm Date: Tue, 17 Mar 2009 08:55:12 +0000 (+0000) Subject: Remove timeout. See bug #2683367 X-Git-Tag: before-dbd-overhaul~24 X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?p=netatalk.git;a=commitdiff_plain;h=cc116acfd9a133530ef7a600ec0d8288cf4db326 Remove timeout. See bug #2683367 --- diff --git a/contrib/printing/Makefile.am b/contrib/printing/Makefile.am index e2237ad0..649c5fb7 100644 --- a/contrib/printing/Makefile.am +++ b/contrib/printing/Makefile.am @@ -1,9 +1,5 @@ # Makefile.am for contrib/printing/ bin_SCRIPTS = add_netatalk_printer -bin_PROGRAMS = timeout - -timeout_SOURCES = timeout.c -timeout_LDADD = $(top_builddir)/libatalk/libatalk.la EXTRA_DIST = netatalk.template add_netatalk_printer diff --git a/contrib/printing/timeout.c b/contrib/printing/timeout.c deleted file mode 100644 index e1776e22..00000000 --- a/contrib/printing/timeout.c +++ /dev/null @@ -1,245 +0,0 @@ -/* - * $Id: timeout.c,v 1.5 2005-04-28 20:49:36 bfernhomberg Exp $ - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif /* HAVE_CONFIG_H */ - -#include -#include -#include -#include -#include -#ifdef HAVE_UNISTD_H -#include -#endif /* HAVE_UNISTD_H */ - -char **av; - -struct slist { - char *name; - int num; -} sigs[] = { -#ifdef SIGHUP - { "HUP", SIGHUP }, -#endif -#ifdef SIGINT - { "INT", SIGINT }, -#endif -#ifdef SIGQUIT - { "QUIT", SIGQUIT }, -#endif -#ifdef SIGILL - { "ILL", SIGILL }, -#endif -#ifdef SIGTRAP - { "TRAP", SIGTRAP }, -#endif -#ifdef SIGABRT - { "ABRT", SIGABRT }, -#endif -#ifdef SIGIOT - { "IOT", SIGIOT }, -#endif -#ifdef SIGEMT - { "EMT", SIGEMT }, -#endif -#ifdef SIGFPE - { "FPE", SIGFPE }, -#endif -#ifdef SIGKILL - { "KILL", SIGKILL }, -#endif -#ifdef SIGBUS - { "BUS", SIGBUS }, -#endif -#ifdef SIGSEGV - { "SEGV", SIGSEGV }, -#endif -#ifdef SIGSYS - { "SYS", SIGSYS }, -#endif -#ifdef SIGPIPE - { "PIPE", SIGPIPE }, -#endif -#ifdef SIGALRM - { "ALRM", SIGALRM }, -#endif -#ifdef SIGTERM - { "TERM", SIGTERM }, -#endif -#ifdef SIGURG - { "URG", SIGURG }, -#endif -#ifdef SIGSTOP - { "STOP", SIGSTOP }, -#endif -#ifdef SIGTSTP - { "TSTP", SIGTSTP }, -#endif -#ifdef SIGCONT - { "CONT", SIGCONT }, -#endif -#ifdef SIGCHLD - { "CHLD", SIGCHLD }, -#endif -#ifdef SIGCLD - { "CLD", SIGCLD }, -#endif -#ifdef SIGTTIN - { "TTIN", SIGTTIN }, -#endif -#ifdef SIGTTOU - { "TTOU", SIGTTOU }, -#endif -#ifdef SIGIO - { "IO", SIGIO }, -#endif -#ifdef SIGXCPU - { "XCPU", SIGXCPU }, -#endif -#ifdef SIGXFSZ - { "XFSZ", SIGXFSZ }, -#endif -#ifdef SIGVTALRM - { "VTALRM", SIGVTALRM }, -#endif -#ifdef SIGPROF - { "PROF", SIGPROF }, -#endif -#ifdef SIGWINCH - { "WINCH", SIGWINCH }, -#endif -#ifdef SIGINFO - { "INFO", SIGINFO }, -#endif -#ifdef SIGUSR1 - { "USR1", SIGUSR1 }, -#endif -#ifdef SIGUSR2 - { "USR2", SIGUSR2 }, -#endif -#ifdef SIGPWR - { "PWR", SIGPWR }, -#endif - { 0, 0 } -}; - -void -usage() -{ - int i; - - fprintf (stderr, "Usage: %s [-s signal] seconds program [args]\n\n", - *av); - fprintf (stderr, "You can use a numerical signal, or one of these:\n"); - -#define COLS 8 - - for (i = 0; sigs[i].name; i++) { - if (i % COLS == 0) - fprintf (stderr, "\n\t"); - - fprintf (stderr, "%s", sigs[i].name); - - if ((i + 1) % COLS != 0) - fprintf (stderr, "\t"); - } - - fprintf (stderr, "\n\n"); -} - -int -main (argc, argv) - int argc; - char **argv; -{ - int i; - int whatsig = SIGTERM; - extern char *optarg; - extern int optind; - int pid; - - av = argv; - - while ((i = getopt (argc, argv, "+s:")) != -1) { - - switch (i) { - case 's': - if (isdigit (*optarg)) { - whatsig = atoi (optarg); - } else { - for (i = 0; sigs[i].name; i++) { - if (!strcmp (sigs[i].name, optarg)) { - whatsig = sigs[i].num; - break; - } - } - - if (!sigs[i].name) { - fprintf (stderr, - "%s: Unknown signal %s\n", - *av, optarg); - usage(); - exit (1); - } - } - - break; - - default: - usage(); - exit (1); - } - } - - if (optind > argc - 2) { - usage(); - exit (1); - } - - if (!isdigit (*argv[optind])) { - fprintf (stderr, "%s: \"seconds\" must be numeric, not %s\n", - *av, argv[optind]); - usage(); - exit (1); - } - - pid = fork(); - - if (pid < 0) { - fprintf (stderr, "%s: fork failed: ", *av); - perror ("fork"); - exit (1); - } else if (pid == 0) { - int seconds = atoi (argv[optind]); - - pid = getppid(); - - fclose (stdin); - fclose (stdout); - fclose (stderr); - - while (seconds-- > 0) { - /* - * too bad there's no SIGPARENT so we have to keep - * polling to find out if it's still there - */ - - if (kill (pid, 0) != 0) - exit (0); - - sleep (1); - } - - kill (pid, whatsig); - exit (0); - } else { - execvp (argv[optind + 1], argv + optind + 1); - - fprintf (stderr, "%s: can't execute ", *av); - perror (argv[optind + 1]); - exit (1); - } -} diff --git a/man/man1/Makefile.am b/man/man1/Makefile.am index 4dbf05e3..e2324013 100644 --- a/man/man1/Makefile.am +++ b/man/man1/Makefile.am @@ -32,7 +32,6 @@ NONGENERATED_MANS = achfile.1 \ papstatus.1 \ psorder.1 \ single2bin.1 \ - timeout.1 \ unbin.1 \ unhex.1 \ unsingle.1 diff --git a/man/man1/timeout.1 b/man/man1/timeout.1 deleted file mode 100644 index 0aab483c..00000000 --- a/man/man1/timeout.1 +++ /dev/null @@ -1,28 +0,0 @@ -.TH timeout 1 "19 Jul 2001" 2.0.0 Netatalk -.SH NAME -timeout \- Send a signal to a program after a certain time -.SH SYNTAX -timeout [\-s \fIsignal\fR] \fIseconds\fR \fIprogram\fR [\fIargs\fR] -.SH DESCRIPTION -\fItimeout\fR executes a \fIprogram\fR (with arguments \fIargs\fR) -and sends a \fIsignal\fR to it after a certain -amount of \fIseconds\fR. -.SH OPTIONS -.TP -\fB\-s\fR \fIsignal\fR -Signal to send to the spawned process. This can be a numerical -or symbolic ID. This defaults to \fBTERM\fR. -.SH EXAMPLES -.TP -timeout 10 pap foo.ps -Execute "pap foo.ps" and send a SIGTERM -if \fIpap\fR doesn't return after 10 -seconds. -.TP -timeout \-s HUP 60 sh -Spawn a shell and send a hangup signal after one minute. -.TP -timeout \-s 9 10 evilprog -Execute a program and \fIKILL\fR it -if it doesn't quit after 10 seconds. -