Changeset 34 for trunk/gui


Ignore:
Timestamp:
May 1, 2013, 3:01:18 AM (12 years ago)
Author:
Alex Taylor
Message:

Improved CUPSWIZ command-line parameter parsing logic.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gui/printer/cupswiz/cupswiz.VRX

    r32 r34  
    1717            argOff = 1
    1818        end
     19        InitArgs.0 = argCount
     20        if( argCount > 0 )then do i = 1 to argCount
     21            InitArgs.i = arg( i + argOff )
     22        end
    1923    end; else do
    2024        call VROptions 'ImplicitNames'
    2125        call VROptions 'NoEchoQuit'
    22     end
    23     InitArgs.0 = argCount
    24     if( argCount > 0 )then do i = 1 to argCount
    25         InitArgs.i = arg( i + argOff )
     26        argCount = _ParseParams( arg(1) )
    2627    end
    2728    drop calledAs argCount argOff
     
    101102*/
    102103return
     104/*:VRX         _ParseParams
     105*/
     106_ParseParams: PROCEDURE EXPOSE InitArgs.
     107  /* Parse program parameters when they are provided as a single string,
     108   * including handling quotes.
     109   */
     110
     111  parse arg thisArgs
     112
     113  InitArgs. = ''
     114  InitArgs.0 = 0
     115
     116  do while thisargs <> ''
     117
     118    parse value strip( thisArgs, "B" ) with curArg thisArgs
     119
     120    parse var curArg tc1 +1 .
     121    if tc1 = '"' | tc1 = "'" then
     122      parse value curArg thisArgs with (tc1) curArg (tc1) ThisArgs
     123
     124   i = InitArgs.0 + 1
     125   InitArgs.i = strip( curArg )
     126   InitArgs.0 = i
     127
     128  end /* do while thisArgs <> '' */
     129
     130RETURN InitArgs.0
     131
    103132/*:VRX         CheckPrograms
    104133*/
     
    10981127            globals.!cupsdir = InitArgs.1
    10991128        ELSE IF InitArgs.i == '/R' THEN DO
    1100                 globals.!cupsdir = ''
    1101                 _force_remote = 1
     1129say 'remote'
     1130            globals.!cupsdir = ''
     1131            _force_remote = 1
    11021132        END
    11031133        ELSE IF VRFileExists( InitArgs.i ) THEN DO
Note: See TracChangeset for help on using the changeset viewer.