SCCS-vsn: usr.sbin/lpr/lpd/lpd.c 8.7
SCCS-vsn: usr.sbin/lpr/lpd/printjob.c 8.7
SCCS-vsn: usr.sbin/lpr/lpq/lpq.c 8.3
#endif /* not lint */
#ifndef lint
#endif /* not lint */
#ifndef lint
-static char sccsid[] = "@(#)lpd.c 8.6 (Berkeley) %G%";
+static char sccsid[] = "@(#)lpd.c 8.7 (Berkeley) %G%";
static void doit __P((void));
static void startup __P((void));
static void chkhost __P((struct sockaddr_in *));
static void doit __P((void));
static void startup __P((void));
static void chkhost __P((struct sockaddr_in *));
+static int ckqueue __P((char *));
* Restart the daemons.
*/
while (cgetnext(&buf, printcapdb) > 0) {
* Restart the daemons.
*/
while (cgetnext(&buf, printcapdb) > 0) {
+ if (ckqueue(buf) <= 0) {
free(buf);
continue; /* no work to do for this printer */
}
free(buf);
continue; /* no work to do for this printer */
}
/*
* Make sure there's some work to do before forking off a child
*/
/*
* Make sure there's some work to do before forking off a child
*/
+static int
+ckqueue(cap)
+ char *cap;
{
register struct dirent *d;
DIR *dirp;
char *spooldir;
{
register struct dirent *d;
DIR *dirp;
char *spooldir;
- if (cgetstr(bp, "sd", &spooldir) == -1)
+ if (cgetstr(cap, "sd", &spooldir) == -1)
spooldir = _PATH_DEFSPOOL;
if ((dirp = opendir(spooldir)) == NULL)
return (-1);
spooldir = _PATH_DEFSPOOL;
if ((dirp = opendir(spooldir)) == NULL)
return (-1);
#endif /* not lint */
#ifndef lint
#endif /* not lint */
#ifndef lint
-static char sccsid[] = "@(#)printjob.c 8.6 (Berkeley) %G%";
+static char sccsid[] = "@(#)printjob.c 8.7 (Berkeley) %G%";
{
register int i;
int resp, port;
{
register int i;
int resp, port;
- *cp++ = '\0';
- port = atoi(cp);
+ save_ch = *cp;
+ *cp = '\0';
+ port = atoi(LP);
- syslog(LOG_ERR, "%s: bad port number: %s", printer, cp);
+ syslog(LOG_ERR, "%s: bad port number: %s", printer, LP);
for (i = 1; ; i = i < 256 ? i << 1 : i) {
resp = -1;
for (i = 1; ; i = i < 256 ? i << 1 : i) {
resp = -1;
- pfd = getport(LP, port);
+ pfd = getport(cp, port);
if (pfd < 0 && errno == ECONNREFUSED)
resp = 1;
else if (pfd >= 0) {
if (pfd < 0 && errno == ECONNREFUSED)
resp = 1;
else if (pfd >= 0) {
- pstatus("sending to %s port %d", LP, port);
- *(--cp) = '@'; /* restore LP parameter in case we are called again */
+ pstatus("sending to %s port %d", cp, port);
#endif /* not lint */
#ifndef lint
#endif /* not lint */
#ifndef lint
-static char sccsid[] = "@(#)lpq.c 8.2 (Berkeley) %G%";
+static char sccsid[] = "@(#)lpq.c 8.3 (Berkeley) %G%";
char *user[MAXUSERS]; /* users to process */
int users; /* # of users in user array */
char *user[MAXUSERS]; /* users to process */
int users; /* # of users in user array */
+static int ckqueue __P((char *));
void usage __P((void));
int
void usage __P((void));
int
if (aflag) {
while (cgetnext(&buf, printcapdb) > 0) {
if (aflag) {
while (cgetnext(&buf, printcapdb) > 0) {
+ if (ckqueue(buf) <= 0) {
free(buf);
continue; /* no jobs */
}
free(buf);
continue; /* no jobs */
}
+static int
+ckqueue(cap)
+ char *cap;
{
register struct dirent *d;
DIR *dirp;
char *spooldir;
{
register struct dirent *d;
DIR *dirp;
char *spooldir;
- if (cgetstr(bp, "sd", &spooldir) == -1)
+ if (cgetstr(cap, "sd", &spooldir) == -1)
spooldir = _PATH_DEFSPOOL;
if ((dirp = opendir(spooldir)) == NULL)
return (-1);
spooldir = _PATH_DEFSPOOL;
if ((dirp = opendir(spooldir)) == NULL)
return (-1);