|
|
1.1 ! root 1: /* NOTICE-NOT TO BE DISCLOSED OUTSIDE BELL SYS EXCEPT UNDER WRITTEN AGRMT */ ! 2: /* Writer's Workbench version 2.1, March 8, 1981 */ ! 3: #include <stdio.h> ! 4: main(argc,argv) ! 5: char *argv[]; ! 6: int argc; ! 7: { ! 8: FILE *fp, *fopen(); ! 9: int len; ! 10: char phrase[100]; ! 11: char *ptr = phrase; ! 12: if((fp=fopen(argv[1],"a"))==NULL){ ! 13: fprintf(stderr,"Dictadd can't write on %s\n",argv[1]); ! 14: exit(1); ! 15: } ! 16: putchar('>'); ! 17: while(gets(phrase) != EOF){ ! 18: len = strlen(phrase); ! 19: if((*ptr == 'q' || *ptr == '.') && len == 1)break; ! 20: if(*ptr=='\0' ) { ! 21: fprintf(stderr,"error: pattern not stored\n"); ! 22: continue; ! 23: } ! 24: if(*ptr!='~'&& *ptr!=' ')putc(' ',fp); ! 25: fprintf(fp,"%s",phrase); ! 26: if(*ptr!='~'&& phrase[len-1]!=' ') putc(' ',fp); ! 27: putc('\n',fp); ! 28: putchar('>'); ! 29: } ! 30: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.