From 3d5c344fff1f36da66bfb827bc53cab5ebaea055 Mon Sep 17 00:00:00 2001 From: tb Date: Tue, 12 Jan 2016 23:35:14 +0000 Subject: 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@ --- usr.sbin/lpr/lpd/printjob.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'usr.sbin/lpr/lpd') 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 */ -- cgit v1.2.3