File:  [CSRG BSD Unix] / 43BSD / ucb / lisp / franz / vax / totxtfile.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 16:12:55 2018 UTC (8 years, 1 month ago) by root
Branches: MAIN, BSD
CVS tags: HEAD, BSD43
BSD 4.3


/*
 *
 *	This program changes a unix textfile to a VMS text file.
 *
 *	$Locker:  $
 *
 */
#include <stdio.h>

static char *rcsid = "$Header: /var/lib/cvsd/repos/CSRG/43BSD/ucb/lisp/franz/vax/totxtfile.c,v 1.1.1.1 2018/04/24 16:12:55 root Exp $";

main(argc,argv)
char *argv[];
{
	int fd;
	register FILE *f, *in;
	register c;
	/*
	 *	Open the input file
	 */
	if(argc==3) {
		if(NULL==(in = fopen(argv[1],"r"))) {
			fprintf(stderr,
				"Couldn't open %s for reading\n",argv[1]);
			exit(2);
		}
		argc--; argv++;
	} else {
		in = fdopen(0,"r");
	}
	if(argc!=2) {
		fprintf(stderr,"Usage: totxtfile <unixfile> <vmsfile>\n");
		exit(1);
	}
	/*
	 *	Open the .txt file
	 */
	if ((fd = creat(argv[1],0777,"txt")) < 0) {
		fprintf(stderr,"Couldn't open %s for writing\n",argv[1]);
		exit(3);
	}
	f = fdopen(fd,"w");
	/*
	 *	Do the copy
	 */
	for(;;) {
		c = getc(in);
		if(c==EOF) break;
		putc(c,f);
	}
	/*
	 *	Close the file
	 */
	fclose(f);
	/*
	 *	Done
	 */
	exit(0);
}

unix.superglobalmegacorp.com

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