QB and parameters

 BBS: Inland Empire Archive
Date: 12-23-92 (02:28)             Number: 310
From: JOE NEGRON                   Refer#: NONE
  To: WES GARLAND                   Recvd: NO  
Subj: QB and parameters              Conf: (2) Quik_Bas
MR> An interesting point I've learned from this echo is that COMMAND$
  > always returns upper-case, so if you want to get "/s" as a parameter,
  > you have to use

MR> Some people have code for getting lower-case as well, if you need to be
  > case-sensitive.  They'd probably re-post if you whined
  > and begged <grin>.

WG> Whining and begging! I need to pass names to a door, and they look
  > really  funny if they're not capatilized correctly. I'm throwing
  > together a quick hack of MAJOR-BBS style conference rooms
  > for maximus. Should be done by the new year.

Whining and begging always gets to me. <g>

============================== Begin code ==============================
'$INCLUDE: 'qbx.bi'

DECLARE FUNCTION CmdLine$ ()

'***********************************************************************
'* FUNCTION CmdLine$
'*
'* PURPOSE
'*    Uses DOS ISR 21H, Function 51H (Get PSP Address) to return the
'*    command line unmodified.  COMMAND$ is capitalized by BASIC, hence
'*    this function.

'*
'* EXTERNAL ROUTINE(S)
'*    QBX.LIB
'*    -------
'*    SUB Interrupt (IntNum%, IRegs AS RegType, ORegs AS RegType)
'***********************************************************************
FUNCTION CmdLine$ STATIC
   DIM IRegs AS RegType, ORegs AS RegType

   IRegs.ax = &H5100
   Interrupt &H21, IRegs, ORegs
   PSP% = ORegs.bx                           'Segment returned in BX
   Offset% = &H80                            'Offset% of command line

   DEF SEG = PSP%                            'Access PSP segment
   CmdLen% = PEEK(Offset%)                   'Get command line length

   C$ = SPACE$(CmdLen%)                      'Read parameters....
   FOR I% = 1 TO CmdLen%
      MID$(C$, I%, 1) = CHR$(PEEK(Offset% + I%))
   NEXT I%

   DEF SEG                                   'Restore DGROUP

   CmdLine$ = C$                             'Return value
   C$ = ""
END FUNCTION
=============================== End code ===============================

                                --Joe in Bay Ridge, Brooklyn, NY--
                                      Wed  12-23-1992, 00:54

... SYSOP \'sis ap\ n: the person laughing as you type.
___
 X Blue Wave/QWK v2.12 X

--- Maximus 2.01wb
 * Origin: * BlueDog BBS * (212) 594-4425 * NYC FileBone Hub (1:278/709)
Outer Court
Echo Basic Postings

Books at Amazon:

Back to BASIC: The History, Corruption, and Future of the Language

Hackers: Heroes of the Computer Revolution (including Tiny BASIC)

Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution

The Advent of the Algorithm: The Idea that Rules the World

Moths in the Machine: The Power and Perils of Programming

Mastering Visual Basic .NET