Eliminating the getopt disgrace.
This commit is contained in:
25
mkfifo.c
25
mkfifo.c
@@ -5,13 +5,26 @@
|
||||
#include <sys/stat.h>
|
||||
#include "util.h"
|
||||
|
||||
static void
|
||||
usage(void)
|
||||
{
|
||||
eprintf("usage: %s name...\n", argv0);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
while(getopt(argc, argv, "") != -1)
|
||||
exit(EXIT_FAILURE);
|
||||
for(; optind < argc; optind++)
|
||||
if(mkfifo(argv[optind], S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH) == -1)
|
||||
eprintf("mkfifo %s:", argv[optind]);
|
||||
return EXIT_SUCCESS;
|
||||
ARGBEGIN {
|
||||
default:
|
||||
usage();
|
||||
} ARGEND;
|
||||
for(; argc > 0; argc--, argv++) {
|
||||
if(mkfifo(argv[0], S_IRUSR|S_IWUSR|S_IRGRP|\
|
||||
S_IWGRP|S_IROTH|S_IWOTH) == -1) {
|
||||
eprintf("mkfifo %s:", argv[0]);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user