ARGBEGIN{
case 'M': /* change MAP file */
mapname = EARGF(usage());
break;
case 'F': /* change /lib/font/bit directory */
strncpy(libfont, EARGF(usage()), sizeof libfont);
break;
case 'd':
dbg = 1;
break;
case 'm': /* magnification */
mag = atof(EARGF(usage()));
if (mag < 0.1 || mag > 10){
fprint(2, "ridiculous mag argument ignored\n");
mag = DEFMAG;
}
break;
case 't':
dotrack = 1;
break;
case 'x':
xyoffset.x += atof(EARGF(usage())) * 100;
break;
case 'y':
xyoffset.y += atof(EARGF(usage())) * 100;
break;
case '/':
nview = atof(EARGF(usage()));
if (nview < 1 || nview > MAXVIEW)
nview = 1;
break;
default:
usage();
}ARGEND
if (argc > 0) {
close(0);
if (open(argv[0], 0) != 0) {
sysfatal("can't open %s: %r", argv[0]);
exits("open failure");
}
if(dotrack)
track = argv[0];
}
Binit(&bin, 0, OREAD);
snprint(mapfile, sizeof mapfile, "%s/%s", libfont, mapname);
readmapfile(mapfile);
for (c = 0; c < NFONT; c++)
loadfontname(c, "??");
mapscreen();
clearscreen();
readpage();
exits(0);
}
/*
* Input buffer to allow us to back up
*/
#define SIZE 100000 /* 8-10 pages, typically */
char bufc[SIZE];
char *inc = bufc; /* where next input character goes */
char *outc = bufc; /* next character to be read from buffer */
int off; /* position of outc in total input stream */