Deleted Added
full compact
lpq.c (50479) lpq.c (78146)
1/*
2 * Copyright (c) 1983, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 29 unchanged lines hidden (view full) ---

38 The Regents of the University of California. All rights reserved.\n";
39#endif /* not lint */
40
41#ifndef lint
42/*
43static char sccsid[] = "@(#)lpq.c 8.3 (Berkeley) 5/10/95";
44*/
45static const char rcsid[] =
1/*
2 * Copyright (c) 1983, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 29 unchanged lines hidden (view full) ---

38 The Regents of the University of California. All rights reserved.\n";
39#endif /* not lint */
40
41#ifndef lint
42/*
43static char sccsid[] = "@(#)lpq.c 8.3 (Berkeley) 5/10/95";
44*/
45static const char rcsid[] =
46 "$FreeBSD: head/usr.sbin/lpr/lpq/lpq.c 50479 1999-08-28 01:35:59Z peter $";
46 "$FreeBSD: head/usr.sbin/lpr/lpq/lpq.c 78146 2001-06-12 16:38:20Z gad $";
47#endif /* not lint */
48
49/*
50 * Spool Queue examination program
51 *
52 * lpq [-a] [-l] [-Pprinter] [user...] [job...]
53 *
54 * -a show all non-null queues on the local machine

--- 17 unchanged lines hidden (view full) ---

72
73int requ[MAXREQUESTS]; /* job number of spool entries */
74int requests; /* # of spool requests */
75char *user[MAXUSERS]; /* users to process */
76int users; /* # of users in user array */
77
78uid_t uid, euid;
79
47#endif /* not lint */
48
49/*
50 * Spool Queue examination program
51 *
52 * lpq [-a] [-l] [-Pprinter] [user...] [job...]
53 *
54 * -a show all non-null queues on the local machine

--- 17 unchanged lines hidden (view full) ---

72
73int requ[MAXREQUESTS]; /* job number of spool entries */
74int requests; /* # of spool requests */
75char *user[MAXUSERS]; /* users to process */
76int users; /* # of users in user array */
77
78uid_t uid, euid;
79
80static int ckqueue __P((const struct printer *));
81static void usage __P((void));
82int main __P((int, char **));
80static int ckqueue(const struct printer *_pp);
81static void usage(void);
82int main(int _argc, char **_argv);
83
84int
83
84int
85main(argc, argv)
86 int argc;
87 char **argv;
85main(int argc, char **argv)
88{
89 int ch, aflag, lflag;
86{
87 int ch, aflag, lflag;
90 char *printer;
88 const char *printer;
91 struct printer myprinter, *pp = &myprinter;
92
93 printer = NULL;
94 euid = geteuid();
95 uid = getuid();
96 seteuid(uid);
97 name = *argv;
98 if (gethostname(host, sizeof(host)))

--- 68 unchanged lines hidden (view full) ---

167 fatal(pp, pcaperr(status));
168
169 displayq(pp, lflag);
170 }
171 exit(0);
172}
173
174static int
89 struct printer myprinter, *pp = &myprinter;
90
91 printer = NULL;
92 euid = geteuid();
93 uid = getuid();
94 seteuid(uid);
95 name = *argv;
96 if (gethostname(host, sizeof(host)))

--- 68 unchanged lines hidden (view full) ---

165 fatal(pp, pcaperr(status));
166
167 displayq(pp, lflag);
168 }
169 exit(0);
170}
171
172static int
175ckqueue(pp)
176 const struct printer *pp;
173ckqueue(const struct printer *pp)
177{
178 register struct dirent *d;
179 DIR *dirp;
180 char *spooldir;
181
182 spooldir = pp->spool_dir;
183 if ((dirp = opendir(spooldir)) == NULL)
184 return (-1);
185 while ((d = readdir(dirp)) != NULL) {
186 if (d->d_name[0] != 'c' || d->d_name[1] != 'f')
187 continue; /* daemon control files only */
188 closedir(dirp);
189 return (1); /* found something */
190 }
191 closedir(dirp);
192 return (0);
193}
194
195static void
174{
175 register struct dirent *d;
176 DIR *dirp;
177 char *spooldir;
178
179 spooldir = pp->spool_dir;
180 if ((dirp = opendir(spooldir)) == NULL)
181 return (-1);
182 while ((d = readdir(dirp)) != NULL) {
183 if (d->d_name[0] != 'c' || d->d_name[1] != 'f')
184 continue; /* daemon control files only */
185 closedir(dirp);
186 return (1); /* found something */
187 }
188 closedir(dirp);
189 return (0);
190}
191
192static void
196usage()
193usage(void)
197{
198 fprintf(stderr,
199 "usage: lpq [-a] [-l] [-Pprinter] [user ...] [job ...]\n");
200 exit(1);
201}
194{
195 fprintf(stderr,
196 "usage: lpq [-a] [-l] [-Pprinter] [user ...] [job ...]\n");
197 exit(1);
198}