home *** CD-ROM | disk | FTP | other *** search
-
- EOLCon v1.3
-
- Usage : EOLCon <infile> <outfile> <0|1|2|x> [buffersize]
-
- infile should be an ascii text file
-
- outfile can either be a filename for
- the output, OR it can be an asterisk
- (*) to denote that you wish to use
- the same name as <infile>. Using the
- asterisk for <outfile> will cause a
- temporary file to be created as output,
- then renamed to <infile> after completion.
- Use the force, read the source!
-
- 0 will remove all character 13's
- (carriage returns) in the file.
-
- 1 will add character 13's to the
- end of every line. Any additional
- CR's found in the middle of a line
- will be deleted. Only one char 13
- will ever be left on one line, and
- it will always be right before the
- linefeed. Guaranteed. :-)
-
- 2 will replace any carriage returns by
- a linefeed. This is used with files
- that contain no linefeeds of their
- own to begin with.
-
- x represents any printable character. It
- will placed at the end of every line.
- This can be any printable key on the
- keyboard except '0', '1', and '2' (for
- obvious reasons).
-
- buffersize is the number of bytes to use
- for I/O ; be aware that the actual
- amount of memory used is double this
- if removing or replacing CR's ("0" or
- "2" from above description) and triple
- otherwise ("1" or "x" above).
- The default is 10000, which means up to
- 30000 bytes of memory may be allocated.
- Why so much? I could've used dynamically
- allocated space and saved memory, but
- my primary goal for this program was
- SPEED. I'd rather just grab a big hunk
- and be on my way than constantly getting
- free nodes throughout the ConvertFile()
- loop. Plus, the source is included. Fix
- it if it offends you. :-) Incidentally,
- the sizes aren't arbitrary...they're worst-
- case approximations. The worst case is if
- every line of input contains only the line-
- feed char. This means, for x number of
- input chars, there will be x number of CR's
- (or whatever character you desire) added
- on. I keep the input and output buffers
- separate, so that is 3x amount of bytes.
- x for the input buffer, 2x for the output
- buffer. It's better for the "remove CR"
- command ("0")...in this case the buffer is
- 2x ; x for the input, x for the output.
-
-
-
-
-
- This program will make the end-of-line character
- anything the user wants (well, except for the '0', '1',
- and '2' characters...they have separate meaning...see
- 'Usage' above). When I say 'end-of-line', I actually
- mean the character right BEFORE the linefeed char.
- The more obvious and most common use of this program
- is for porting ascii files back and forth between the
- Amiga and MS-DOS machines...the latter uses a carriage
- return before each linefeed to designate the end of
- a line, and the Amiga does not (just a linefeed).
-
- The reason I bothered writing another one of these
- end-of-line converters is that none I had used combined
- speed with accuracy ; that is, they either
- were slow, or they had a few problems in actually doing
- the converting : some would add on another carriage
- return even if the file already contained them. Granted,
- you may want to do such a thing, but it is highly
- unlikely in my opinion. This program will NOT let a
- file slip through its fingers with more than one CR per
- line. Since the source is provided, you can change this
- if you want.
-
- In an effort to make this the EOL converter to end
- them all, I made speed my first goal. Since you can make
- the buffer as big as you have fast ram, you can get very
- fast -- on my hard drive, I converted a 200 Kbyte ascii
- file (with the '1' command to add carriage returns) in
- about 3 seconds using a buffersize of 200000. My second
- goal was to add some options that I thought were quite
- useful in such a program -- a user-definable buffer and
- the ability to make the end-of-line (well, at least the
- last one before the linefeed) character user-definable.
- The latter I added for the use of UUENCODED (or
- XXENCODED, as the case may be!!!) files, so
- up/downloading on other machines doesn't corrupt the
- data (I'm referring to spaces at the end of lines). I
- also found it was real easy and may come in handy in
- the far future. :~)
-
- NOTE : Removing carriage returns with the "0"
- command will remove ALL carriage return characters in
- the file! I did this because some *OTHER* converters
- I've tried in the past interspersed them throughout the
- file (not just at the end of each line). If any of
- you have used such a 'program', running EOLCon on the
- damaged file will repair it, at least to the point of
- getting rid of every one of the carriage returns.
-
-
-
- IMPORTANT :
- -------------------------------------------
- I'm releasing this into the Public Domain.
- This is free. Do whatever you like with
- this program...if you're humble enough to
- give me credit for this, all the better
- (but I don't require it).
-
- Hack the code if you want. Give yourself
- full credit. I don't care. You can use
- any or all of the source code at your
- discretion. I wrote this for my own use
- and later decided someone else might want
- it too. Granted, it's a pretty ridiculous
- little program, but if it works, use it!
- -------------------------------------------
-
- I would appreciate hearing any comments and
- especially BUG-REPORTS, so E-Mail (this sort of
- program doesn't warrant a Snail address...) me :
-
- CRVICH @ CSUGRAD.CS.VT.EDU
- GENERAL @ VTVM1.CC.VT.EDU
- GENERAL @ VTVM1.BITNET
-
-
- Ernest Crvich
- Virginia Polytechnic Institute
- and State University
- Blacksburg, VA
-
-
- Greets to that Belgian lunatic...Pres!!!
-