]> git.wh0rd.org - dump.git/commitdiff
Fix rmtopen() extended format...
authorStelian Pop <stelian@popies.net>
Mon, 29 Jul 2002 12:00:30 +0000 (12:00 +0000)
committerStelian Pop <stelian@popies.net>
Mon, 29 Jul 2002 12:00:30 +0000 (12:00 +0000)
CHANGES
common/dumprmt.c
compat/include/rmtflags.h [new file with mode: 0644]
compat/lib/Makefile.in
compat/lib/rmtflags.c [new file with mode: 0644]
dump/dump.h
dump/tape.c
restore/extern.h
restore/tape.c
rmt/Makefile.in
rmt/rmt.c

diff --git a/CHANGES b/CHANGES
index 0527157976483f0942c5d208a09830794e0f631a..2ba427cffaee4d256463877ca80a1a41014717d4 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,4 +1,11 @@
-$Id: CHANGES,v 1.189 2002/07/25 09:56:47 stelian Exp $
+$Id: CHANGES,v 1.190 2002/07/29 12:00:30 stelian Exp $
+
+Changes between versions 0.4b30 and 0.4b31 (released ?????????????)
+===================================================================
+
+1.     Fixed rmt open flags transmission (GNU's symbolic syntax over
+       rmt) which I broke in 0.4b29. Thanks to Eros Albertazzi
+       <eros@lamel.bo.cnr.it> for reporting the bug.
 
 Changes between versions 0.4b29 and 0.4b30 (released July 25, 2002)
 ===================================================================
index 69ada17ac0980df2139c6f6a1ccfa7604db4af89..f89a13de1fb60a1c5cf5fdc14b0b3bdd12a85dee 100644 (file)
@@ -41,7 +41,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-       "$Id: dumprmt.c,v 1.22 2002/07/19 14:57:39 stelian Exp $";
+       "$Id: dumprmt.c,v 1.23 2002/07/29 12:00:33 stelian Exp $";
 #endif /* not lint */
 
 #include <config.h>
@@ -49,6 +49,7 @@ static const char rcsid[] =
 #include <sys/mtio.h>
 #include <sys/socket.h>
 #include <sys/time.h>
+#include <fcntl.h>
 #ifdef __linux__
 #include <sys/types.h>
 #ifdef HAVE_EXT2FS_EXT2_FS_H
@@ -76,6 +77,7 @@ static const char rcsid[] =
 #include <ctype.h>
 #include <errno.h>
 #include <compaterr.h>
+#include <rmtflags.h>
 #include <netdb.h>
 #include <pwd.h>
 #include <stdio.h>
@@ -273,11 +275,17 @@ okname(const char *cp0)
 }
 
 int
-rmtopen(const char *tape, const char *mode)
+rmtopen(const char *tape, const int mode)
 {
        char buf[MAXPATHLEN];
-
-       (void)snprintf(buf, sizeof (buf), "O%s\n%s\n", tape, mode);
+       char *rmtflags;
+
+       rmtflags = rmtflags_tochar(mode);
+       (void)snprintf(buf, sizeof (buf), "O%s\n%d %s\n", 
+                      tape, 
+                      mode & O_ACCMODE, 
+                      rmtflags);
+       free(rmtflags);
        rmtstate = TS_OPEN;
        return (rmtcall(tape, buf));
 }
