Esempio n. 1
0
int main(int argc, char **argv) {
	unsigned int c ='\0';
	extern char *optarg;
	unsigned int opt_cpu=0, opt_mem=0;
	static struct option long_options[] = {
		{"mem",  no_argument,       0,  'm' },
		{"cpu",  no_argument,       0,  'c' },
		{"wait",  required_argument,       0,  'w' },
		{0,         0,                 0,  0 }
	};

	while ((c = getopt_long(argc, argv, "cmw:", long_options, NULL)) != EOF) {
		switch(c) {
		case 'w':
			opt_wait=strtoul(optarg, NULL, 0);
			break;
		case 'c':
			opt_cpu++;
			break;
		case 'm':
			opt_mem++;
			break;
		}
	}
	if(opt_cpu) eat_cpu();
	if(opt_mem) eat_mem();
}
static int lost_exception(void)
{
	return eat_cpu(test_body);
}