home *** CD-ROM | disk | FTP | other *** search
- #include <stdio.h>
- #include <sys/types.h>
- #include <dirent.h>
-
- #define MSGDIR "/var/spool/pager"
-
- int main(argc, argv)
- int argc;
- char **argv;
- {
- DIR *dh;
- struct dirent *item;
- int i = 0;
-
- dh = opendir(MSGDIR);
- if (dh == NULL)
- return 1;
-
- while ((item = readdir(dh)) != 0)
- {
- if (item->d_name[0] != '.')
- {
- i++;
- }
- }
-
- if (i)
- {
- printf("There %s %d job%s in the pager queue.\n",
- i == 1 ? "is" : "are", i, i == 1 ? "" : "s");
- }
- else
- {
- printf("The pager queue is empty.\n");
- }
-
- return 0;
- }
-