I am having trouble seeing how these two functions are accomplshinig the same thing, checking for control files in the spool. These files always start with cf.
in lpd.c makes sense to me. /* * Make sure there's some work to do before forking off a child * XXX - could be common w/ lpq */ static int ckqueue(char *cap) { struct dirent *d; DIR *dirp; char *spooldir; if (cgetstr(cap, "sd", &spooldir) >= 0) { dirp = opendir(spooldir); free(spooldir); } else dirp = opendir(_PATH_DEFSPOOL); if (dirp == NULL) return (-1); while ((d = readdir(dirp)) != NULL) { if (d->d_name[0] == 'c' && d->d_name[1] == 'f') { closedir(dirp); return (1); /* found a cf file */ } } closedir(dirp); return (0); } in lpq.c does not make sense to me /* XXX - could be common w/ lpd */ static int ckqueue(char *cap) { struct dirent *d; DIR *dirp; char *spooldir; if (cgetstr(cap, "sd", &spooldir) >= 0) { dirp = opendir(spooldir); free(spooldir); } else dirp = opendir(_PATH_DEFSPOOL); if (dirp == NULL) return (-1); while ((d = readdir(dirp)) != NULL) { if (d->d_name[0] != 'c' || d->d_name[1] != 'f') continue; /* daemon control files only */ closedir(dirp); return (1); /* found something */ } closedir(dirp); return (0); } the line: if (d->d_name[0] != 'c' || d->d_name[1] != 'f') is excluding files that start with cf, yet then has the comment that daemon controls files are found. They both acccomplish the same thing of returning if there are files in the spool. Thanks, Chris