home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / vmsnet / networks / tcpip / multinet / 2595 < prev    next >
Encoding:
Text File  |  1992-12-29  |  2.7 KB  |  103 lines

  1. Path: sparky!uunet!usc!cs.utexas.edu!sdd.hp.com!network.ucsd.edu!mvb.saic.com!info-multinet
  2. From: GAVRON@IT.SUNQUEST.COM (Ehud Gavron 602-570-2546)
  3. Newsgroups: vmsnet.networks.tcp-ip.multinet
  4. Subject: Question about running a command procedure from the Multinet_Server
  5. Message-ID: <921229140333.85a9@IT.SUNQUEST.COM>
  6. Date: Tue, 29 Dec 1992 14:03:33 -0700 (MST)
  7. Organization: Info-Multinet<==>Vmsnet.Networks.Tcp-Ip.Multinet Gateway
  8. X-Gateway-Source-Info: Mailing List
  9. Lines: 92
  10.  
  11. Date sent:  29-DEC-1992 14:01:16 
  12.  
  13.  
  14. I wrote:
  15. >> Ideally one could
  16. >>    mult config/serv
  17. >>    add bogon
  18. >>    set program multinet:run_bogon_mumps.com
  19. >
  20.  
  21. Kevin Carosso added:
  22. >Yes, a facility for invoking servers with a CLI would be useful!
  23.  
  24. I just got around it by doing:
  25.  
  26. /*
  27.  * call sys$creprc with input set to command file multinet:mumps_server.com
  28.  *            output       nty device
  29.  *
  30.  * Then let the command file assign a channel to the nty device (before the
  31.  * timer down below runs out ... kludge... kludge...) and open a log file
  32.  * for output.
  33.  */
  34.  
  35.  
  36. #include <descrip.h>
  37. #include <lnmdef.h>
  38. #define cli_image     "SYS$SYSTEM:LOGINOUT.EXE"
  39. #define command_file    "MULTINET:MUMPS_SERVER.COM"
  40. #define log_file    "MULTINET:MUMPS_SERVER.LOG"
  41. #define lnm_table    "LNM$FILE_DEV"
  42. #define inet_dev    "SYS$INPUT"
  43.  
  44. cmain()
  45. {
  46.     int ss_stat;
  47.     int sys$creprc();
  48.     static int pid;
  49.     struct {
  50.        short buflen;
  51.        short itemcode;
  52.        char *bufaddr;
  53.        int *retlen;
  54.        } list[2];
  55.  
  56.     static $DESCRIPTOR(cli_desc,cli_image);
  57.     static $DESCRIPTOR(cmd_desc,command_file);
  58.     static $DESCRIPTOR(log_desc,log_file);
  59.     static $DESCRIPTOR(lnm_desc,lnm_table);
  60.     static $DESCRIPTOR(lnm_name,inet_dev);
  61.     struct dsc$descriptor_s indev;
  62.     char devbuf[100];
  63.     indev.dsc$a_pointer = (char *) &devbuf;
  64.     indev.dsc$w_length  = sizeof(devbuf);
  65.     indev.dsc$b_dtype   = DSC$K_DTYPE_T;
  66.     indev.dsc$b_class   = DSC$K_CLASS_S;
  67.  
  68.     list[0].buflen    = sizeof(devbuf);
  69.     list[0].itemcode= LNM$_STRING;
  70.     list[0].bufaddr = (char *) &devbuf;
  71.     list[0].retlen  = (int *) &indev.dsc$w_length;
  72.     list[1].buflen = list[1].itemcode = 0;
  73.  
  74.     ss_stat = sys$trnlnm(0,&lnm_desc,&lnm_name,0,&list);    
  75.     
  76.     if (!(ss_stat & 1)) sys$exit(ss_stat);
  77.  
  78.     ss_stat = sys$creprc(&pid,    /* pidadr */
  79.             &cli_desc,    /* image */
  80.             &cmd_desc,    /* input */
  81.             &indev,        /* output - the real nty device */
  82.             &indev,        /* error  - the real nty device */
  83.             0,        /* prvadr */
  84.             0,        /* quota */
  85.             0,        /* prcnam */
  86.             0,        /* baspri */
  87.             0,        /* uic */
  88.             0,        /* mbxunt */
  89.             0) ;        /* stsflg */
  90.  
  91.     lib$wait(&5.0);    /* <--- if we deassign too quickly, the new process
  92.                 won't have a device to attach to */
  93.     return(ss_stat);
  94. }
  95.  
  96.  
  97. Ehud
  98.  
  99. --
  100. Ehud Gavron        (EG76)     
  101. gavron@vesta.sunquest.com                    This was sent
  102. "The world bores you when you're cool."                from an Alpha
  103.