diff --git a/compat/include/rmtflags.h b/compat/include/rmtflags.h
new file mode 100644 (file)
index 0000000..e97d5a0
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ *     Ported to Linux's Second Extended File System as part of the
+ *     dump and restore backup suit
+ *     Remy Card <card@Linux.EU.Org>, 1994-1997
+ *     Stelian Pop <stelian@popies.net>, 1999-2000
+ *     Stelian Pop <stelian@popies.net> - Alcôve <www.alcove.com>, 2000-2002
+ *
+ *     $Id: rmtflags.h,v 1.1 2002/07/29 12:00:33 stelian Exp $
+ */
+
+/*
+ * Copyright (c) 1983, 1993
+ *     The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the University of
+ *     California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef _RMTFLAGS_H_
+#define _RMTFLAGS_H_
+
+int rmtflags_toint(char *filemode);
+char *rmtflags_tochar(int filemode);
+
+#endif
index 12d09cbecaf1bccc0740e3cea1ce14177dcfdb35..843828f1b21e5da4d8e682a1a2dfff8ff9be1623 100644 (file)
@@ -1,4 +1,4 @@
-# $Id: Makefile.in,v 1.5 2001/07/18 12:54:06 stelian Exp $
+# $Id: Makefile.in,v 1.6 2002/07/29 12:00:33 stelian Exp $
 
 top_srcdir=    @top_srcdir@
 srcdir=                @srcdir@
@@ -7,8 +7,8 @@ srcdir=         @srcdir@
 
 INC=           -I$(top_srcdir)/compat/include
 CFLAGS=                @CCOPTS@ -pipe $(OPT) $(GINC) $(INC) $(DEFS)
-SRCS=          compaterr.c fstab.c compatglob.c bylabel.c system.c
-OBJS=          compaterr.o fstab.o compatglob.o bylabel.o system.o
+SRCS=          compaterr.c fstab.c compatglob.c bylabel.c system.c rmtflags.c
+OBJS=          compaterr.o fstab.o compatglob.o bylabel.o system.o rmtflags.o
 LIB=           libcompat.a
 
 all::          $(LIB)
diff --git a/compat/lib/rmtflags.c b/compat/lib/rmtflags.c
new file mode 100644 (file)
index 0000000..b009ff0
--- /dev/null
@@ -0,0 +1,191 @@
+/*
+ *     Ported to Linux's Second Extended File System as part of the
+ *     dump and restore backup suit
+ *     Remy Card <card@Linux.EU.Org>, 1994-1997
+ *     Stelian Pop <stelian@popies.net>, 1999-2000
+ *     Stelian Pop <stelian@popies.net> - Alcôve <www.alcove.com>, 2000-2002
+ */
+
+/*
+ * Copyright (c) 1983, 1993
+ *     The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the University of
+ *     California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef lint
+static const char rcsid[] =
+       "$Id: rmtflags.c,v 1.1 2002/07/29 12:00:33 stelian Exp $";
+#endif /* not linux */
+
+/*
+ * rmt
+ */
+#include <config.h>
+#include <fcntl.h>
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <malloc.h>
+
+struct openflags {
+       char    *name;
+       int     value;
+} openflags[] = {
+       { "O_RDONLY",   O_RDONLY },
+       { "O_WRONLY",   O_WRONLY },
+       { "O_RDWR",     O_RDWR },
+#ifdef O_CREAT
+       { "O_CREAT",    O_CREAT },
+#endif
+#ifdef O_EXCL
+       { "O_EXCL",     O_EXCL },
+#endif
+#ifdef O_NOCTTY
+       { "O_NOCTTY",   O_NOCTTY },
+#endif
+#ifdef O_TRUNC
+       { "O_TRUNC",    O_TRUNC },
+#endif
+#ifdef O_APPEND
+       { "O_APPEND",   O_APPEND },
+#endif
+#ifdef O_NONBLOCK
+       { "O_NONBLOCK", O_NONBLOCK },
+#endif
+#ifdef O_NDELAY
+       { "O_NDELAY",   O_NDELAY },
+#endif
+#ifdef O_SYNC
+       { "O_SYNC",     O_SYNC },
+#endif
+#ifdef O_FSYNC
+       { "O_FSYNC",    O_FSYNC },
+#endif
+#ifdef O_ASYNC
+       { "O_ASYNC",    O_ASYNC },
+#endif
+#ifdef O_TEXT
+       { "O_TEXT",     O_TEXT },
+#endif
+#ifdef O_DSYNC
+       { "O_DSYNC",    O_DSYNC },
+#endif
+#ifdef O_RSYNC
+       { "O_RSYNC",    O_RSYNC },
+#endif
+#ifdef O_PRIV
+       { "O_PRIV",     O_PRIV },
+#endif
+#ifdef O_LARGEFILE
+       { "O_LARGEFILE",O_LARGEFILE },
+#endif
+       { NULL,         0 }
+};
+
+/* Parts of this stolen again from Jörg Schilling's star package... */
+int
+rmtflags_toint(char *filemode)
+{
+       char    *p = filemode;
+       struct openflags *op;
+       int     result = 0;
+       int     numresult = 0;
+       int     seentext = 0;
+
+       do {
+               /* skip space */
+               while (*p != '\0' && *p == ' ')
+                       p++;
+               /* get O_XXXX constant */
+               if (p[0] != 'O' || p[1] != '_') {
+                       /* numeric syntax detected */
+                       numresult = atoi(filemode);
+                       numresult &= O_RDONLY | O_WRONLY | O_RDWR;
+                       while (*p != ' ' && *p != '\0')
+                               p++;
+                       while (*p != '\0' && *p == ' ')
+                               p++;
+               }
+
+               if (*p == '\0')
+                       break;
+
+               /* translate O_XXXX constant */
+               for (op = openflags; op->name; op++) {
+                       int slen = strlen(op->name);
+                       if ((strncmp(op->name, p, slen) == 0) &&
+                           (p[slen] == '|' || p[slen] == ' ' ||
+                            p[slen] == '\0')) {
+                               seentext = 1;
+                               result |= op->value;
+                               break;
+                       }
+               }
+
+               /* goto next constant */
+               p = strchr(p, '|');
+       } while (p && *p++ == '|');
+
+       if (!seentext)
+               result = numresult;
+       return result;
+}
+
+char *
+rmtflags_tochar(int filemode)
+{
+       struct openflags *op;
+       char *result = (char *) malloc(4096);   /* enough space */
+
+       switch (filemode & O_ACCMODE) {
+       case O_RDONLY: 
+               strcpy(result, "O_RDONLY"); 
+               break;
+       case O_WRONLY: 
+               strcpy(result, "O_WRONLY");
+               break;
+       case O_RDWR: 
+               strcpy(result, "O_RDWR");
+               break;
+       default:
+               strcat(result, "ERROR");
+       }
+       for (op = openflags; op->name; op++) {
+               if (op->value == O_RDONLY ||
+                   op->value == O_WRONLY ||
+                   op->value == O_RDWR)
+                       continue;
+               if (filemode & op->value) {
+                       strcat(result, "|");
+                       strcat(result, op->name);
+               }
+       }
+       return result;
+}
index e6d8e138b9059fc774b719a96cea51764b8ca232..d6bae02954fd36db464e1a97a6f48375702e16f3 100644 (file)
@@ -5,7 +5,7 @@
  *     Stelian Pop <stelian@popies.net>, 1999-2000
  *     Stelian Pop <stelian@popies.net> - Alcôve <www.alcove.com>, 2000-2002
  *
