Ejemplo n.º 1
0
int
main(int argc, char *argv[])
{
	int ch;

	while ((ch = getopt(argc, argv, "al")) != -1)
		switch (ch) {
		case 'a':
			allopt++;
			break;
		case 'l':
			longopt++;
			break;
		default:
			usage();
			/* NOTREACHED */
		}

	setlinebuf(stdout);
	if (argc == optind)
		allhosts();
	else {
		for (; optind < argc; optind++)
			onehost(argv[optind]);
	}
	exit(0);
}
Ejemplo n.º 2
0
int
main(int argc, char *argv[])
{
    int ch, retval;

    retval = 0;
    while ((ch = getopt(argc, argv, "")) != -1)
        switch (ch) {
        default:
            usage();
            /*NOTREACHED*/
        }

    setlinebuf(stdout);
    if (argc == optind)
        allhosts();
    else {
        for (; optind < argc; optind++)
            retval += onehost(argv[optind]);
    }
    exit(retval ? 1 : 0);
}