=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/mkfifo/Attic/mkfifo.c,v retrieving revision 1.3 retrieving revision 1.4 diff -c -r1.3 -r1.4 *** src/usr.bin/mkfifo/Attic/mkfifo.c 1996/08/28 07:31:51 1.3 --- src/usr.bin/mkfifo/Attic/mkfifo.c 1996/08/30 07:04:33 1.4 *************** *** 1,4 **** ! /* $OpenBSD: mkfifo.c,v 1.3 1996/08/28 07:31:51 etheisen Exp $ */ /* $NetBSD: mkfifo.c,v 1.7 1994/12/23 07:16:56 jtc Exp $ */ /* --- 1,4 ---- ! /* $OpenBSD: mkfifo.c,v 1.4 1996/08/30 07:04:33 etheisen Exp $ */ /* $NetBSD: mkfifo.c,v 1.7 1994/12/23 07:16:56 jtc Exp $ */ /* *************** *** 44,50 **** #if 0 static char sccsid[] = "@(#)mkfifo.c 8.2 (Berkeley) 1/5/94"; #endif ! static char rcsid[] = "$OpenBSD: mkfifo.c,v 1.3 1996/08/28 07:31:51 etheisen Exp $"; #endif /* not lint */ #include --- 44,50 ---- #if 0 static char sccsid[] = "@(#)mkfifo.c 8.2 (Berkeley) 1/5/94"; #endif ! static char rcsid[] = "$OpenBSD: mkfifo.c,v 1.4 1996/08/30 07:04:33 etheisen Exp $"; #endif /* not lint */ #include *************** *** 53,68 **** #include #include #include - #include - #include #include #include #include static void usage(); - int mksocket; - int main(argc, argv) int argc; --- 53,64 ---- *************** *** 71,78 **** int ch, exitval; void * set; mode_t mode; - int sock; - struct sockaddr_un name; setlocale (LC_ALL, ""); --- 67,72 ---- *************** *** 81,87 **** modified by the file creation mask */ mode = 0666 & ~umask(0); ! while ((ch = getopt(argc, argv, "m:s")) != -1) switch(ch) { case 'm': if (!(set = setmode(optarg))) { --- 75,81 ---- modified by the file creation mask */ mode = 0666 & ~umask(0); ! while ((ch = getopt(argc, argv, "m:")) != -1) switch(ch) { case 'm': if (!(set = setmode(optarg))) { *************** *** 93,101 **** a=rw. */ mode = getmode (set, 0666); break; - case 's': - mksocket = 1; - break; case '?': default: usage(); --- 87,92 ---- *************** *** 105,147 **** if (argv[0] == NULL) usage(); ! if (mksocket) { ! for (exitval = 0; *argv; ++argv) { ! if ((sock = socket(AF_UNIX, SOCK_DGRAM, 0)) < 0) ! goto error; ! ! name.sun_family = AF_UNIX; ! strncpy(name.sun_path, *argv, sizeof(name.sun_path)-1); ! name.sun_path[sizeof(name.sun_path) - 1]; ! if (bind(sock, (struct sockaddr *)&name, ! SUN_LEN(&name)) < 0) ! goto error; ! ! if (chmod(*argv, mode) < 0) { ! unlink(*argv); ! goto error; ! } ! ! continue; ! error: warn("%s", *argv); exitval = 1; } } - else { - for (exitval = 0; *argv; ++argv) { - if (mkfifo(*argv, mode) < 0) { - warn("%s", *argv); - exitval = 1; - } - } - } exit(exitval); } void usage() { ! (void)fprintf(stderr, "usage: mkfifo [-m mode] [-s] filename ...\n"); exit(1); } --- 96,113 ---- if (argv[0] == NULL) usage(); ! for (exitval = 0; *argv; ++argv) { ! if (mkfifo(*argv, mode) < 0) { warn("%s", *argv); exitval = 1; } } exit(exitval); } void usage() { ! (void)fprintf(stderr, "usage: mkfifo [-m mode] fifoname ...\n"); exit(1); }