Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!zaphod.mps.ohio-state.edu!unix.cis.pitt.edu!dsinc!ub!acsu.buffalo.edu From: cloos@acsu.buffalo.edu (James H. Cloos) Newsgroups: comp.sys.handhelds Subject: Re: ->ASC on other computers? Keywords: ASC transfer program request & followup Message-ID: <47585@eerie.acsu.Buffalo.EDU> Date: 26 Nov 90 19:21:58 GMT References: <1990Nov19.215615.3165@sol.cs.wmich.edu> <47057@eerie.acsu.Buffalo.EDU> Sender: news@acsu.Buffalo.EDU Organization: State University of New York @ Buffalo Lines: 81 Nntp-Posting-Host: lictor.acsu.buffalo.edu Ok, here is the final version of the hack asc. Use it as you wish. -JimC -- James H. Cloos, Jr. Phone: +1 716 673-1250 cloos@ACSU.Buffalo.EDU Snail: PersonalZipCode: 14048-0772, USA cloos@ub.UUCP Quote: <> =============================CUT HERE============================== #! /bin/sh # This is a shell archive. Remove anything before this line, then # unpack it by saving it in a file and typing "sh file". (Files # unpacked will be owned by you and have default permissions.) # # This archive contains: # asc.c echo x - asc.c sed -e 's/^X//' > "asc.c" << '//E*O*F asc.c//' X/* The crc routine is from _KERMIT_-_A_File_Transfer_Protocol_ by * X * Frank da Cruz, Digital Press, 1987. P. 257. * X * The rest is public domain; -JimC. * X * This is the final version; the 3rd to get posted. */ X#include X Xmain(argc, argv) Xint argc; Xchar **argv; X{ X FILE *infile, *outfile; X int count=0, c=0, hi=0, low=0; X unsigned short value=0, dofx=0; X X argc--, argv++; X if (argc > 0) X infile = fopen(*argv, "r"); X else X infile = stdin; X argc--, argv++; X if (argc > 0) X outfile = fopen(*argv, "w"); X else X outfile = stdout; X X for (count=8; count>0; count--) X c=getc(infile); X X fprintf(outfile,"%%%%HP: T(3)A(R)F(.);\n\""); X X while( (c=getc(infile)) != EOF ) { X value = c; X count +=1; X X dofx = (dofx >> 4) ^ (((value ^ dofx) & 0xf) * 0x1081); X dofx = (dofx >> 4) ^ ((((value >> 4) ^ dofx) & 0xf) * 0x1081); X X fprintf(outfile,"%2.2X",c); X X if (! (count % 32)) X fprintf(outfile,"\n"); X } X dofx &= 0xffff; X X for (count = 1; count < 4; count++) { X fprintf(outfile,"%1.1X",dofx & 0xf); X dofx >>= 4; X } X fprintf(outfile,"\"\n"); X} X X/* @(#)James H. Cloos, Jr. */ //E*O*F asc.c// echo Possible errors detected by \'wc\' [hopefully none]: temp=/tmp/shar$$ trap "rm -f $temp; exit" 0 1 2 3 15 cat > $temp <<\!!! 52 169 1196 asc.c !!! wc asc.c | sed 's=[^ ]*/==' | diff -b $temp - exit 0