fprintf(stderr, -"usage: pccardc enabler slot driver [-m addr size] [-a iobase] [-i irq]\n"); +"Usage: enabler slot driver [-m addr size] [-a iobase] [-i irq]\n");
Usage string use to start with "usage", not "Usage". Progname should follow. - fprintf(stderr, "usage: pccardc <subcommand> <arg> ...\n"); - fprintf(stderr, "subcommands:\n"); + fprintf(stderr, "Usage:\n"); + fprintf(stderr, "\t%s <subcommand> <arg> ...\n", argv[0]); We do hardcode the progname, because it is known. [removing of usage()] A bad thing. - usage(); + errx(1, "Usage: %s pccardmem [ memory-address ]", argv[0]); Err(3) is wrong at displaying the usage string because it prepends the progname. + + if (argc != 4) + errx(1, "Usage: %s rdattr slot offs length", argv[0]); Errx() -> usage() + if ((buf = malloc(length)) == 0) + err(1, "%s", name); Name give no information here. And because our malloc doesn't set errno, err() which makes use of errno now prints garbage. I suggest errx(1, "malloc failed"). ------ ------ Philippe Charnier charn...@{lirmm.fr,xp11.frmug.org,FreeBSD.org} ``a PC not running FreeBSD is like a venusian with no tentacles'' ------------------------------------------------------------------------ To Unsubscribe: send mail to majord...@freebsd.org with "unsubscribe freebsd-current" in the body of the message