Annotation of 43BSD/ucb/lisp/franz/vax/totxtfile.c, revision 1.1.1.1

1.1       root        1: 
                      2: /*
                      3:  *
                      4:  *     This program changes a unix textfile to a VMS text file.
                      5:  *
                      6:  *     $Locker:  $
                      7:  *
                      8:  */
                      9: #include <stdio.h>
                     10: 
                     11: static char *rcsid = "$Header: /na/franz/franz/vax/RCS/totxtfile.c,v 1.1 83/04/11 00:31:07 sklower Exp $";
                     12: 
                     13: main(argc,argv)
                     14: char *argv[];
                     15: {
                     16:        int fd;
                     17:        register FILE *f, *in;
                     18:        register c;
                     19:        /*
                     20:         *      Open the input file
                     21:         */
                     22:        if(argc==3) {
                     23:                if(NULL==(in = fopen(argv[1],"r"))) {
                     24:                        fprintf(stderr,
                     25:                                "Couldn't open %s for reading\n",argv[1]);
                     26:                        exit(2);
                     27:                }
                     28:                argc--; argv++;
                     29:        } else {
                     30:                in = fdopen(0,"r");
                     31:        }
                     32:        if(argc!=2) {
                     33:                fprintf(stderr,"Usage: totxtfile <unixfile> <vmsfile>\n");
                     34:                exit(1);
                     35:        }
                     36:        /*
                     37:         *      Open the .txt file
                     38:         */
                     39:        if ((fd = creat(argv[1],0777,"txt")) < 0) {
                     40:                fprintf(stderr,"Couldn't open %s for writing\n",argv[1]);
                     41:                exit(3);
                     42:        }
                     43:        f = fdopen(fd,"w");
                     44:        /*
                     45:         *      Do the copy
                     46:         */
                     47:        for(;;) {
                     48:                c = getc(in);
                     49:                if(c==EOF) break;
                     50:                putc(c,f);
                     51:        }
                     52:        /*
                     53:         *      Close the file
                     54:         */
                     55:        fclose(f);
                     56:        /*
                     57:         *      Done
                     58:         */
                     59:        exit(0);
                     60: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.