From 30b4b758aac44533074b506c2ca815a474dafd3e Mon Sep 17 00:00:00 2001 From: Garance A Drosehn Date: Mon, 6 Nov 2000 19:36:38 +0000 Subject: [PATCH] Cosmetic change of a structure name. Turn 'struct queue { q_time, q_name }' (loosely-speaking) into 'struct jobqueue { job_time, job_cfname }' Reviewed by: GAWollman --- usr.sbin/lpr/common_source/common.c | 34 +++++++++++++-------------- usr.sbin/lpr/common_source/displayq.c | 6 ++--- usr.sbin/lpr/common_source/lp.h | 8 +++---- usr.sbin/lpr/lpc/cmds.c | 20 ++++++++-------- usr.sbin/lpr/lpd/printjob.c | 20 ++++++++-------- 5 files changed, 44 insertions(+), 44 deletions(-) diff --git a/usr.sbin/lpr/common_source/common.c b/usr.sbin/lpr/common_source/common.c index 67a17254d930..0980e2ca8ae3 100644 --- a/usr.sbin/lpr/common_source/common.c +++ b/usr.sbin/lpr/common_source/common.c @@ -108,10 +108,10 @@ getline(cfp) int getq(pp, namelist) const struct printer *pp; - struct queue *(*namelist[]); + struct jobqueue *(*namelist[]); { register struct dirent *d; - register struct queue *q, **queue; + register struct jobqueue *q, **queue; register int nitems; struct stat stbuf; DIR *dirp; @@ -129,7 +129,7 @@ getq(pp, namelist) * and dividing it by a multiple of the minimum size entry. */ arraysz = (stbuf.st_size / 24); - queue = (struct queue **)malloc(arraysz * sizeof(struct queue *)); + queue = (struct jobqueue **)malloc(arraysz * sizeof(struct jobqueue *)); if (queue == NULL) goto errdone; @@ -141,19 +141,19 @@ getq(pp, namelist) if (stat(d->d_name, &stbuf) < 0) continue; /* Doesn't exist */ seteuid(uid); - q = (struct queue *)malloc(sizeof(time_t)+strlen(d->d_name)+1); + q = (struct jobqueue *)malloc(sizeof(time_t)+strlen(d->d_name)+1); if (q == NULL) goto errdone; - q->q_time = stbuf.st_mtime; - strcpy(q->q_name, d->d_name); + q->job_time = stbuf.st_mtime; + strcpy(q->job_cfname, d->d_name); /* * Check to make sure the array has space left and * realloc the maximum size. */ if (++nitems > arraysz) { arraysz *= 2; - queue = (struct queue **)realloc((char *)queue, - arraysz * sizeof(struct queue *)); + queue = (struct jobqueue **)realloc((char *)queue, + arraysz * sizeof(struct jobqueue *)); if (queue == NULL) goto errdone; } @@ -161,7 +161,7 @@ getq(pp, namelist) } closedir(dirp); if (nitems) - qsort(queue, nitems, sizeof(struct queue *), compar); + qsort(queue, nitems, sizeof(struct jobqueue *), compar); *namelist = queue; return(nitems); @@ -177,13 +177,13 @@ static int compar(p1, p2) const void *p1, *p2; { - const struct queue *qe1, *qe2; - qe1 = *(const struct queue **)p1; - qe2 = *(const struct queue **)p2; + const struct jobqueue *qe1, *qe2; + qe1 = *(const struct jobqueue **)p1; + qe2 = *(const struct jobqueue **)p2; - if (qe1->q_time < qe2->q_time) + if (qe1->job_time < qe2->job_time) return (-1); - if (qe1->q_time > qe2->q_time) + if (qe1->job_time > qe2->job_time) return (1); /* * At this point, the two files have the same last-modification time. @@ -192,11 +192,11 @@ compar(p1, p2) * around when it gets to '999', we also assume that '9xx' jobs are * older than '0xx' jobs. */ - if ((qe1->q_name[3] == '9') && (qe2->q_name[3] == '0')) + if ((qe1->job_cfname[3] == '9') && (qe2->job_cfname[3] == '0')) return (-1); - if ((qe1->q_name[3] == '0') && (qe2->q_name[3] == '9')) + if ((qe1->job_cfname[3] == '0') && (qe2->job_cfname[3] == '9')) return (1); - return (strcmp(qe1->q_name,qe2->q_name)); + return (strcmp(qe1->job_cfname, qe2->job_cfname)); } /* sleep n milliseconds */ diff --git a/usr.sbin/lpr/common_source/displayq.c b/usr.sbin/lpr/common_source/displayq.c index 7b1df2c9f247..5dfe621968c9 100644 --- a/usr.sbin/lpr/common_source/displayq.c +++ b/usr.sbin/lpr/common_source/displayq.c @@ -95,10 +95,10 @@ displayq(pp, format) struct printer *pp; int format; { - register struct queue *q; + register struct jobqueue *q; register int i, nitems, fd, ret; register char *cp; - struct queue **queue; + struct jobqueue **queue; struct stat statb; FILE *fp; void (*savealrm)(int); @@ -203,7 +203,7 @@ displayq(pp, format) header(); for (i = 0; i < nitems; i++) { q = queue[i]; - inform(pp, q->q_name); + inform(pp, q->job_cfname); free(q); } free(queue); diff --git a/usr.sbin/lpr/common_source/lp.h b/usr.sbin/lpr/common_source/lp.h index 276108a05463..4e4e4b6adab8 100644 --- a/usr.sbin/lpr/common_source/lp.h +++ b/usr.sbin/lpr/common_source/lp.h @@ -168,9 +168,9 @@ extern char *person; /* name of person doing lprm */ /* * Structure used for building a sorted list of control files. */ -struct queue { - time_t q_time; /* modification time */ - char q_name[MAXNAMLEN+1]; /* control file name */ +struct jobqueue { + time_t job_time; /* last-mod time of cf-file */ + char job_cfname[MAXNAMLEN+1]; /* control file name */ }; /* lpr/lpd generates readable timestamps for logfiles, etc. Have all those @@ -234,7 +234,7 @@ void free_request __P((struct request *rp)); int getline __P((FILE *)); int getport __P((const struct printer *pp, const char *, int)); int getprintcap __P((const char *printer, struct printer *pp)); -int getq __P((const struct printer *, struct queue *(*[]))); +int getq __P((const struct printer *, struct jobqueue *(*[]))); void header __P((void)); void inform __P((const struct printer *pp, char *cf)); void init_printer __P((struct printer *pp)); diff --git a/usr.sbin/lpr/lpc/cmds.c b/usr.sbin/lpr/lpc/cmds.c index 1ed69c84a561..97502f452bd6 100644 --- a/usr.sbin/lpr/lpc/cmds.c +++ b/usr.sbin/lpr/lpc/cmds.c @@ -76,7 +76,7 @@ static int doselect __P((struct dirent *)); static void putmsg __P((struct printer *, int, char **)); static int sortq __P((const void *, const void *)); static void startpr __P((struct printer *, int)); -static int touch __P((struct queue *)); +static int touch __P((struct jobqueue *)); static void unlinkf __P((char *)); static void upstat __P((struct printer *, char *)); @@ -711,7 +711,7 @@ stop(pp) seteuid(uid); } -struct queue **queue; +struct jobqueue **queue; int nitems; time_t mtime; @@ -761,7 +761,7 @@ topq(argc, argv) if (nitems == 0) return; changed = 0; - mtime = queue[0]->q_time; + mtime = queue[0]->job_time; for (i = argc; --i; ) { if (doarg(argv[i]) == 0) { printf("\tjob %s is not in the queue\n", argv[i]); @@ -794,7 +794,7 @@ topq(argc, argv) */ static int touch(q) - struct queue *q; + struct jobqueue *q; { struct timeval tvp[2]; int ret; @@ -802,7 +802,7 @@ touch(q) tvp[0].tv_sec = tvp[1].tv_sec = --mtime; tvp[0].tv_usec = tvp[1].tv_usec = 0; seteuid(euid); - ret = utimes(q->q_name, tvp); + ret = utimes(q->job_cfname, tvp); seteuid(uid); return (ret); } @@ -815,7 +815,7 @@ static int doarg(job) char *job; { - register struct queue **qq; + register struct jobqueue **qq; register int jobnum, n; register char *cp, *machine; int cnt = 0; @@ -842,7 +842,7 @@ doarg(job) while (isdigit(*job)); for (qq = queue + nitems; --qq >= queue; ) { n = 0; - for (cp = (*qq)->q_name+3; isdigit(*cp); ) + for (cp = (*qq)->job_cfname+3; isdigit(*cp); ) n = n * 10 + (*cp++ - '0'); if (jobnum != n) continue; @@ -851,7 +851,7 @@ doarg(job) if (machine != NULL && strcmp(machine, cp) != 0) continue; if (touch(*qq) == 0) { - printf("\tmoved %s\n", (*qq)->q_name); + printf("\tmoved %s\n", (*qq)->job_cfname); cnt++; } } @@ -862,7 +862,7 @@ doarg(job) */ for (qq = queue + nitems; --qq >= queue; ) { seteuid(euid); - fp = fopen((*qq)->q_name, "r"); + fp = fopen((*qq)->job_cfname, "r"); seteuid(uid); if (fp == NULL) continue; @@ -873,7 +873,7 @@ doarg(job) if (line[0] != 'P' || strcmp(job, line+1) != 0) continue; if (touch(*qq) == 0) { - printf("\tmoved %s\n", (*qq)->q_name); + printf("\tmoved %s\n", (*qq)->job_cfname); cnt++; } } diff --git a/usr.sbin/lpr/lpd/printjob.c b/usr.sbin/lpr/lpd/printjob.c index 7fe4f043975c..23f2dbb326bf 100644 --- a/usr.sbin/lpr/lpd/printjob.c +++ b/usr.sbin/lpr/lpd/printjob.c @@ -148,8 +148,8 @@ printjob(pp) struct printer *pp; { struct stat stb; - register struct queue *q, **qp; - struct queue **queue; + register struct jobqueue *q, **qp; + struct jobqueue **queue; register int i, nitems; off_t pidoff; int errcnt, count = 0; @@ -227,20 +227,20 @@ printjob(pp) */ for (qp = queue; nitems--; free((char *) q)) { q = *qp++; - if (stat(q->q_name, &stb) < 0) + if (stat(q->job_cfname, &stb) < 0) continue; errcnt = 0; restart: (void) lseek(lfd, pidoff, 0); - (void) snprintf(line, sizeof(line), "%s\n", q->q_name); + (void) snprintf(line, sizeof(line), "%s\n", q->job_cfname); i = strlen(line); if (write(lfd, line, i) != i) syslog(LOG_ERR, "%s: %s: %m", pp->printer, pp->lock_file); if (!pp->remote) - i = printit(pp, q->q_name); + i = printit(pp, q->job_cfname); else - i = sendit(pp, q->q_name); + i = sendit(pp, q->job_cfname); /* * Check to see if we are supposed to stop printing or * if we are to rebuild the queue. @@ -282,12 +282,12 @@ printjob(pp) syslog(LOG_WARNING, "%s: job could not be %s (%s)", pp->printer, pp->remote ? "sent to remote host" : "printed", - q->q_name); + q->job_cfname); if (i == REPRINT) { /* ensure we don't attempt this job again */ - (void) unlink(q->q_name); - q->q_name[0] = 'd'; - (void) unlink(q->q_name); + (void) unlink(q->job_cfname); + q->job_cfname[0] = 'd'; + (void) unlink(q->job_cfname); if (logname[0]) sendmail(pp, logname, FATALERR); }