home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / os / vms / 20095 < prev    next >
Encoding:
Text File  |  1992-12-30  |  2.9 KB  |  119 lines

  1. Newsgroups: comp.os.vms
  2. Path: sparky!uunet!think.com!ames!usenet
  3. From: miller@tgv.com (Vagrant)
  4. Subject: Re: More than 1 line of command history buffer
  5. Message-ID: <1992Dec30.182502.7201@news.arc.nasa.gov>
  6. Sender: usenet@news.arc.nasa.gov
  7. Reply-To: miller@tgv.com
  8. Organization: TGV Incorporated in Santa Cruz, CA
  9. References:  <PRZEMEK.92Dec29235033@rrdstrad.nist.gov>
  10. Date: Wed, 30 Dec 1992 18:25:02 GMT
  11. Lines: 106
  12.  
  13.  
  14. In article <PRZEMEK.92Dec29235033@rrdstrad.nist.gov>, przemek@rrdstrad.nist.gov (Przemek Klosowski) writes:
  15.  
  16. #I like to have the command line editing provided courtesy of VMS
  17. #system read procedure, and the fact that I can retrieve the previously
  18. #used command line using the up-arrow key; however, I am spoiled by the
  19. #DCL 20-line command history (and the readline library I am using on
  20. #Unix that remembers commands across login sessions).  Is there a
  21. #simple way to increase the command history list size, so that more
  22. #than one last command is remembered?
  23.  
  24. I usually use SMG in order to get a bigger command history.  I don't
  25. believe you can expand the buffer that VAXCRTL uses.  Here's some
  26. example code in C below.  See the SMG manual for more info.
  27.  
  28. -bruce
  29.  
  30.  
  31.  
  32. #module TERM "V1.0"
  33. #pragma builtins
  34.  
  35. #include ssdef
  36. #include descrip
  37. #include rmsdef
  38. #include smgmsg
  39.  
  40.     u_word    TT_Channel;
  41.  
  42.     /* Special events concerning the terminal. */
  43.     u_word    TT_MBX_Chan;
  44.     u_byte    TT_MBX_Buffer[256];
  45.     u_long    TT_MBX_IOSB[2];
  46.  
  47.     static int    Pasteboard_Id;
  48.     static int    Display_Id;
  49.     static int    KeyBoard_Id;
  50.     static int    Key_Table_Id;
  51.     static int  preserve_screen = 1; /* Don't clear screen on startup. */
  52.  
  53.  
  54. /*
  55.  Description:
  56.     Initialize the terminal related stuff (yeah, that's right. stuff.)
  57. */
  58.  
  59. int IPNCP_SMG_Init()
  60. {
  61.     u_long RC;
  62.     $DESCRIPTOR(Input_Device,"SYS$COMMAND");
  63.  
  64.     RC = LIB$ASN_WTH_MBX (
  65.     &Input_Device,
  66.     &sizeof(TT_MBX_Buffer),
  67.     &sizeof(TT_MBX_Buffer),
  68.     &TT_Channel,
  69.     &TT_MBX_Chan);
  70.     if (ERROR(RC)) LIB$SIGNAL(RC);
  71.  
  72. #ifdef NOTDEF
  73.     RC = SMG$CREATE_PASTEBOARD (
  74.     &Pasteboard_Id,        /* We use this to get info about the display.*/
  75.     0,            /* Output device.  default is 'SYS$OUTPUT' */
  76.     0,            /* height of the screen. */
  77.     0,            /* width of the screen. */
  78.     &preserve_screen    /* Should we clear the screen? */
  79.     );
  80.     if (ERROR(RC)) LIB$SIGNAL(RC);
  81. #endif /* NOTDEF */
  82.  
  83.     RC = SMG$CREATE_VIRTUAL_KEYBOARD(&KeyBoard_Id);
  84.     if (ERROR(RC)) LIB$SIGNAL(RC);
  85.  
  86.     RC = SMG$CREATE_KEY_TABLE(&Key_Table_Id);
  87.     if (ERROR(RC)) LIB$SIGNAL(RC);
  88.  
  89.     return(SS$_NORMAL);
  90. }
  91.  
  92. /*
  93.  Functional Description:
  94.  
  95.     This routine is used to get input for cli$dcl_parse.
  96.     The format of the arguements must be the same as
  97.     LIB$GET_INPUT.
  98. */
  99.  
  100. int IPNCP_Get_Input (Get_Str, Prompt_Str, Out_Len)
  101.     struct dsc$descriptor_s *Get_Str, *Prompt_Str;
  102.         int *Out_Len;
  103. {
  104.     u_long RC;
  105.  
  106.     RC = SMG$READ_COMPOSED_LINE (
  107.         &KeyBoard_Id,
  108.         &Key_Table_Id,
  109.         Get_Str,
  110.         Prompt_Str,
  111.         Out_Len);
  112.     if (RC == SMG$_EOF) return(RMS$_EOF);
  113.  
  114.     if (ERROR(RC)) LIB$SIGNAL(RC);
  115.  
  116.     return(RC);
  117. }
  118.  
  119.