home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c004 / 3.ddi / VAX / CTSTOP.C < prev   
Encoding:
C/C++ Source or Header  |  1989-04-18  |  1.7 KB  |  84 lines

  1. /*
  2.  *    c-tree Stop Server
  3.  *
  4.  *    This program is the CONFIDENTIAL and PROPRIETARY property 
  5.  *    of FairCom(R) Corporation. Any unauthorized use, reproduction or
  6.  *    transfer of this program is strictly prohibited.
  7.  *
  8.  *      Copyright (c) 1987, 1988, 1989 FairCom Corporation
  9.  *    (Subject to limited distribution and
  10.  *     restricted disclosure only.)
  11.  *    *** ALL RIGHTS RESERVED ***
  12.  *
  13.  *    4006 West Broadway
  14.  *    Columbia, MO 65203
  15.  *
  16.  *
  17.  *    c-tree(R)    Version 4.3
  18.  *            Release C
  19.  *            February 7, 1989 17:30
  20.  *
  21.  */
  22.  
  23. #include "ctstdr.h"
  24. #include "ctoptn.h"
  25. #include "cterrc.h"
  26. #include "ctcomm.h"
  27.  
  28. #define MAXASIZ    512
  29.  
  30. LOCAL MESSAGE    msg;
  31. LOCAL UCOUNT    cts_mxaln;
  32. LOCAL TEXT     *apxmsg,*apxdat;
  33. COUNT        cts_usrid,uerr_cod,cts_apxsiz,*altseq;
  34. TEXT        ct_buf[CTBUFSIZ];
  35.  
  36. main()
  37. {
  38.     COUNT ctrqst(),ctrspn();
  39.     TEXT *getmids();
  40.     LONG  status,dly;
  41.  
  42.     msg.mfunc = TST_STPSRV;
  43.     msg.musrn = -1;
  44.  
  45.     if ((apxmsg = getmids(cts_apxsiz = MAXASIZ,&msg)) == NULL)
  46.         goto err_term;
  47.  
  48.     apxdat = apxmsg + sizeof(MESSAGE);
  49.  
  50.     status = sys$setrwm(1);    /* disable resource wait */
  51.  
  52.     if (ctrqst(apxmsg,&msg))
  53.         goto err_term;
  54.     
  55.     for (dly=0; dly < 1000;)
  56.         dly++;
  57.  
  58.     if (ctrspn(&apxmsg,&msg))
  59.         goto err_term;
  60.  
  61.     status = sys$setrwm(0);    /* enable resource wait */
  62.  
  63.     switch (msg.merrn) {
  64. case NO_ERROR:
  65.         printf("\n\nc-tree Server Terminated\n\n");
  66.         ridmids();
  67.         exit(0);
  68. case STRN_ERR:
  69.         printf(
  70. "\n\nc-tree Server has transactions pending. %ld stop(s) attempted.\n",
  71.             msg.mpntr);
  72.         printf(
  73. "%d attempts are required to force a shut down.",msg.mseqn);
  74.         exit(0);
  75.     }
  76.  
  77. err_term:
  78.     printf("\nCould not shut down c-tree Server. Error(%d,%d).\n",
  79.         uerr_cod,msg.merrn);
  80.     exit(2);
  81. }
  82.  
  83. /* end of ctstop.c */
  84.