Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Processing strings with % characters?

Jan
1
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.
 
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:


> 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.
>
>
>
>
>



--
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.
 
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:


> 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:
>
>
>
> ---Quote---
> > 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.
> >
> >
> >
> >
> >
> ---End Quote---
>
>
> --
> 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.
>
>
>
>
 
Back
Top
[FOX] Ultimate Translator
Translate