home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 18 REXX
/
18-REXX.zip
/
newfil11.zip
/
NEWPICKS.CMD
< prev
next >
Wrap
OS/2 REXX Batch file
|
1993-10-24
|
6KB
|
198 lines
/* newpicks.cmd - displays files and their descriptions from ALLFILES.NEW
that have been picked. You may "pick" files by inserting a "`" character
next to the files you desire.
Steve Allen
Altech Computer Services
121 Herta St.
Easley, SC 29640
Oct 93
trace ?i
*/
say ""
say "Newpicks v1.1 1993"
say "Altech Computer Services" 'fe'x "Steve Allen"
say ""
arg ifile newfile /* the "newfile" is optional--has default value */
call rxfuncadd sysloadfuncs, rexxutil, sysloadfuncs
call sysloadfuncs
if ifile = "" then
ifile = "ALLFILES.NEW" /* the name of the OS/2 shareware file */
iline = ""
oline = ""
linecnt = 0
newpicks_found = 0
char2find = "`"
if stream(ifile,'c',query exists) = "" then
do
call beep_error
say ifile "not found. Terminating program."
exit(5)
end
parse var ifile ibase "." iext
if newfile = "" then
ofile = ibase".PIK" /* the default output name */
else
ofile = newfile /* the user's desired output name */
if stream(ofile,'c',query exists) \= "" then
do
rc = SysFileDelete(ofile)
if rc \= 0 then
do
call beep_error
say "Could not delete" ofile". Terminating program."
exit(4)
end
end
backspace = '08'x
odometer_msg = "Processing line number "
call charout , odometer_msg
main:
/*----------------------------------------------------------------------------*/
/* Read in all the lines in ALLFILES.NEW, printing the new files as you come */
/* across them. */
/*--+----1----+----2----+----3----+----4----+----5----+----6----+----7----+---*/
call read_line
do while lines(ifile) > 0
call get_newpicks
end
call eoj
exit
get_newpicks:
/*----------------------------------------------------------------------------*/
/* If you come across a heading for a particular file section, save it. You */
/* may use it later if you have any new files in that particular section. If */
/* you find a file (denoted by having a period within the first 12 characters)*/
/* see if it's a new file. If so, print it. Otherwise, just read the next */
/* line. */
/*--+----1----+----2----+----3----+----4----+----5----+----6----+----7----+---*/
if substr(iline,1,1) = 'cd'x then
do
printed_headings = 'N'
do headnbr = 1 to 8
headarray.headnbr = iline
call read_line
end
end
if pos(".", substr(iline,1,12)) > 0 then
do
if newfile() then
call print_files_lines
else
call read_line
end
else
call read_line
return
newfile:
/*----------------------------------------------------------------------------*/
/* if the files date is newer than the comparison date, indicate that you've */
/* found a new file. */
/*--+----1----+----2----+----3----+----4----+----5----+----6----+----7----+---*/
retval = 0
if substr(iline,1,1) = char2find then
do
retval = 1
newpicks_found = newpicks_found + 1
iline = substr(iline,2)
end
return retval
print_files_lines:
/*----------------------------------------------------------------------------*/
/* If you haven't printed the heading yet for this particular section in */
/* which you've found the new file, then print it. Then print all the */
/* description lines for this new file. */
/*--+----1----+----2----+----3----+----4----+----5----+----6----+----7----+---*/
if printed_headings = 'N' then
do
printed_headings = 'Y'
do headnbr = 1 to 8
call lineout ofile, headarray.headnbr
end
end
oline = iline
call lineout ofile, oline
call read_line
do while substr(iline,1,1) = ' ' & lines(ifile) > 0
oline = iline
call lineout ofile, oline
call read_line
end
return
read_line:
/*----------------------------------------------------------------------------*/
/* read in a line, letting the user get an idea of how many lines have been */
/* processed so far. */
/*--+----1----+----2----+----3----+----4----+----5----+----6----+----7----+---*/
iline = linein(ifile)
linecnt = linecnt + 1
if linecnt // 37 = 0 then
do
j = length(linecnt)
call charout ,linecnt
do k = 1 to j
call charout, backspace
end
end
return
beep_error:
/*----------------------------------------------------------------------------*/
/* The big raspberry. */
/*--+----1----+----2----+----3----+----4----+----5----+----6----+----7----+---*/
duration = 100
call beep 262, duration
call beep 330, duration
call beep 262, duration
return
eoj:
/*----------------------------------------------------------------------------*/
/* That's all folks! */
/*--+----1----+----2----+----3----+----4----+----5----+----6----+----7----+---*/
j = length(odometer_msg)
do k = 1 to j
call charout, backspace
end
call lineout ofile
say copies(" ",60)
say "Output is" ofile"."
say linecnt "lines processed."
say newpicks_found "new files found."
say " "
exit
return
/* end of newpicks.cmd */