home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1993 #2 / Image.iso / clipper / snip0693.zip / GETCMD.PRG < prev    next >
Text File  |  1993-03-13  |  1KB  |  33 lines

  1.  FUNCTION getcmdln()
  2.  /*
  3.  * Returns a string containing the "tail" of the command line
  4.  * used to start the program.  Requires the Nanforum library.
  5.  *
  6.  * Written by Ronald Bass.  Dedicated to the Public Domain.
  7.  */
  8.  # include "ftint86.ch"
  9.  // Make sure you use the pre-NFPAT5 version of the header file or edit
  10.  // to insert the omitted escape "\"s in the highbyte() and lowbyte()
  11.  // pseudo-functions.  We don't use those functions here, but the bug
  12.  // intoduced in NFPAT5 will still cause the compile to fail.
  13.  
  14.  LOCAL CMDLN, OFFSET, aREGS[10], nchar, i
  15.  
  16.  aREGS[AX] = makehi(98)   // Setting up Int 21h, Function 62h
  17.  FT_INT86(33,aREGS)       // Returns the segment of the PSP in aREGS[BX]
  18.  
  19.  CMDLN :=""
  20.  OFFSET := 128      // Byte at offset 80h contains # of characters in
  21.                     // command tail.  Command tail starts at offset 81h.
  22.                     // Command tail is *not* null terminated.
  23.  
  24.  nchar := FT_PEEK( aREGS[BX], offset++) // number of characters in
  25.                                         // command tail string
  26.  for i = 1 to nchar
  27.    CMDLN += CHR( FT_PEEK( aREGS[BX], offset++) )  // gets the characters
  28.                                                   // one by one
  29.  next
  30.  RETURN ( CMDLN )
  31.  
  32.  CUT HERE> --------------------------------------------
  33.