/* atascii to ascii */#include <stdio.h>#ifndef M6502#include <errno.h>#define delete unlink#endifchar buf1[40];char buf2[40];main(argc, argv)int argc;char ** argv;{  char * name;  char * p;  FILE * inf;  FILE * outf;  int ch;  if (argc > 1){name = argv[1];strcpy(buf1, name);}    else{#ifdef M6502        printf("AT2A>");        if (getname(buf1) <= 0)exit(0);name = buf1;#elseprintf("AT2A what?\n");exit(0);#endif}  inf = fopen(name, "r");  printf("open '%s'->%x\n", name, inf);  if ((int)inf <= 0){printf("Can't open '%s' error %x\n", name, errno);#ifdef M6502kbdchar();#endifexit(0);}  strcpy(buf2, buf1);  p = strchr(buf2, '.');  if (!p)p = buf2 + strlen(buf2);  strcpy(p, ".tmp");  outf = fopen(buf2, "w");  printf("open '%s'->%x\n", buf2, outf);  while ((ch = fgetc(inf)) != EOF){switch (ch){#ifdef M6502case 0x0D:fgetc(inf);case 0x0A:ch = '\n';break;case 0x09:ch = '\t';break;#elsecase 0x9B:/* atascii eol */ch = '\n';break;case 0x7F:/* atascii tab */ch = '\t';break;#endif}/*fputc(ch, stdout);*/fputc(ch, outf);}  fclose(inf);  fclose(outf);  delete(buf1);  rename(buf2, buf1);/*#ifdef M6502  kbdchar();#endif*/}#ifdef M6502int getname(buf)char * buf;{  int i;  int ch;  i = 0;/* str idx */  for ( ; ((ch = kbdchar()) != '\n') ; ){if (ch == '\b'){if (i > 0){fputc('\b', stderr);i--;}}    else{fputc(ch, stderr);buf[i] = ch;i++;}}  buf[i] = '\0';  return strlen(buf);}#endif