- *     $Id: dump.h,v 1.39 2002/06/05 13:29:15 stelian Exp $
+ *     $Id: dump.h,v 1.40 2002/07/29 12:00:33 stelian Exp $
  */
 
 /*-
@@ -186,7 +186,7 @@ struct      dinode *getino __P((dump_ino_t inum));
 /* rdump routines */
 #ifdef RDUMP
 int    rmthost __P((const char *host));
-int    rmtopen __P((const char *tape, const char *mode));
+int    rmtopen __P((const char *tape, const int mode));
 void   rmtclose __P((void));
 int    rmtread __P((char *buf, size_t count));
 int    rmtwrite __P((const char *buf, size_t count));
index 70c1d1d7f1de944af1a6f99f530b34f88fe90fd3..08c6f7948633fb8d2d9f4ba8648a870ee599e30a 100644 (file)
@@ -41,7 +41,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-       "$Id: tape.c,v 1.70 2002/07/19 14:57:39 stelian Exp $";
+       "$Id: tape.c,v 1.71 2002/07/29 12:00:33 stelian Exp $";
 #endif /* not lint */
 
 #include <config.h>
@@ -546,7 +546,7 @@ trewind(void)
 #ifdef RDUMP
                if (host) {
                        rmtclose();
-                       while (rmtopen(tape, "O_RDONLY") < 0)
+                       while (rmtopen(tape, O_RDONLY) < 0)
                                sleep(10);
                        rmtclose();
                }
@@ -868,7 +868,7 @@ restore_check_point:
                        msg("Dumping volume %d on %s\n", tapeno, tape);
                }
 #ifdef RDUMP
