diff options
author | tb <tb@cvs.openbsd.org> | 2016-01-12 23:35:14 +0000 |
---|---|---|
committer | tb <tb@cvs.openbsd.org> | 2016-01-12 23:35:14 +0000 |
commit | 3d5c344fff1f36da66bfb827bc53cab5ebaea055 (patch) | |
tree | 1902a939ed2a81c60d32ed7639240e8d3396162a /usr.sbin/lpr/lpd | |
parent | e610fca0ff631fc9fb7e58ac76d4b5f94a47b7ee (diff) |
Move prototypes of local functions from lp.h to the .c files and make
functions static if possible. Move delay() to lpd/printjob.c and fix
an annoying typo.
ok deraadt@
Diffstat (limited to 'usr.sbin/lpr/lpd')
-rw-r--r-- | usr.sbin/lpr/lpd/printjob.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/usr.sbin/lpr/lpd/printjob.c b/usr.sbin/lpr/lpd/printjob.c index ec8edd73069..febf582d7d6 100644 --- a/usr.sbin/lpr/lpd/printjob.c +++ b/usr.sbin/lpr/lpd/printjob.c @@ -1,4 +1,4 @@ -/* $OpenBSD: printjob.c,v 1.55 2015/08/20 22:46:32 deraadt Exp $ */ +/* $OpenBSD: printjob.c,v 1.56 2016/01/12 23:35:13 tb Exp $ */ /* $NetBSD: printjob.c,v 1.31 2002/01/21 14:42:30 wiz Exp $ */ /* @@ -104,6 +104,7 @@ static char width[10] = "-w"; /* page width in static characters */ static void abortpr(int); static void banner(char *, char *); +static void delay(int); static pid_t dofork(int); static int dropit(int); static void init(void); @@ -1190,6 +1191,19 @@ sendmail(char *user, int bombed) } } +/* sleep n milliseconds */ +static void +delay(int n) +{ + struct timespec tdelay; + + if (n <= 0 || n > 10000) + fatal("unreasonable delay period (%d)", n); + tdelay.tv_sec = n / 1000; + tdelay.tv_nsec = n * 1000000 % 1000000000; + nanosleep(&tdelay, NULL); +} + /* * dofork - fork with retries on failure */ |