summaryrefslogtreecommitdiffstats
path: root/usr.sbin/lpr/common_source/common.c
diff options
context:
space:
mode:
authorgad <gad@FreeBSD.org>2001-06-12 16:38:20 +0000
committergad <gad@FreeBSD.org>2001-06-12 16:38:20 +0000
commitd61428321f0ceb41de748a616b592b50195c51fb (patch)
tree115b09aed7f19dda18dbe2e66eba92a08b0d2441 /usr.sbin/lpr/common_source/common.c
parentb39990d7f9947621a844c7a4936eeb286a471c47 (diff)
downloadFreeBSD-src-d61428321f0ceb41de748a616b592b50195c51fb.zip
FreeBSD-src-d61428321f0ceb41de748a616b592b50195c51fb.tar.gz
Fix about 90-100 warnings one gets when trying to compile lpr&friends
with BDECFLAGS on, mainly by adding 'const' to parameters in a number of routine declarations. While I'm at it, ANSI-fy all of the routine declarations. The resulting object code is exactly the same after this update as before it, with the exception of one unavoidable change to lpd.o on freebsd/alpha. Also added $FreeBSD$ line to lpc/extern.h lpc/lpc.h lptest/lptest.c Reviewed by: /sbin/md5, and no feedback from freebsd-audit
Diffstat (limited to 'usr.sbin/lpr/common_source/common.c')
-rw-r--r--usr.sbin/lpr/common_source/common.c57
1 files changed, 17 insertions, 40 deletions
diff --git a/usr.sbin/lpr/common_source/common.c b/usr.sbin/lpr/common_source/common.c
index e693e15..2cf17ec 100644
--- a/usr.sbin/lpr/common_source/common.c
+++ b/usr.sbin/lpr/common_source/common.c
@@ -64,11 +64,11 @@ static const char rcsid[] =
* Routines and data common to all the line printer functions.
*/
char line[BUFSIZ];
-char *name; /* program name */
+const char *name; /* program name */
extern uid_t uid, euid;
-static int compar __P((const void *, const void *));
+static int compar(const void *_p1, const void *_p2);
/*
* Getline reads a line from the control file cfp, removes tabs, converts
@@ -76,8 +76,7 @@ static int compar __P((const void *, const void *));
* Returns 0 at EOF or the number of characters read.
*/
int
-getline(cfp)
- FILE *cfp;
+getline(FILE *cfp)
{
register int linel = 0;
register char *lp = line;
@@ -106,9 +105,7 @@ getline(cfp)
* Return the number of entries and a pointer to the list.
*/
int
-getq(pp, namelist)
- const struct printer *pp;
- struct jobqueue *(*namelist[]);
+getq(const struct printer *pp, struct jobqueue *(*namelist[]))
{
register struct dirent *d;
register struct jobqueue *q, **queue;
@@ -179,8 +176,7 @@ errdone:
* Compare modification times.
*/
static int
-compar(p1, p2)
- const void *p1, *p2;
+compar(const void *p1, const void *p2)
{
const struct jobqueue *qe1, *qe2;
@@ -207,24 +203,20 @@ compar(p1, p2)
/* sleep n milliseconds */
void
-delay(n)
- int n;
+delay(int millisec)
{
struct timeval tdelay;
- if (n <= 0 || n > 10000)
+ if (millisec <= 0 || millisec > 10000)
fatal((struct printer *)0, /* fatal() knows how to deal */
- "unreasonable delay period (%d)", n);
- tdelay.tv_sec = n / 1000;
- tdelay.tv_usec = n * 1000 % 1000000;
+ "unreasonable delay period (%d)", millisec);
+ tdelay.tv_sec = millisec / 1000;
+ tdelay.tv_usec = millisec * 1000 % 1000000;
(void) select(0, (fd_set *)0, (fd_set *)0, (fd_set *)0, &tdelay);
}
char *
-lock_file_name(pp, buf, len)
- const struct printer *pp;
- char *buf;
- size_t len;
+lock_file_name(const struct printer *pp, char *buf, size_t len)
{
static char staticbuf[MAXPATHLEN];
@@ -243,10 +235,7 @@ lock_file_name(pp, buf, len)
}
char *
-status_file_name(pp, buf, len)
- const struct printer *pp;
- char *buf;
- size_t len;
+status_file_name(const struct printer *pp, char *buf, size_t len)
{
static char staticbuf[MAXPATHLEN];
@@ -266,10 +255,7 @@ status_file_name(pp, buf, len)
/* routine to get a current timestamp, optionally in a standard-fmt string */
void
-lpd_gettime(tsp, strp, strsize)
- struct timespec *tsp;
- char *strp;
- int strsize;
+lpd_gettime(struct timespec *tsp, char *strp, int strsize)
{
struct timespec local_ts;
struct timeval btime;
@@ -331,10 +317,7 @@ lpd_gettime(tsp, strp, strsize)
/* routines for writing transfer-statistic records */
void
-trstat_init(pp, fname, filenum)
- struct printer *pp;
- const char *fname;
- int filenum;
+trstat_init(struct printer *pp, const char *fname, int filenum)
{
register const char *srcp;
register char *destp, *endp;
@@ -369,13 +352,8 @@ trstat_init(pp, fname, filenum)
}
void
-trstat_write(pp, sendrecv, bytecnt, userid, otherhost, orighost)
- struct printer *pp;
- tr_sendrecv sendrecv;
- size_t bytecnt;
- const char *userid;
- const char *otherhost;
- const char *orighost;
+trstat_write(struct printer *pp, tr_sendrecv sendrecv, size_t bytecnt,
+ const char *userid, const char *otherhost, const char *orighost)
{
#define STATLINE_SIZE 1024
double trtime;
@@ -594,8 +572,7 @@ fatal(pp, msg, va_alist)
* be better to close the first N fds, for some small value of N.
*/
void
-closeallfds(start)
- int start;
+closeallfds(int start)
{
int stop = getdtablesize();
for (; start < stop; start++)
OpenPOWER on IntegriCloud