Ejemplo n.º 1
0
/*
 * read the command line in
 */
int readCmdLine(char **ss, int show) {
	
	char *s;
	
	char ch;
	
	int cnt = 0;

	int len = 0;

	if ((s = (char*) malloc(sizeof(char))) == NULL)
		return 1;

	while ((ch = getchar()) != '\n' && ch != EOF) {
		if (show)
			printf("%c", ch);
		if ((++cnt) > 512)
			continue;
		if (ch == '&' || ch == '|' || ch == '>') {
			if (putIn(&s, ' ', &len) == -1
             || putIn(&s, ch, &len)  == -1
			 || putIn(&s, ' ', &len) == -1) {
				 free(s);
				 return 1;
			 }
		}
		
		else {
			if (putIn(&s, ch, &len) == -1) {
				free(s);
				return 1;
			}
		}
	}
	
	if (cnt > 512) {
		return 1;
	}
	
	(*ss) = s;
	
	return ch;
}
Ejemplo n.º 2
0
void Closing::exitGame() {
	static const char nouns[12][14] = {
		"sackbut", "harpsichord", "camel",   "conscience", "ice-cream", "serf",
		"abacus",  "castle",      "carrots", "megaphone",  "manticore", "drawbridge"
	};

	static const char verbs[12][12] = {
		"haunt",    "daunt",  "tickle",   "gobble",    "erase",    "provoke",
		"surprise", "ignore", "stare at", "shriek at", "frighten", "quieten"
	};

	_vm->_sound->stopSound();

	getScreen(kScreenNagScreen);
	byte nounId = _vm->_rnd->getRandomNumber(11);
	byte verbId = _vm->_rnd->getRandomNumber(11);
	Common::String result = Common::String::format("%s will %s you", nouns[nounId], verbs[verbId]);
	putIn(result, 1628);
	showScreen(); // No halt- it's already set up.
}