[comp.sys.apple] Stripper

krb20699@uxa.cso.uiuc.edu (04/26/89)

     I'm looking for a Unix file that will replace LF's with CR's.  Executioner
files cannot be EXECed from AppleSoft without CR's.  And considering Unix sends
LF's in protocol transfers, not CR's, Executioner files have to be captured:
not very reliable.  Anyone have any help?  I'm writing a simple converter, but
it's slow (BASIC.)
						Thanks,
							Ken.

sjklafke@csd4.milw.wisc.edu (Scott James Klafke) (04/27/89)

In article <113300060@uxa.cso.uiuc.edu> krb20699@uxa.cso.uiuc.edu writes:
>
>
>     I'm looking for a Unix file that will replace LF's with CR's.  Executioner
>files cannot be EXECed from AppleSoft without CR's.  And considering Unix sends
>LF's in protocol transfers, not CR's, Executioner files have to be captured:
>not very reliable.  Anyone have any help?  I'm writing a simple converter, but
>it's slow (BASIC.)
>						Thanks,
>							Ken.

Ken,
	If possible, see if the system you are on supports '-a' in the transfer
process. Try sz -a filename. If that doesn't work, try getting the program
called TEX. I don't know who it is written by, but I think it is the same guy
who wrote BLU. It strips LF's nicely, but I am not sure if it will convert LF's
to CR's.

Scott

wombat@claris.com (Scott Lindsey) (04/27/89)

From article <113300060@uxa.cso.uiuc.edu>, by krb20699@uxa.cso.uiuc.edu:
> 
> 
>      I'm looking for a Unix file that will replace LF's with CR's.

Under unix, try
 tr '\012' '\015' < srcfile > destfile


-- 
Scott Lindsey     |"Cold and misty morning. I heard a warning borne in the air
Claris Corp.      |    About an age of power when no one had an hour to spare"
ames!claris!wombat| DISCLAIMER: These are not the opinions of Claris, Apple,
wombat@claris.com |    StyleWare, the author, or anyone else living or dead.

gwyn@smoke.BRL.MIL (Doug Gwyn) (04/27/89)

In article <113300060@uxa.cso.uiuc.edu> krb20699@uxa.cso.uiuc.edu writes:
>     I'm looking for a Unix file that will replace LF's with CR's.  Executioner
>files cannot be EXECed from AppleSoft without CR's.  And considering Unix sends
>LF's in protocol transfers, not CR's, Executioner files have to be captured:
>not very reliable.  Anyone have any help?  I'm writing a simple converter, but
>it's slow (BASIC.)

I don't know how you're downloading files from that UNIX system to your
Apple, but it is not a problem with UNIX per se but rather with your
specific download procedure.  In any case, if you have a IIGS there is
a freeware program available called "FIXER" (I forget its author, but
I do recall that he was somebody quite well known) that is specifically
designed to clean up text files, including fixing line delimiters.  Look
for it on one of the information services.

rich@pro-exchange.cts.com (Rich Sims) (04/28/89)

>     I'm looking for a Unix file that will replace LF's with CR's.

The file (one of them) is called "awk"   :-)

	awk '{ORS="\r";print}' input_file > output_file

Rich Sims

UUCP: crash!pro-exchange!rich
ARPA: crash!pro-exchange!rich@nosc.mil
INET: rich@pro-exchange.cts.com

Sirald@cup.portal.com (Andrew Lionel Dalrymple) (04/29/89)

	Geez, I think your all missing the point.  It is not
a problem really for either machine, just a difference.
Actually, there a two differences; one between UNIX and DOS;
the other between UNIX to APPLE transfers.  UNIX sends the
LF instead of CR, that part is true.  The other part is that
UNIX uses POSITIVE-ASCII that is, the high-order bit is set.
APPLE DOS uses NEGATIVE-ASCII, high-order bit off.  There is
a big difference.  The high-set of ASCII on an APPLE ar
command tokens.

	The alterations in the UNIX environment will not
help, this needs to be done solely on the receiving APPLE.

gwyn@smoke.BRL.MIL (Doug Gwyn) (05/01/89)

In article <17720@cup.portal.com> Sirald@cup.portal.com (Andrew Lionel Dalrymple) writes:
>UNIX sends the LF instead of CR, that part is true. ...
>UNIX uses POSITIVE-ASCII that is, the high-order bit is set.

Both false.  UNIX text files as stored conventionally use the new-line
(LF) character as a line delimiter, and are in 7-bit ASCII in most non
IBM-mainframe implementations, with the high bit of each character 0.
But what is transmitted down a terminal line is configurable in a number
of ways, including mapping line delimiters to CR and/or LF and parity.
What you actually see on the Apple end of the serial link entirely
depends on the procedure that is used to perform the download.

>APPLE DOS uses NEGATIVE-ASCII, high-order bit off.

Wrong again, for DOS 3.3.  And again what actually happens depends on
the procedure you're using to perform the download.

I don't normally have any trouble at all, using XMODEM protocols
with suitable communications software running at both ends of the link.

rat@madnix.UUCP (David Douthitt) (05/01/89)

Just thought I'd put in my two cents worth.  Someone suggested that
UNIX uses "Positive" ascii (Hibit set).  First, I thought positive numbers
had their hibit CLEAR.  Secondly, seems to me both the Prodos-based Apple
and UNIX use POSITIVE ascii (hibit clear).  Dos 3.3 uses Hibit set, but
it's no longer supported.

Using the tr utility on UNIX is an elegant solution.

Using awk?  Isnt that overkill?  But what a way to go...!

If you have Davex on your Apple, then why not use the tr utility there?

There is also a (hacker-written) utility that was posted a while back
to comp.binaries.apple2 (text.conv?) which will handle cr to lfs very
nicely.

Of course, all of this is moot if you use BINscii for text-based downloads.

	[david]

-- 
!======= David Douthitt :::: Madison, WI =======!== The Stainless Steel Rat ==!
!  ArpaNet: madnix!rat@cs.wisc.edu              !                             !
!  UseNet: ...uwvax!astroatc!nicmad!madnix!rat  !  Mad Apple Forth:           !
!               {decvax!att}!                   !  The Madness starts here.   !

flan@wucs1.wustl.edu (Ian Flanigan) (05/04/89)

For those who aren't blessed with such snazzy software as LIST or
nifty modem packages that convert LF's to CR's, here is a short
script that you can run.  It's fairly fast (under a minute for a 1meg
file on a VAX, under 20 seconds on a Sun 3/60, and under 7 seconds on
a Sun 4) and you can always put it in the background.  The script
itself was made using _stripexec_ as a model.


#
# _cr_ by Ian Flanigan
#

if ($#argv == 0) then
    echo 'usage: cr filename'
    exit
endif

foreach file ($argv)
   set newfile=$file.str
   echo $file ':'
   tr '\012' '\015' < $file > $newfile
end

I hope this helps.