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

  1. /*======================================================================
  2.                     I N E T R A Y . K I L L . C 
  3.                     doc: Thu Mar  5 12:24:52 1992
  4.                     dlm: Mon May 18 16:12:25 1992
  5.                     (c) 1992 ant@julia
  6.                     uE-Info: 29 0 T 0 0 72 2 2 8 ofnI
  7. ======================================================================*/
  8.  
  9. #include    <stdio.h>
  10. #include    <fcntl.h>
  11. #include    <rpc/rpc.h>
  12. #include    <sys/param.h>
  13. #include    "inetray.h"
  14. #include    "common.h"
  15. #include    "config.h"
  16. #include    "comm.h"
  17. #include    "version.h"
  18. #include    "patchlevel.h"
  19.  
  20. int    key;
  21.  
  22. main(ac,av)
  23. int ac; char *av[];
  24. {
  25.     int    fd;
  26.     char    buf[64];
  27.     
  28.     fprintf(stderr,"%s [%s%d]\n",av[0],VERSION,PATCHLEVEL);
  29.     readRc();                /* read .rc file */
  30.     if (ac > 1) {                /* get correct key */
  31.         key = atoi(av[1]);
  32.     } else {
  33.         fd = open(KEYFILE,O_RDONLY);
  34.         if (fd < 0) {
  35.             fprintf(stderr,"No key supplied!\n");
  36.             exit(1);
  37.         }
  38.         if (read(fd,buf,64) < 0) {
  39.             perror("read keyfile");
  40.             exit(1);
  41.         }
  42.         close(fd);
  43.         sscanf(buf,"%ld",&key);
  44.     }
  45.     fprintf(stderr,"Using Session Key <%ld>\n",key);
  46.     IRbroadcast(TERMINATE,xdr_int,&key);    /* done, exit, terminate, ... */
  47.     sleep(RTIMEOUT);
  48.     exit(0);
  49. }
  50.