home *** CD-ROM | disk | FTP | other *** search
/ PC World 2000 November / PCWorld_2000-11_cd.bin / Komunik / sambar444 / _SETUP.1 / main.c < prev    next >
C/C++ Source or Header  |  2000-06-18  |  1KB  |  52 lines

  1. /*
  2. ** MAIN
  3. **
  4. **      This is the main driver for the DOS Shell driver of the Sambar
  5. **        Server.
  6. **
  7. **        Confidential Property of Tod Sambar
  8. **        (c) Copyright Tod Sambar 1995-1997
  9. **        All rights reserved.
  10. **
  11. **
  12. ** Syntax:
  13. **
  14. **      server
  15. **
  16. ** Returns:
  17. **      0               The program exited successfully.
  18. **      1               An error was detected.
  19. **
  20. **
  21. ** History:
  22. ** Chg#    Date    Description                                                Resp
  23. ** ----    -------    -------------------------------------------------------    ----
  24. **        12SEP95 Created                                                    sambar
  25. **        18JUN00 Added SIGTERM handler                                    sambar
  26. */
  27.  
  28. #include    <stdio.h>
  29. #include    <sambar.h>
  30. #include    <signal.h>
  31.  
  32. static void sig_term(int sig)
  33. {
  34.     fprintf(stderr, "SIGTERM caught, shutting down...\n");
  35.     (void)sa_shutdown(0);
  36. }
  37.  
  38. int    
  39. main(int argc, char *argv[])
  40. {
  41.     /* Handle SIGERM gracefully                                            */
  42.     signal(SIGINT, sig_term);
  43.     signal(SIGTERM, sig_term);
  44.  
  45.     /* Execute the Sambar Server Shell                                    */
  46.     if (sa_server((SA_VOID *)NULL) != SA_SUCCEED)
  47.         return (1);
  48.  
  49.     return(0);
  50. }
  51.  
  52.