Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!swrinde!mips!cs.uoregon.edu!ns.uoregon.edu!milton!serval!yoda.eecs.wsu.edu!mwoodwar From: mwoodwar@yoda.eecs.wsu.edu (woodward matthew d - CS350) Newsgroups: comp.sys.atari.8bit Subject: Re: Conversions: ASCII -> ATASCII Message-ID: <1991May9.170608.8891@serval.net.wsu.edu> Date: 9 May 91 17:06:08 GMT References: <1991May9.140834.21966@magnus.acs.ohio-state.edu> Sender: news@serval.net.wsu.edu (USENET News System) Organization: Washington State University Lines: 96 In article <1991May9.140834.21966@magnus.acs.ohio-state.edu> fseipel@magnus.acs.ohio-state.edu (Frank E Seipel) writes: > > I am looking for a program I can run on a UNIX machine to convert ASCII to >ATASCII. I would like something that I can simply execute before an x-modem >download, and use with a pipe -- this way no extra files will be created. >I want to put USENET newsgroups on my new 8-bit BBS. While there are many >ASCII -> ATASCII converters for the 8-bit, it would be more convenient to >do the conversion on the UNIX machine. If worse comes to worse I can probably >change Trent Dudley's X/Y Modem download code to do the conversion (I think >I have source laying around somewhere). > > BTW ICD is dropping support of the 8-bit Atari completely at the end of >June. > > I have the new Z-Mag 192 and will send it up when I get a chance. here is a basic skeleton (in C) to do what you want to do. This task could be pretty easily done in Atari BASIC on the Atari side, but it will definetly go MUCH quicker on the UNIX end (unless the Unix machine is overworked or a dog). -----------------------cut here------------------------------------ #include /* compile command: cc ataconv.c -o ataconv */ /* this program will take a filename on the command line for input. */ /* because I was using it for another purpose, the output ALWAYS goes */ /* to standard output so you can do the following: */ /* ataconv ascii.file > atascii.file */ /* ataconv < ascii.file > atascii.file */ /* the first two have the same end result */ /* maybe you can do this (this is how our system works) */ /* ataconv ascii.file | xmodem -st */ /* pipe ataconv's output to the xmodem program (most efficient if that is */ /* your end goal. */ /* note: The shell of this program works--I used it for a TEX filter. you */ /* will need to define the defines below. The atari conversion part has */ /* not been debugged. (I think it's okay, though.) I am leaving, so if you*/ /* have any problems, I probably won't answer for at least 3 weeks. */ #define UNIX_LF \XXX /* linefeed where XXX is a 3-digit octal constant */ /* for ctrl-M. */ #define UNIX_CR \XXX /* unix CR */ #define ATARI_CR \XXX /* atari CR value */ main(argc, argv) int argc; char **argv; { FILE *fp; int c; if(argc < 2) fp = stdin; else{ fp = fopen(argv[1], "r"); if (fp == NULL){ fprintf(stderr, "bad file %s\n", argv[1]); exit(1); } } while((c = fgetc(fp)) != EOF){ if(isprint(c)) /* printables go out as-is */ putchar(c); /* you might want to filter the clearscreen which is */ else /* one of the curly braces. */ switch (c){ case UNIX_LF: /* strip linefeeds */ break; /* you may, depending on UNIX implementation */ /* want to strip CRs and convert LF */ case UNIX_CR: /* convert UNIX c/r to ATARI */ putchar(ATARI_CR); break; case /* convert any other characters you want in a similar manner */ } exit(0); } /* not a whole lot of error-checking here...be careful, don't toast your */ /* until you check your results */ /* disclaimer: I assume no responsiblity for the fitness of this code. */ /* IT'S ONLY A KLUDGE! :) */ /* Matt Woodward mwoodwar@yoda.eecs.wsu.edu */