-               while ((tapefd = (host ? rmtopen(tape, "O_WRONLY|O_CREAT|O_TRUNC") : pipeout ? 
+               while ((tapefd = (host ? rmtopen(tape, O_WRONLY|O_CREAT|O_TRUNC) : pipeout ? 
                        fileno(stdout) : 
                        OPEN(tape, O_WRONLY|O_CREAT|O_TRUNC, 0666))) < 0)
 #else
index 6046e57afc018f8f917e50664cdc835408b9e345..62deb0d5deecd45f751a3f87131e9fde3a5d770c 100644 (file)
@@ -5,7 +5,7 @@
  *     Stelian Pop <stelian@popies.net>, 1999-2000
  *     Stelian Pop <stelian@popies.net> - Alcôve <www.alcove.com>, 2000-2002
  *
- *     $Id: extern.h,v 1.18 2002/05/21 15:48:46 stelian Exp $
+ *     $Id: extern.h,v 1.19 2002/07/29 12:00:34 stelian Exp $
  */
 
 /*-
@@ -118,7 +118,7 @@ void                 xtrnull __P((char *, size_t));
 void           rmtclose __P((void));
 int            rmthost __P((const char *));
 int            rmtioctl __P((int, int));
-int            rmtopen __P((const char *, const char *));
+int            rmtopen __P((const char *, const int));
 int            rmtread __P((const char *, int));
 int            rmtseek __P((int, int));
 
index b9d0b02635f2c9d3629083a38ce4d3e2bfb30c07..3195ab53b4746893ca50f62ef3e085980bd3db60 100644 (file)
@@ -46,7 +46,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-       "$Id: tape.c,v 1.63 2002/07/19 14:57:40 stelian Exp $";
+       "$Id: tape.c,v 1.64 2002/07/29 12:00:34 stelian Exp $";
 #endif /* not lint */
 
 #include <config.h>
@@ -285,7 +285,7 @@ setup(void)
 
 #ifdef RRESTORE
        if (host)
-               mt = rmtopen(temptape, "O_RDONLY");
+               mt = rmtopen(temptape, O_RDONLY);
        else
 #endif
        if (pipein)
@@ -541,7 +541,7 @@ again:
        }
 #ifdef RRESTORE
        if (host)
-               mt = rmtopen(magtape, "O_RDONLY");
+               mt = rmtopen(magtape, O_RDONLY);
        else
 #endif
                mt = OPEN(magtape, O_RDONLY, 0);
index 994239cbaae9be3c01fb3430ff3dc53b27b5ee76..fa5ee347a2fe9fe01f21166e7aa94711b67f0eb2 100644 (file)
@@ -1,4 +1,4 @@
-# $Id: Makefile.in,v 1.6 2002/01/02 10:13:16 stelian Exp $
+# $Id: Makefile.in,v 1.7 2002/07/29 12:00:34 stelian Exp $
 
 top_srcdir=    @top_srcdir@
 srcdir=                @srcdir@
@@ -8,24 +8,19 @@ srcdir=               @srcdir@
 CFLAGS=                @CCOPTS@ -pipe $(OPT) $(GINC) $(INC) $(DEFS)
 LDFLAGS=       @LDOPTS@ @STATIC@
 LIBS=          $(GLIBS)
-
-#DEBUG=                -DFDEBUG -DTDEBUG -DWRITEDEBUG
-#INC=          -I../compat/include
-#CFLAGS=               -pipe $(DEFS) $(DEBUG) $(INC) $(GINC) $(OPT)
-#DEPLIBS=      ../compat/lib/libcompat.a
-#LIBS=         $(GLIBS) -L../compat/lib -lcompat
+DEPLIBS=       ../compat/lib/libcompat.a
 
 PROG=          rmt
 SRCS=          rmt.c
 OBJS=          rmt.o
 MAN8=          rmt.8
 
-all::          $(PROG) rmt.8
+all::          $(PROG) $(MAN8)
 
 $(PROG):       $(OBJS) $(DEPLIBS)
-       $(CC) $(CFLAGS) $(LDFLAGS) -o $(PROG) $(OBJS) $(LIBS)
+       $(LD) $(CFLAGS) $(LDFLAGS) -o $(PROG) $(OBJS) $(LIBS)
 
-rmt.8:         rmt.8.in
+$(MAN8):               rmt.8.in
        sed -e "s|__DATE__|$(DATE)|g" \
            -e "s|__VERSION__|$(VERSION)|g" $< > $@
 
index fc8ebce49eec2c95bb89cb7f978ae0f87ac4a077..fc6eb827f4788c0c60b878f918c1eb0fc0e394b8 100644 (file)
--- a/rmt/rmt.c
+++ b/rmt/rmt.c
@@ -41,7 +41,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-       "$Id: rmt.c,v 1.20 2002/05/21 15:48:46 stelian Exp $";
+       "$Id: rmt.c,v 1.21 2002/07/29 12:00:34 stelian Exp $";
 #endif /* not linux */
 
 /*
@@ -49,6 +49,7 @@ static const char rcsid[] =
  */
 #include <config.h>
 #include <compatlfs.h>
+#include <rmtflags.h>
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <sys/mtio.h>
@@ -117,7 +118,6 @@ static int  rmt_version = 0;
 char   *checkbuf __P((char *, int));
 void    error __P((int));
 void    getstring __P((char *));
-int     getopenflags __P((char *));
 
 int
 main(int argc, char *argv[])
@@ -150,7 +150,7 @@ top:
                /*
                 * Translate extended GNU syntax into its numeric platform equivalent
                 */
-               oflags = getopenflags(filemode);
+               oflags = rmtflags_toint(filemode);
 #ifdef  O_TEXT
                /*
                 * Default to O_BINARY the client may not know that we need it.
@@ -458,96 +458,3 @@ error(int num)
        (void)snprintf(resp, sizeof(resp), "E%d\n%s\n", num, strerror(num));
        (void)write(1, resp, strlen(resp));
 }
-
-struct openflags {
-       char    *name;
-       int     value;
-} openflags[] = {
-       { "O_RDONLY",   O_RDONLY },
-       { "O_WRONLY",   O_WRONLY },
-       { "O_RDWR",     O_RDWR },
-#ifdef O_CREAT
-       { "O_CREAT",    O_CREAT },
-#endif
-#ifdef O_EXCL
-       { "O_EXCL",     O_EXCL },
-#endif
-#ifdef O_NOCTTY
-       { "O_NOCTTY",   O_NOCTTY },
-#endif
-#ifdef O_TRUNC
-       { "O_TRUNC",    O_TRUNC },
-#endif
-#ifdef O_APPEND
-       { "O_APPEND",   O_APPEND },
-#endif
-#ifdef O_NONBLOCK
-       { "O_NONBLOCK", O_NONBLOCK },
-#endif
-#ifdef O_NDELAY
-       { "O_NDELAY",   O_NDELAY },
-#endif
-#ifdef O_SYNC
-       { "O_SYNC",     O_SYNC },
-#endif
-#ifdef O_FSYNC
-       { "O_FSYNC",    O_FSYNC },
-#endif
-#ifdef O_ASYNC
-       { "O_ASYNC",    O_ASYNC },
-#endif
-#ifdef O_TEXT
-       { "O_TEXT",     O_TEXT },
-#endif
-#ifdef O_DSYNC
-       { "O_DSYNC",    O_DSYNC },
-#endif
-#ifdef O_RSYNC
-       { "O_RSYNC",    O_RSYNC },
-#endif
-#ifdef O_PRIV
-       { "O_PRIV",     O_PRIV },
-#endif
-#ifdef O_LARGEFILE
-       { "O_LARGEFILE",O_LARGEFILE },
-#endif
-       { NULL,         0 }
-};
-
-/* Parts of this stolen again from Jörg Schilling's star package... */
-int
-getopenflags(char *filemode)
-{
-       char    *p = filemode;
-       struct openflags *op;
-       int     result = 0;
-
-       do {
-               /* skip space */
-               while (*p != '\0' && *p == ' ')
-                       p++;
-               /* get O_XXXX constant */
-               if (p[0] != 'O' || p[1] != '_') {
-                       /* numeric syntax detected */
-                       result = atoi(filemode);
-                       result &= O_RDONLY | O_WRONLY | O_RDWR;
-                       return result;
-               }
-
-               /* translate O_XXXX constant */
-               for (op = openflags; op->name; op++) {
-                       int slen = strlen(op->name);
-                       if ((strncmp(op->name, p, slen) == 0) &&
-                           (p[slen] == '|' || p[slen] == ' ' ||
-                            p[slen] == '\0')) {
-                               result |= op->value;
-                               break;
-                       }
-               }
-
-               /* goto next constant */
-               p = strchr(p, '|');
-       } while (p && *p++ == '|');
-
-       return result;
-}