DataMuseum.dk

Presents historical artifacts from the history of:

Commodore CBM-900

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about Commodore CBM-900

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download

⟦a8287e529⟧ TextFile

    Length: 712 (0x2c8)
    Types: TextFile
    Notes: UNIX file
    Names: »main.c«

Derivation

└─⟦f27320a65⟧ Bits:30001972 Commodore 900 hard disk image with partial source code
    └─⟦f4b8d8c84⟧ UNIX V7 Filesystem
        └─ ⟦this⟧ »cmd/bc/main.c« 

TextFile

#include <stdio.h>
#include "bc.h"


main(argc, argv)
register int	argc;
register char	*argv[];
{
	register FILE	*fp;

	init();
	++argv;
	if (--argc > 0 && **argv == '-')
		if (strcmp(*argv++, "-l") == 0) {
			fp = fopen("/usr/lib/lib.b", "r");
			if (fp == NULL)
				die("Can't open /usr/lib/lib.b");
			scan(fp);
			--argc;
		} else
			usage();
	while (--argc >= 0) {
		fp = fopen(*argv, "r");
		if (fp == NULL)
			die("Can't open %s", *argv);
		scan(fp);
		++argv;
	}
	scan(stdin);
	return (0);
}


scan(fp)
FILE	*fp;
{
	infile = fp;
	yyparse();
	fclose(fp);
}


die(str)
char	*str;
{
	fprintf(stderr, "bc: %r\n", &str);
	exit(1);
}


usage()
{
	fprintf(stderr, "Usage: bc [-l] file ... file\n");
	exit(1);
}