1. Command line parser...
- Posted by "Carl R. White" <C.R.White at SCM.BRAD.AC.UK> Jan 27, 1998
- 524 views
With people being a little disgruntled of late about the lack of source code given away, I decided to write something that everone could take apart. A command line parser in the style of the Unix Korn Shell's "getopts" function. In other words, it's possible to do things like options after your program name. e.g. " myprog -a hello -dsv filename.ext ". This library facilitates that kind of thing. :) I've included an example application of the parser: Split.ex Split.ex is a file splitter. I know there's tonnes of them around, but you get the *source* to this one. Another plus point is that it'll create a BATchfile to reconstitute the original file if you ask it to (the -d flag). One example use is to split a large file into floppy size chunks (yes PKZIP can do this too) e.g. " ex split -1423k -vdt bigfile.$%^ " -1423k : split file into 1423k size chunks (floppy size) -v : Tells you what its doing! -d : Generate a DOS BATch file to remake the original from the chunks -t : Whether this is present or not determines the extensions to the chunk files ($%0, $%1 ... $10, $11 ... etc. or xaa, xab, xac ... xba, xbb etc.) or e.g. " ex split -5 -t bigfile.$%^ " ...splits the file into 5 chunks (however big they may be) using .xaa, .xab notation Type " ex split -? " for more info They're all available from my Euphoria page. Follow link number 2) to my programs and the code is in the directory "cmdline". Two points: 1) cmdline.e and split.ex are beta versions. Usual precautions should apply. 2) I'd like some feedback on cmdline.e :) Thanks, Carl -- Carl R White | e-mail...: crwhite- at -comp.brad.ac.uk | finger...: crwhite- at -dcsun1.comp.brad.ac.uk | web......: http://www.student.comp.brad.ac.uk/~crwhite/ *** Anti-Spam: Header tampered with. Change '- at -' to '@' above. ***