home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / os / vms / 14862 < prev    next >
Encoding:
Text File  |  1992-09-10  |  2.9 KB  |  87 lines

  1. Path: sparky!uunet!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!ucbvax!mc.bitnet!shoecraf
  2. From: shoecraf@mc.bitnet (Steve Shoecraft)
  3. Newsgroups: comp.os.vms
  4. Subject: re: smg$ library
  5. Message-ID: <01GOLY9F8TQ890OHV6@MARICOPA.EDU>
  6. Date: 10 Sep 92 23:37:14 GMT
  7. Sender: daemon@ucbvax.BERKELEY.EDU
  8. Distribution: world
  9. Organization: The Internet
  10. Lines: 74
  11. X-Unparsable-Date: Thu, 10 Sep 1992 06:16:57.66 MST
  12.  
  13.  
  14.  
  15. > I try to call it from a COM file it acts like someone is contiuously
  16. > pressing the ENTER key.  Anyone have any idea what could be causing
  17.  
  18.     This can be eliminated by defining SYS$INPUT as SYS$COMMAND in your .COM
  19. procedure before running your program, i.e.:
  20.  
  21.         $ DEFINE/USER SYS$INPUT SYS$COMMAND
  22.  
  23.     If you would rather your program work the same way, regardless of what
  24. SYS$INPUT is set to, you could call $GETJPI to get the terminal name prior to
  25. your call to SMG$CREATE_PASTEBOARD. Here is some sample C code that will do
  26. this for you:
  27.  
  28.         #include <jpidef.h>
  29.  
  30.         static char *getjpi(unsigned long);
  31.  
  32.         char *termname(void)
  33.         {
  34.                 static char terminal[40];
  35.                 char *term;
  36.                 unsigned long status;
  37.  
  38.                 term = getjpi(JPI$_TERMINAL);
  39.                 if (status & 1) {
  40.                         term[term[0]] = 0;
  41.                         sprintf(&terminal,"%s:",term+1);
  42.                 }
  43.                 else {
  44.                         terminal[0] = 0;
  45.                         strcat(terminal,"SYS$OUTPUT:");
  46.                 }
  47.                 return(&terminal);
  48.         }
  49.  
  50.         static char *getjpi(unsigned long item_id)
  51.         {
  52.                 static char ret_info[256];
  53.                 char ret_len;
  54.                 struct item {
  55.                         short buflen;
  56.                         short code;
  57.                         char *buffer;
  58.                         long *retlen;
  59.                 };
  60.                 struct item_list_3 {
  61.                         struct item info;
  62.                         struct item nullitem;
  63.                 } list = {
  64.                         { 255,item_id,&ret_info+1,&ret_len },
  65.                         { 0, 0, 0, 0 }
  66.                 };
  67.                 unsigned long status, pid = 0;
  68.  
  69.                 ret_info[0] = 0;
  70.                 status = sys$getjpi(NULL,NULL,NULL,&list,NULL,NULL,NULL);
  71.                 if (!status & 1)
  72.                         printf("status: %x\n",status);
  73.                 ret_info[0] = ret_len;
  74.                 return(&ret_info);
  75.         }
  76.  
  77.     Also, keep in mind that once you have created the pasteboard, you can then
  78. get information on what type of terminal you are using by calling
  79. SMG$GET_PASTEBOARD_ATTRIBUTES. This returns the information in a 'pasteboard
  80. information block', and will have stuff like the physical device type, device
  81. class, etc... Using this information, you can determine whether or not your
  82. program should continue or not... Hope this helps...
  83.  
  84. Steve Shoecraft
  85. SHOECRAFT@MC.MARICOPA.EDU
  86.  
  87.