diff options
author | joerg <joerg@FreeBSD.org> | 1997-10-14 16:01:02 +0000 |
---|---|---|
committer | joerg <joerg@FreeBSD.org> | 1997-10-14 16:01:02 +0000 |
commit | fef7c77457bb37b4446a11916d0e18bfbed5fca8 (patch) | |
tree | 5f0c559d9ab9b959f3e9d5b41198a5706e25b662 /usr.sbin/lpr/common_source | |
parent | eadc6c642e65bfe3b9c54fbfbe4c9a1b569663a8 (diff) | |
download | FreeBSD-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')
-rw-r--r-- | usr.sbin/lpr/common_source/common.c | 1 | ||||
-rw-r--r-- | usr.sbin/lpr/common_source/displayq.c | 4 | ||||
-rw-r--r-- | usr.sbin/lpr/common_source/lp.h | 1 | ||||
-rw-r--r-- | usr.sbin/lpr/common_source/lp.local.h | 1 | ||||
-rw-r--r-- | usr.sbin/lpr/common_source/rmjob.c | 15 |
5 files changed, 20 insertions, 2 deletions
diff --git a/usr.sbin/lpr/common_source/common.c b/usr.sbin/lpr/common_source/common.c index b7960c2..7301e2b 100644 --- a/usr.sbin/lpr/common_source/common.c +++ b/usr.sbin/lpr/common_source/common.c @@ -64,6 +64,7 @@ static char sccsid[] = "@(#)common.c 8.5 (Berkeley) 4/28/95"; char *AF; /* accounting file */ long BR; /* baud rate if lp is a tty */ char *CF; /* name of cifplot filter (per job) */ +long CT; /* TCP connection timeout */ char *DF; /* name of tex filter (per job) */ long DU; /* daeomon user-id */ char *FF; /* form feed string */ diff --git a/usr.sbin/lpr/common_source/displayq.c b/usr.sbin/lpr/common_source/displayq.c index 4e5f060..2903084 100644 --- a/usr.sbin/lpr/common_source/displayq.c +++ b/usr.sbin/lpr/common_source/displayq.c @@ -112,6 +112,8 @@ displayq(format) LO = DEFLOCK; if (cgetstr(bp, "st", &ST) < 0) ST = DEFSTAT; + if (cgetnum(bp, "ct", &CT) < 0) + CT = DEFTIMEOUT; cgetstr(bp, "rm", &RM); if ((cp = checkremote())) printf("Warning: %s\n", cp); @@ -237,7 +239,7 @@ displayq(format) } strcat(line, "\n"); savealrm = signal(SIGALRM, alarmhandler); - alarm(10); + alarm(CT); fd = getport(RM, 0); (void)signal(SIGALRM, savealrm); if (fd < 0) { diff --git a/usr.sbin/lpr/common_source/lp.h b/usr.sbin/lpr/common_source/lp.h index 5fdd7c5..816e652 100644 --- a/usr.sbin/lpr/common_source/lp.h +++ b/usr.sbin/lpr/common_source/lp.h @@ -41,6 +41,7 @@ extern char *AF; /* accounting file */ extern long BR; /* baud rate if lp is a tty */ extern char *CF; /* name of cifplot filter (per job) */ +extern long CT; /* TCP connection timeout */ extern char *DF; /* name of tex filter (per job) */ extern long DU; /* daeomon user-id */ extern char *FF; /* form feed string */ diff --git a/usr.sbin/lpr/common_source/lp.local.h b/usr.sbin/lpr/common_source/lp.local.h index 837fd2f..bc60549 100644 --- a/usr.sbin/lpr/common_source/lp.local.h +++ b/usr.sbin/lpr/common_source/lp.local.h @@ -49,6 +49,7 @@ #define DEFWIDTH 132 #define DEFLENGTH 66 #define DEFUID 1 +#define DEFTIMEOUT 120 /* * When files are created in the spooling area, they are normally 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 */ +} |