Changeset 10 for trunk/txlib/txscript.c

Show
Ignore:
Timestamp:
02/22/06 13:03:35 (3 years ago)
Author:
jvw
Message:

Fix FileDialog? trap, other minor updates

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/txlib/txscript.c

    r5 r10  
    5050#define TXSC_P_PROMPT       ";;prompt" 
    5151#define TXSC_P_ERRORS       ";;error" 
     52 
     53#define TXSC_PARAMS         10                  // substitutable parameters 
    5254 
    5355static  char       *runhelp[] = 
     
    105107}; 
    106108#endif 
    107  
    108  
    109 // Substitute $n parameters in a string by supplied values; n = 0..9 
    110 static ULONG txsSubstituteParams                // RET   nr of substitutions 
    111 ( 
    112    char               *string,                  // IN    base string 
    113    char              **values,                  // IN    values to substitute 
    114    char               *result                   // OUT   substituted (MAXLIN) 
    115 ); 
    116109 
    117110 
     
    184177               TxRepl( scrline, '\n', '\0'); 
    185178               TxRepl( scrline, '\r', '\0');    // mainly for Linux/Unix ... 
    186                txsSubstituteParams( scrline, params, command); 
     179               txsSubstituteParams( scrline, params,  TXSC_PARAMS, 
     180                                             TXMAXLN, command); 
    187181 
    188182               if ( (strlen( command) > 0) &&   // not empty, and 
     
    413407/*---------------------------------------------------------------------------*/ 
    414408 
    415 /*****************************************************************************/ 
    416 // Substitute $n parameters in a string by supplied values; n = 0..9 
    417 /*****************************************************************************/ 
    418 static ULONG txsSubstituteParams                // RET   nr of substitutions 
     409 
     410/*****************************************************************************/ 
     411// Substitute $n parameters in a string by supplied values; n = 0..9 (maximum) 
     412/*****************************************************************************/ 
     413ULONG txsSubstituteParams                       // RET   nr of substitutions 
    419414( 
    420415   char               *string,                  // IN    base string 
    421416   char              **values,                  // IN    values to substitute 
     417   int                 count,                   // IN    number of values 
     418   int                 size,                    // IN    size of output buffer 
    422419   char               *result                   // OUT   substituted (MAXLIN) 
    423420) 
     
    438435         bs++;                                  // skip  $ 
    439436         si  = (int) ((*bs) - '0');             // index 0..9 
    440          if (values[si] != NULL)                // value available ? 
     437         if ((si < count) && 
     438             (values[si] != NULL))              // value available ? 
    441439         { 
    442440            rl += strlen( values[si]); 
    443             if (rl < TXMAXLN)                   // room to grow ? 
     441            if (rl < size)                      // room to grow ? 
    444442            { 
    445443               strcpy(  rs,  values[si]);       // copy value