Processing strings with % characters?

Jan 30, 2009
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.
 
May 20, 2008
603
0
Sammamish, WA
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.
 

samintz

Scott Mintz
May 20, 2008
1,488
15
Solon, OH, USA
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.
>
>
>
>
 
Similar threads
Thread starter Title Forum Replies Date
K robocopy cancelling batch file processing Support 28
fpefpe How to? processing filenames Support 6
R Processing CSV file, hit = char and stops Support 9
S How to? Use wild cards in include list without duplicate processing Support 49
S PDIR has trouble processing filenames with embedded percent sign Support 3
Phileosophos Enabling PathExt disables tcstart.btm processing Support 9
P Concatenating strings in a BTM Support 3
Steve Pitts WAD @MD5 returns incorrect results for strings Support 2
fpefpe How to? Comparing strings with blanks Support 5
MickeyF how to compare version strings Support 11
A Inconsistent treatment of strings with backtiks Support 1
S FFIND and quoted strings Support 4
M Concatenating blanks to strings???? Support 2
M Is there a way to urlencode strings in v10? Support 0
R WAD Unusable state when using Chinese characters Support 3
C TEE command appending null characters to output Support 6
D Regexes and escape characters Support 5
vefatica Quoting file names with special characters? Support 7
vefatica How to? Add real <ESC> characters with TPIPE Support 2
C Erase all characters left or right from cursor location Support 2
J Escaped Characters and Variables Support 2
Joe Caverly Unicode, Codepage 437, and line characters Support 3
gschizas Fixed Using codepage 65001 (UTF-8) breaks non-ASCII characters Support 8
vefatica Display of special characters in aliases. Support 25
J Python: TCC command line parsing removes '=' equal sign characters Support 4
C filemasks over 172 characters fail Support 5
redwdc TCC.exe opens to 11 characters x 3 rows Support 1
G Selection characters with mouse double-click Support 3
R Function #IDOW returns only 2 characters Support 10
krischik WAD Tee printing Chinese characters Support 7
Alexander How to? how can I use Cyrillic characters in the Echo command? Support 8
jadaml Echo unicode characters from UTF-8 Batch files? Support 1
V Fixed CD ~ has trash characters in it Support 5
S International characters - TYPE vs %@LINE function Support 5
Jay Sage Getting Quote Characters into a Toolbar Tab Support 12
vefatica Fixed Escaping special characters Support 1
M Problem with Extended Search and non-ASCII characters in directories names Support 3
A How to? PhraseExpress autotext/autocompletion printing unexpected characters Support 4
thedave WAD Unable to type various characters using Windows 8's onscreen keyboard Support 7
JohnQSmith WAD DO and escaped redirect characters Support 6
W TCMD 16: double characters Support 11
MickeyF how to work with env var with special characters in the name Support 5
vefatica Fixed TPIPE doesn't /SPLIT at characters Support 0
A Escape characters on right side of pipe Support 0
J How to? 'tab' characters in the console and clipboard 'copy' Support 1
M How to? Determine a whether vars beginning with certain characters exist... Support 5
M Another simple question re. Take Command/TCC window witdth in characters... Support 16
U Keystack mangles 'special' characters Support 6
J dir failure with some unicode characters Support 6
vefatica Random access to the characters in a string? Support 4

Similar threads