Continued lines (^) in a library routine?

May 20, 2008
11,400
99
Syracuse, NY, USA
Here's the first few lines of a library routine's source.

Code:
sv {
setlocal

set expression="LSM|TermService|EventLog|ProfSvc|Themes|EventSystem|Schedule|lmhosts|CryptSvc|SENS|PlugPlay^
            |SessionEnv|nsi|Winmgmt|TapiSrv|NlaSvc|LanmanServer|TapiSrv|Dhcp|DnsCache|SstpSvc|RpcEpt|FontCache|BFE^
            |UmRdp|RasMan|TrkWks|netprofm|ShellHWD|Dnscache|UserManager|LanmanWorkstation|Audio"

function tformat `%@instr[4,2,%1]/%@instr[6,2,%1] %@instr[8,2,%1]:%@instr[10,2,%1]:%@instr[12,2,%1]`

And here's how it winds up in memory.

Code:
sv {
setlocal
|UmRdp|RasMan|TrkWks|netprofm|ShellHWD|Dnscache|UserManager|LanmanWorkstation|Audio"
function tformat `%@instr[4,2,%1]/%@instr[6,2,%1] %@instr[8,2,%1]:%@instr[10,2,%1]:%@instr[12,2,%1]`
 
May 20, 2008
11,400
99
Syracuse, NY, USA
Is this a feature request, or a bug report that LIBRARY /R doesn't do something that it doesn't say it does?
Well, the help doesn't give any instructions for writing library functions. Until today, it seemed you could do anything in a library function that you can do in a batch file. If it needs to be requested, yes, it's a feature request. If there are other familiar constructs that don't work in library functions, they should mentioned in the help.
 
May 20, 2008
11,400
99
Syracuse, NY, USA
The number of things that you can't do is infinite. The things that you can do are documented in the help.
All I could find is

Library functions can call aliases, internal or external commands, batch files, or other library functions.

That's pretty sketchy, especially if library functions are significantly different from batch files. I just copy .BTMs to .LIBs and throw in the required "name {" and "}" ... no problem until the line continuation thingy cropped up.

Are we suppose to find out the hard way that things we're accustomed to doing in batch files can't be done in a library function? If there are so many, please describe several of them.
 
  • Like
Reactions: Fross
I've been using library functions extensively and, for what it's worth, I have not come across anything that hasn't worked like a batch file. However, I don't normally use line continuation. Hopefully that's one of a very small number of differences.

Michael
 
Similar threads
Thread starter Title Forum Replies Date
R Lines between COMMENT & ENDCOMMENT not ignored Support 7
A TCMD - Dir Command puts out blank lines? Support 16
T FFind - can we display n number of lines after the find? Support 2
T WAD Difference between TCC and CMD in handling multi-command lines Support 6
JohnQSmith Weird DIR output (missing lines) Support 1
fpefpe Documentation Comment lines? Support 2
nickles Fixed Executing long command lines in a batch generates file name errors Support 16
B %@lines doesn't count last line without cr/lf at eof Support 1
nikbackm How to? Find duplicate lines in text file Support 0
S Documentation HELP nit: @LINES Support 5
B Select and run lines from Command Input panel? Support 1
D WAD New envars for @LINES are not hidden Support 8
T Documentation @LINE[CON,n] @LINES[CON] not documented (bug?) Support 4
M How to? Parsing lines containing double quotes... Support 3
Stefano Piccardi echoerr truncates long lines Support 9
M Just an out-of-curiosity question the List command vs. the @Lines function... Support 13
samintz How to? Pull out multiple matching lines Support 5
W Copy+Paste without breaking long lines as default? Support 1
L "for" in multiple lines Support 2
vefatica @LINES, long lines, TCC disappears Support 7
D Blank lines in jpstree.idx Support 3
T @Word from Lines with Pipes Support 3
vefatica @LINES[]? Support 1
J Extra blank lines during paste Support 6
vefatica How many lines are in this file? Support 17
nikbackm Trim last N lines from a file Support 6
T How do you echo lines with special characters to file? Support 4
B @lines: first line in the file is numbered 1 Support 0
R Reading an Unicode file with more than 8191 lines Support 1
Joe Caverly LIBRARY /F in v28 Support 0
Joe Caverly LIBRARY and Pipes Support 2
Joe Caverly How to? Get name of current LIBRARY function? Support 4
Joe Caverly Documentation Replace internal command with LIBRARY command Support 0
Joe Caverly No blank line in TEXT...ENDTEXT in a LIBRARY function Support 8
cgunhouse Ctrl-C from within a library function Support 6
vefatica LIBRARY and file name completion? Support 4
vefatica '}' in a library function? Support 3
vefatica Library functions and line continuations? Support 4
Joe Caverly @NAME supports library functions Support 2
Joe Caverly Update ENDLOCAL to include LIBRARY Support 0
Joe Caverly Debugging a LIBRARY function Support 10
J Documentation Make tcc great again - what's the benefit of LIBRARY? Support 6

Similar threads