home *** CD-ROM | disk | FTP | other *** search
/ Photo CD Demo 1 / Demo.bin / inetray / inetrypn.c < prev    next >
C/C++ Source or Header  |  1992-06-04  |  1KB  |  59 lines

  1. /*======================================================================
  2.                     I N E T R A Y . P I N G . C 
  3.                     doc: Thu Mar  5 12:55:31 1992
  4.                     dlm: Fri Jun  5 12:46:38 1992
  5.                     (c) 1992 ant@julia
  6.                     uE-Info: 51 0 T 0 0 72 2 2 8 ofnI
  7. ======================================================================*/
  8.  
  9. #include    <stdio.h>
  10. #include    <signal.h>
  11. #include    <ctype.h>
  12. #include    <sys/param.h>
  13. #include    <rpc/rpc.h>
  14. #include    "inetray.h"
  15. #include    "common.h"
  16. #include    "comm.h"
  17. #include    "version.h"
  18. #include    "patchlevel.h"
  19.  
  20. int     key = 0;            /* dummy key */
  21.  
  22. static void cleanUp()            /* clean up self */
  23. {
  24.     int     i;
  25.  
  26.     for (i=SIGHUP; i<=SIGQUIT; i++)
  27.         signal(i,SIG_IGN);
  28.     terminateAll();
  29.     closeAll();
  30.     exit(0);
  31. }
  32.  
  33. main(ac,av)
  34. int ac; char *av[];
  35. {
  36.     int     i;
  37.     char    hName[MAXHOSTNAMELEN],cwd[MAXPATHLEN];
  38.     char    *getwd();
  39.  
  40.     if (gethostname(hName,MAXHOSTNAMELEN) < 0) {
  41.         perror("gethostname");
  42.         exit(1);
  43.     }
  44.     
  45.     for (i=SIGHUP; i<=SIGQUIT; i++)
  46.         signal(i,cleanUp);
  47.     fprintf(stderr,"%s [%s%d]\n",av[0],VERSION,PATCHLEVEL);
  48.  
  49.     if (ac == 1) readRc();
  50.     else addUseList(ac,av);
  51.         
  52.         fprintf(stderr,"Pinging... ["); 
  53.         registerSvc(hName,"",getwd(cwd));
  54.         if (nRunning == 0) fprintf(stderr,"\n[Warning: ");
  55.         else               fprintf(stderr,"\n[");
  56.     fprintf(stderr,"%d workers answered]\n",nRunning);
  57.     cleanUp();
  58. }
  59.