home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 4 / DATAFILE_PDCD4.iso / utilities / utilsf / gsm / GSM / pagerq_c < prev    next >
Encoding:
Text File  |  1995-06-05  |  569 b   |  39 lines

  1. #include <stdio.h>
  2. #include <sys/types.h>
  3. #include <dirent.h>
  4.  
  5. #define        MSGDIR    "/var/spool/pager"
  6.  
  7. int main(argc, argv)
  8.      int argc;
  9.      char **argv;
  10. {
  11.     DIR *dh;
  12.     struct dirent *item;
  13.     int i = 0;
  14.  
  15.     dh = opendir(MSGDIR);
  16.     if (dh == NULL)
  17.     return 1;
  18.  
  19.     while ((item = readdir(dh)) != 0)
  20.     {
  21.     if (item->d_name[0] != '.')
  22.     {
  23.         i++;
  24.     }
  25.     }
  26.  
  27.     if (i)
  28.     {
  29.     printf("There %s %d job%s in the pager queue.\n",
  30.            i == 1 ? "is" : "are", i, i == 1 ? "" : "s");
  31.     }
  32.     else
  33.     {
  34.     printf("The pager queue is empty.\n");
  35.     }
  36.  
  37.     return 0;
  38. }
  39.