Пример #1
0
/*  the symbol table entry pointed to by lmte*/
getsym()	/* rewritten for vax */
{
	register int i;
	long lvalue;
	char *p;
	short wvalue;

	p = lmte;
	for(i=SYNAMLEN; --i != -1; )	/* 2 may 83 */
		*p++ = getc(&ibuf);	        /* get name */
	if (lgetw(&wvalue, &ibuf) == -1)
		printf(": error reading symbol table entry\n");
	else if (lgetl(&lvalue ,&ibuf) == -1)
		printf(": error reading symbol table entry\n");	/* symbol value */
	((struct symtab *)lmte)->flags = wvalue;
	((struct symtab *)lmte)->vl1 = lvalue;
#ifdef DEBUG
	printf("\tname= %s, flags= %o, val= %d\n", ((struct symtab *)lmte)->name, 
			((struct symtab *)lmte)->flags, ((struct symtab *)lmte)->vl1);
#endif
}
Пример #2
0
/*
	function to read and process the larn options file
 */
void
readopts(void)
{
	char *i;
	int j, k;
	int flag;

	flag = 1;		/* set to 0 if a name is specified */
	if (lopen(optsfile) < 0) {
		strcpy(logname, loginname);
		return;                            /* user name if no character name */
	}
	do {
		if ((i = (char *)lgetw()) == 0)
			break;	/* check for EOF */
		while ((*i == ' ') || (*i == '\t'))
			i++;	/* eat leading whitespace */
		switch (*i) {
		case 'b':
			if (strcmp(i, "bold-objects") == 0)
				boldon = 1;
			break;

		case 'e':
			if (strcmp(i, "enable-checkpointing") == 0)
				ckpflag = 1;
			break;

		case 'i':
			if (strcmp(i, "inverse-objects") == 0)
				boldon = 0;
			break;

		case 'f':
			if (strcmp(i, "female") == 0)
				sex = 0;	/* male or female */
			break;

		case 'm':
			if (strcmp(i, "monster:") == 0) {	/* name favorite monster */
				if ((i = lgetw()) == 0)
					break;
				if (strlen(i) >= MAXMNAME)
					i[MAXMNAME - 1] = 0;
				strcpy(usermonster[(int)usermpoint], i);
				if (usermpoint >= MAXUM)
					break;		/* defined all of em */
				if (isalpha(j = usermonster[(int)usermpoint][0])) {
					for (k = 1; k < MAXMONST + 8; k++)	/* find monster */
						if (monstnamelist[k] == j) {
							monster[k].name = &usermonster[(int)usermpoint++][0];
							break;
						}
				}
			} else if (strcmp(i, "male") == 0)
				sex = 1;
			break;

		case 'n':
			if (strcmp(i, "name:") == 0) {	/* defining players name */
				if ((i = lgetw()) == 0)
					break;
				if (strlen(i) >= LOGNAMESIZE) i[LOGNAMESIZE - 1] = 0;
				strcpy(logname, i);
				flag = 0;
			} else if (strcmp(i, "no-introduction") == 0)
				nowelcome = 1;
			else if (strcmp(i, "no-beep") == 0)
				nobeep = 1;
			break;

		case 'p':
			if (strcmp(i, "process-name:") == 0) {
				if ((i = lgetw()) == 0)
					break;
				if (strlen(i) >= PSNAMESIZE)
					i[PSNAMESIZE - 1] = 0;
				strcpy(psname, i);
			} else if (strcmp(i, "play-day-play") == 0)
				dayplay = 1;
			break;

		case 's':
			if (strcmp(i, "savefile:") == 0) {	/* defining savefilename */
				if ((i = lgetw()) == 0)
					break;
				strcpy(savefilename, i);
				flag = 0;
			}
			break;
		}
	} while (*i);
	if (flag)
		strcpy(logname, loginname);
}