summaryrefslogtreecommitdiffstats
path: root/usr.sbin/lpr/common_source/rmjob.c
diff options
context:
space:
mode:
authorjoerg <joerg@FreeBSD.org>1997-10-14 16:01:02 +0000
committerjoerg <joerg@FreeBSD.org>1997-10-14 16:01:02 +0000
commitfef7c77457bb37b4446a11916d0e18bfbed5fca8 (patch)
tree5f0c559d9ab9b959f3e9d5b41198a5706e25b662 /usr.sbin/lpr/common_source/rmjob.c
parenteadc6c642e65bfe3b9c54fbfbe4c9a1b569663a8 (diff)
downloadFreeBSD-src-fef7c77457bb37b4446a11916d0e18bfbed5fca8.zip
FreeBSD-src-fef7c77457bb37b4446a11916d0e18bfbed5fca8.tar.gz
Improve my hack from rev 1.6 of displayq.c, and make the TCP
connection timeout controllable by a new printcap(5) capability named `ct' (connectiom timeout), defaulting to 120 seconds (which is the default TCP connection timeout). Would anybody see a problem with merging all this into RELENG_2_2?
Diffstat (limited to 'usr.sbin/lpr/common_source/rmjob.c')
-rw-r--r--usr.sbin/lpr/common_source/rmjob.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/usr.sbin/lpr/common_source/rmjob.c b/usr.sbin/lpr/common_source/rmjob.c
index 32e13d4..256da3f 100644
--- a/usr.sbin/lpr/common_source/rmjob.c
+++ b/usr.sbin/lpr/common_source/rmjob.c
@@ -36,7 +36,7 @@
static char sccsid[] = "@(#)rmjob.c 8.2 (Berkeley) 4/28/95";
#endif
static const char rcsid[] =
- "$Id$";
+ "$Id: rmjob.c,v 1.9 1997/09/24 06:47:31 charnier Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -67,6 +67,7 @@ static char current[40]; /* active control file name */
extern uid_t uid, euid; /* real and effective user id's */
+static void alarmhandler __P((int));
static void do_unlink __P((char *));
void
@@ -91,6 +92,8 @@ rmjob()
SD = _PATH_DEFSPOOL;
if (cgetstr(bp,"lo", &LO) < 0)
LO = DEFLOCK;
+ if (cgetnum(bp, "ct", &CT) < 0)
+ CT = DEFTIMEOUT;
cgetstr(bp, "rm", &RM);
if ((cp = checkremote()))
printf("Warning: %s\n", cp);
@@ -317,6 +320,7 @@ rmremote()
register char *cp;
register int i, rem;
char buf[BUFSIZ];
+ void (*savealrm)(int);
if (!remote)
return; /* not sending to a remote machine */
@@ -339,7 +343,10 @@ rmremote()
(void) sprintf(cp, " %d", requ[i]);
}
strcat(cp, "\n");
+ savealrm = signal(SIGALRM, alarmhandler);
+ alarm(CT);
rem = getport(RM, 0);
+ (void)signal(SIGALRM, savealrm);
if (rem < 0) {
if (from != host)
printf("%s: ", host);
@@ -363,3 +370,9 @@ iscf(d)
{
return(d->d_name[0] == 'c' && d->d_name[1] == 'f');
}
+
+void
+alarmhandler(signo)
+{
+ /* ignored */
+}
OpenPOWER on IntegriCloud