Permalink
Browse files

enabled URL support in TARLIST

  • Loading branch information...
trothr committed Jan 19, 2017
1 parent 932e768 commit 2a88402d53e6fdfdd5409f2360747de565d79f4e
Showing with 107 additions and 67 deletions.
  1. +1 −0 cmstar.filelist
  2. +21 −19 proftlst.xedit
  3. +33 −26 tar.rexx
  4. +13 −2 tarlist.exec
  5. +39 −20 tarreadc.rexx
View
@@ -17,6 +17,7 @@
* TARTAPER REXX * --
* TARTAPEW REXX * --
TARTAKE REXX * --
CURL REXX * -- web retrieval helper stage
*
* RXVMGROUP MODULE * -- a vmgroup() function for REXX
RXVMGROUP ASSEMBLE * -- source to the vmgroup() function
View
@@ -4,26 +4,27 @@
* Copyright 1992, Richard M. Troth
*/
Parse Arg fn ft fm . '(' . ')' tfn tft tfm . '(' . ')' .
Parse Arg fn ft fm . '(' . ')' tfn tft tfm . '(' opts ')' .
Select
When tft ^= "" Then Do
lcmd = '<' tfn tft tfm '| tar tf - (TARLIST'
xcmd = '<' tfn tft tfm '| tar xf -'
End /* When .. Do */
When Datatype(tfn,'N') Then Do
lcmd = 'tar ts' tfn '(TARLIST'
xcmd = 'tar xs' tfn
End /* When .. Do */
When Left(tfn,3) = "TAP" & Datatype(Right(tfn,1),'N') ,
Length(tfn) = 4 Then Do
lcmd = 'tar t' || Right(tfn,1) '(TARLIST'
xcmd = 'tar x' || Right(tfn,1)
End /* When .. Do */
Otherwise Do
lcmd = 'tar tf' tfn '(TARLIST'
xcmd = 'tar xf' tfn
End /* Otherwise Do */
End /* Select */
When tft ^= "" Then Do
lcmd = '<' tfn tft tfm '| tar tf - (TARLIST' opts
xcmd = '<' tfn tft tfm '| tar xf -'
End /* When .. Do */
When Datatype(tfn,'N') Then Do
lcmd = 'tar ts' tfn '(TARLIST' opts
xcmd = 'tar xs' tfn
End /* When .. Do */
When Left(tfn,3) = "TAP" & Datatype(Right(tfn,1),'N') ,
& Length(tfn) = 4 Then Do
lcmd = 'tar t' || Right(tfn,1) '(TARLIST' opts
xcmd = 'tar x' || Right(tfn,1)
End /* When .. Do */
Otherwise Do
lcmd = 'tar tf' tfn '(TARLIST' opts
xcmd = 'tar xf' tfn
End /* Otherwise Do */
End /* Select */
'COMMAND CMS GLOBALV SELECT TARLIST PUT XCMD'
@@ -72,3 +73,4 @@ Select
Exit
View
@@ -19,7 +19,7 @@ tar.uid = 1
tar.gid = 1
Parse Arg cmd args '(' opts ')' .
Upper cmd opts
Upper cmd
Parse Source . . . . . arg0 .
argo = arg0 || ':'
@@ -37,7 +37,6 @@ peek = 0
once = 0
replace = 0
Do While cmd ^= ""
Parse Var cmd 1 c 2 cmd
Select /* c */
@@ -113,31 +112,39 @@ Do While cmd ^= ""
If tf = "" Then tf = "TAP1"
If td = "" Then td = "T"
Do While opts ^= ""
Parse Var opts op opts
Select /* op */
When Abbrev("TARLIST",op,4) Then tarlist = 1
When Abbrev("NOTARLIST",op,3) Then tarlist = 0
When Abbrev("INCLUDE",op,3) Then Parse Var opts include opts
When Abbrev("SKIP",op,1) Then Parse Var opts skip opts
When Abbrev("PEEK",op,2) Then Do; peek = 1; once = 1; End
When Abbrev("ONCE",op,1) Then once = 1
When Abbrev("VERBOSE",op,1) Then verbose = 1
When Abbrev("TERSE",op,5) Then verbose = 0
When Abbrev("MODTIME",op,1) Then modtime = 1
When Abbrev("NOMODTIME",op,3) Then modtime = 0
When Abbrev("PROMPT",op,2) Then prompt = 1
When Abbrev("NOPROMPT",op,3) Then prompt = 0
When Abbrev("REPLACE",op,3) Then replace = 1
When Abbrev("NOREPLACE",op,3) Then replace = 0
Otherwise Do
Address "COMMAND" 'XMITMSG 3 OP (ERRMSG'
/* Say argo "unrecognized option" op */
Exit 24
End /* Otherwise Do */
End /* Select op */
End /* Do While */
If Left(tf,1) = "*" Then Do
Address "COMMAND" 'GLOBALV SELECT TARLIST GET TARFILE'
If rc = 0 & tarfile ^= "" Then tf = tarfile
End
/* if tarfile is a URL then handle it like a spool file */
If POS("://",tf) > 0 Then td = 'S'
Do While opts ^= ""
Parse Var opts op opts
Upper op
Select /* op */
When Abbrev("TARLIST",op,4) Then tarlist = 1
When Abbrev("NOTARLIST",op,3) Then tarlist = 0
When Abbrev("INCLUDE",op,3) Then Parse Var opts include opts
When Abbrev("SKIP",op,1) Then Parse Var opts skip opts
When Abbrev("PEEK",op,2) Then Do; peek = 1; once = 1; End
When Abbrev("ONCE",op,1) Then once = 1
When Abbrev("VERBOSE",op,1) Then verbose = 1
When Abbrev("TERSE",op,5) Then verbose = 0
When Abbrev("MODTIME",op,1) Then modtime = 1
When Abbrev("NOMODTIME",op,3) Then modtime = 0
When Abbrev("PROMPT",op,2) Then prompt = 1
When Abbrev("NOPROMPT",op,3) Then prompt = 0
When Abbrev("REPLACE",op,3) Then replace = 1
When Abbrev("NOREPLACE",op,3) Then replace = 0
Otherwise Do
Address "COMMAND" 'XMITMSG 3 OP (ERRMSG'
/* Say argo "unrecognized option" op */
Exit 24
End /* Otherwise Do */
End /* Select op */
End /* Do While */
Select /* tc */
View
@@ -1,12 +1,23 @@
/*
* Name: TARLIST EXEC
* rather like FILELIST, but for TAR archives
* something like FILELIST or RDRLIST but for TAR archives
* Copyright 1992, Richard M. Troth
*/
Parse Arg fn ft fm args '(' opts ')' rest
If fn = "" Then fn = "TAP1"
'XEDIT' fn 'TARLIST A0 (WIDTH 240 PROFILE PROFTLST)' ,
/* if tarfile is a URL then pass it as an option */
If POS("://",fn) > 0 Then Do
tarfile = fn
Address "COMMAND" 'GLOBALV SELECT TARLIST PUT TARFILE'
fn = "*TARFILE"
End
/* now drive XEDIT with the TARLIST macro */
'XEDIT' Userid() 'TARLIST A0 (WIDTH 240 PROFILE PROFTLST)' ,
fn ft fm args '(' opts ')' rest
Exit rc
View
@@ -4,32 +4,51 @@
* Copyright 1992, Richard M. Troth
*/
rdr = "00C"
/* get the name of the file if any */
Parse Arg tf . '(' . ')' .
'CALLPIPE CP QUERY VIRTUAL' rdr '| VAR READER'
Parse Var reader . . . . . hold . '15'x .
'CALLPIPE CP SPOOL' rdr 'HOLD'
'CALLPIPE CP CLOSE' rdr
/* if tarfile is a URL then punt to 'curl' */
If POS("://",tf) > 0 Then Do
'CALLPIPE curl --binary' tf '| *:'
Exit rc
End
/* define a disposable virtual reader */
rdr = "DC0"
Address "COMMAND" 'GETFMADR 200'
If rc = 0 Then Parse Pull . . rdr .
Parse Value DiagRC(08,'DEFINE READER' rdr) With 1 rc 10 . 17 rs '15'x .
If rc ^= 0 Then Do
If rs ^= "" Then Say rs
Exit rc
End
/* put a hold on this reader so that the file is not consumed */
Call Diag 08, 'SPOOL' rdr 'HOLD'
Call Diag 08, 'CLOSE' rdr
If tf ^= "-" Then Do
'CALLPIPE CP ORDER READER' tf '| VAR RS'
If rc ^= 0 Then Do
orc = rc
'OUTPUT' rs
'CALLPIPE CP SPOOL' rdr hold
Exit orc
End /* If .. Do */
End /* If .. Do */
'CALLPIPE CP ORDER READER' tf '| VAR RS'
If rc ^= 0 Then Do
orc = rc
'OUTPUT' rs
Call Diag 08, 'CLOSE' rdr
Call Diag 08, 'DETACH' rdr
Exit orc
End /* If .. Do */
End /* If .. Do */
/* read the spool file and deliver to output */
'CALLPIPE READER' rdr ,
'| NLOCATE 1-1 /' || '03'x || '/' ,
'| SPEC 2-* 1 | PAD 80 40 | *:'
'| NLOCATE 1-1 /' || '03'x || '/' ,
'| SPEC 2-* 1' ,
'| PAD 80 40 ' ,
'| *:'
'CALLPIPE CP CLOSE' rdr
'CALLPIPE CP SPOOL' rdr hold
/* close and detach the temporary reader */
Call Diag 08, 'CLOSE' rdr
Call Diag 08, 'DETACH' rdr
Exit
Exit rc

0 comments on commit 2a88402

Please sign in to comment.