home *** CD-ROM | disk | FTP | other *** search
- 'File: PAGER
- 'Date: 2/1/92
- 'Written By: Luis Espinoza
- 'Description: Pager is a simple program that will slice a text file
- 'into separate smaller files. Generally used for slicing large text
- 'or source files (hint, hint) to be posted on BBS.
- '
- 'PAGER command line:
- ' PAGER filename nn
- '
- ' filename - text file to work on
- ' nn - number of output lines per file
- '
- PRINT " PAGER"
- PRINT "Copyright 1992"
- PRINT "Micro Miracles"
- PRINT "--------------"
- sp = INSTR(COMMAND$, " ") + 1
- fi$ = LEFT$(COMMAND$, sp)
- lin = VAL(MID$(COMMAND$, sp))
- IF DIR$(fi$) = "" THEN
- PRINT "usage:"
- PRINT "PAGER filename nn"
- PRINT
- PRINT "Pager creates smaller files of text files."
- PRINT "It takes a text file and slices it to nn lines per file"
- PRINT "all files are numberd filename.xxx where xxx is between"ì PRINT
- END
- END IF
- fi = 0
- lc = 0
- nf$ = LEFT$(fi$, INSTR(fi$, ".") - 1)
- OPEN fi$ FOR INPUT AS #1
- ON ERROR GOTO doneread
- WHILE NOT EOF(1)
- LINE INPUT #1, a$
- IF lc = 0 THEN
- e$ = MID$(STR$(fi), 2)
- DO WHILE LEN(e$) < 3
- e$ = "0" + e$
- LOOP
- OPEN nf$ + "." + e$ FOR OUTPUT AS #2
- fi = fi + 1
- END IF
- PRINT #2, a$
- lc = lc + 1
- IF lc = lin THEN
- CLOSE #2
- lc = 0
- END IF
- WEND
- doneread:
- CLOSE
- fi = fi - 1
- PRINT fi; "Files created"
-