1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Processing strings with % characters?

Discussion in 'Support' started by Kalli Stoi, Jan 30, 2009.

  1. Kalli Stoi

    Joined:
    Jan 30, 2009
    Messages:
    1
    Likes Received:
    0
    Hi all,

    TCC/LE 9

    I am trying to write a small btm file to extract user passwords from individual files in order to construct a single file containing all user names and passwords.

    I have the following code:

    set fd_pwdfile=%@fileopen[%sz_user\%sz_pwdfile,r,t]
    do forever
    set sz_pwdline=%@fileread[%fd_pwdfile]
    if "%sz_pwdline" eq "**EOF**" .or. "%sz_pwdline" eq "" leave
    set sz_pwdfield=%@word[":",0,%sz_pwdline]
    iff "%sz_pwdfield" eq "POP3_access" then
    set sz_pwdfield=%@word[":",1,%sz_pwdline]
    set sz_pwd=%@strip[" ",%sz_pwdfield]
    leave
    endiff
    enddo

    The problem is that the passwords can have any character, including %, >, <, etc. I have solved processing of all special characters using setdos /X-5678, but I don't know how to by-pass processing of % symbol.
    I have tried SETDOS /X-3, but this deactivated the variables.

    Is there a way to process text strings containing the % symbol?

    Thank you in advance.
     
  2. Jim Cook

    Joined:
    May 20, 2008
    Messages:
    604
    Likes Received:
    0
    I can get @PERL[] to print it on the screen with this one line, which sets
    sz_found to 0 or 1:
    set sz_found=%@perl[open(IN,qq($ENV{sz_user}\\$ENV{sz_pwdfile})) or return
    0; while(<IN>) { @f=split(/:/); if ($f[0]=~/POP3_access/i){print $f[1];
    return 1;} } return 0 ]

    I keep having trouble getting the "print" from @PERL to go into a variable
    unadulterated.

    I'll look into tccle V10's binary functions

    On Fri, Jan 30, 2009 at 5:48 AM, Kalli Stoi <> wrote:




    --
    Jim Cook
    2009 Saturdays: 4/4, 6/6, 8/8, 10/10, 12/12 and 5/9, 9/5, 7/11, 11/7.
    Next year they're Sunday.
     
  3. samintz

    samintz Scott Mintz

    Joined:
    May 20, 2008
    Messages:
    1,201
    Likes Received:
    11
    I typically use setdos /X-4 to disable nested variable expansion. If
    nested variable expansion is disabled (X-4), each variable is expanded
    once, but variables containing the names of other variables are not
    expanded further.

    -Scott

    Jim Cook <> wrote on 01/30/2009 10:59:45 AM:


    sets

    return

    variable

    user

    sz_pwdline=%@fileread[%fd_pwdfile]

    ",%sz_pwdfield]

    setdos

     

Share This Page