]> andersk Git - moira.git/commitdiff
posixify source
authormar <mar>
Mon, 25 Oct 1993 16:35:24 +0000 (16:35 +0000)
committermar <mar>
Mon, 25 Oct 1993 16:35:24 +0000 (16:35 +0000)
clients/addusr/addusr.c
clients/mmoira/form_setup.c
clients/mmoira/formup.c
clients/mmoira/main.c
clients/mmoira/queries.c
clients/mmoira/stubs.c
clients/mmoira/tty.c
update/get_file.c
update/update_server.c

index 13e52dddad7a583408cecbdbd85f84bb234a43d3..5554fe7eea8d0dc982938da49494978fa4f9ee8f 100644 (file)
@@ -12,6 +12,7 @@
  */
 
 #include <mit-copyright.h>
+#include <string.h>
 #include <stdio.h>
 #include <ctype.h>
 #include <des.h>
@@ -33,7 +34,6 @@ int reg_only, reg, verbose, nodupcheck;
 char *whoami;
 int duplicate, errors;
 
-extern char *index();
 extern char *FixCase(), *RemoveHyphens(), *strtrim();
 extern int errno;
 int usercheck(), scream();
@@ -172,7 +172,7 @@ char **argv;
        /* Last name is first thing on line */
        last = buf;
        /* First name follows a comma */
-       p = index(last, ',');
+       p = strchr(last, ',');
        if (!p) {
            com_err(whoami, MR_BAD_CHAR, "Missing comma on line %d", lineno);
            errors++;
index a8a03687c21274e38e20fc1f5bd4b6066a3c6087..07474e0cf8fb13a2ba7dc9279e43fdf36263fe1f 100644 (file)
@@ -3,7 +3,7 @@
 
 #include <stdio.h>
 #include <ctype.h>
-#include <strings.h>
+#include <string.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <moira.h>
@@ -184,7 +184,7 @@ UserPrompt *prompt;
            path = "???";
            i = MoiraQuery("get_alias", 3, argv, GetAliasValue, &path);
            if (i == MR_SUCCESS) {
-               p = index(path, ':');
+               p = strchr(path, ':');
                if (p) {
                    *p = 0;
                    depth = atoi(++p);
@@ -253,7 +253,7 @@ UserPrompt *prompt;
                } else if (!strcmp(info[FS_TYPE], "NFS")) {
                    argv[0] = strsave(info[FS_MACHINE]);
                    argv[1] = strsave(info[FS_PACK]);
-                   p = rindex(argv[1], '/');
+                   p = strrchr(argv[1], '/');
                    if (p) *p = 0;
                    for (i = 0; info[i]; i++) free(info[i]);
                    free(info);
index 9051a280d45b61b1e1b4584022c8b874c966cc89..cabf9265b5d9f34e8e1ac9a1d7cdf7f2ca0e6204 100644 (file)
@@ -1,7 +1,7 @@
 /* $Header$ */
 
 #include       <stdio.h>
-#include       <strings.h>
+#include       <string.h>
 #include       <X11/StringDefs.h>
 #include       <X11/IntrinsicP.h>
 #include       <X11/Shell.h>
@@ -310,7 +310,7 @@ EntryForm   *spec;
                if (current->type == FT_KEYWORD) {
                    char *p;
 
-                   p = index(current->prompt, '|');
+                   p = strchr(current->prompt, '|');
                    if (p) {
                        *p++ = 0;
                        current->keyword_name = p;
index d2e8a2123a9562c38de77c61ec352ab68c399c63..6afffe43f4191cddbe25c8c0ddbd9e682f88db47 100644 (file)
@@ -8,7 +8,7 @@
 
 #include       <mit-copyright.h>
 #include       <stdio.h>
-#include       <strings.h>
+#include       <string.h>
 #include       <pwd.h>
 #include       <moira.h>
 #include       <com_err.h>
@@ -95,7 +95,7 @@ char *argv[];
          user = getpwuid((int) getuid())->pw_name;
        user = (user && strlen(user)) ? strsave(user) : "";
 
-       if ((program_name = rindex(argv[0], '/')) == NULL)
+       if ((program_name = strrchr(argv[0], '/')) == NULL)
          program_name = argv[0];
        else
          program_name++;
index c29c52c7d84b47366025a10df33401a99b649f5b..3049076aa337f273cc215535668c5b84d5fc69b8 100644 (file)
@@ -2,7 +2,7 @@
  */
 
 #include <stdio.h>
-#include <strings.h>
+#include <string.h>
 #include <ctype.h>
 #include <moira.h>
 #include <moira_site.h>
@@ -510,7 +510,7 @@ int remove;
        break;
     case MM_MOV_FSGROUP:
        argv[1] = strsave(stringval(form, 1));
-       s = index(argv[1], ' ');
+       s = strchr(argv[1], ' ');
        if (s) *s = 0;
        i = MoiraQuery("remove_filesys_from_fsgroup", 2, argv, ModifyCallback,
                       (char *)form);
@@ -523,10 +523,10 @@ int remove;
     case MM_ADD_FSGROUP:
        /* find the two keys to sort between */
        argv[2] = strsave(argv[2]);
-       s = index(argv[2], ' ');
+       s = strchr(argv[2], ' ');
        if (s) {
            argv[2] = s+2;
-           s = index(argv[2], ')');
+           s = strchr(argv[2], ')');
            if (s) *s = 0;
        } else
          argv[2] = "";
@@ -546,10 +546,10 @@ int remove;
                    i++;
                    if (i < NumChildren(w)) {
                        argv[3] = strsave(XtName(NthChild(w, i)));
-                       s = index(argv[3], ' ');
+                       s = strchr(argv[3], ' ');
                        if (s) {
                            argv[3] = s+2;
-                           s = index(argv[3], ')');
+                           s = strchr(argv[3], ')');
                            if (s) *s = 0;
                        } else
                          argv[3] = "";
@@ -586,7 +586,7 @@ int remove;
        break;
     case MM_DEL_FSGROUP:
        argv[1] = strsave(stringval(form, 1));
-       s = index(argv[1], ' ');
+       s = strchr(argv[1], ' ');
        if (s) *s = 0;
        break;
     case MM_SHOW_FS_ALIAS:
index 5fb155770f3f0fce62139010703b044f80a81869..4d9d9ca47a914b35e85ac42787e978d105f0b04e 100644 (file)
@@ -2,8 +2,12 @@
 ** Stub functions
 */
 
+#ifdef POSIX
+#include       <unistd.h>
+#endif
 #include       <ctype.h>
 #include       <stdio.h>
+#include       <string.h>
 #include       <X11/StringDefs.h>
 #include       <X11/Intrinsic.h>
 #include       <X11/Core.h>
@@ -11,7 +15,9 @@
 #include        <Xm/Text.h>
 #include       <Xm/MessageB.h>
 #include       "mmoira.h"
+#include       <sys/types.h>
 #include       <sys/file.h>
+#include       <fcntl.h>
 
 static char rcsid[] = "$Header$";
 
@@ -196,7 +202,7 @@ int modify;
     } else if (!strcmp(type, "Packname")) {
        char name2[256];
        sprintf(name2, "%s:%s", type2, name);
-       p = rindex(name2, '/');
+       p = strrchr(name2, '/');
        if (p) *p = 0;
        DoReference(name, "select_nfs", MM_MOD_NFS, MM_SHOW_NFS,
                    "get_nfsphys", modify);
index 400cd4ef092a605a39bed27aeb8341fc724ae86b..a91dba24aa9a0daa1d5a9445afe24f9a472d5655 100644 (file)
@@ -8,12 +8,12 @@
 
 #include       <mit-copyright.h>
 #include       <stdio.h>
+#include       <string.h>
 #include       <sys/types.h>
 #include       <sys/signal.h>
 #include       <sgtty.h>
 #include       <sys/ioctl.h>
 #include       <ctype.h>
-#include       <strings.h>
 #include       <X11/Intrinsic.h>
 #include       <moira.h>
 #include       "mmoira.h"
@@ -45,7 +45,9 @@ TtyMainLoop()
     sleep(10);
 #endif /* DEBUG */
 
+#ifndef POSIX
     ioctl(0, TIOCFLUSH, &arg);
+#endif
     ioctl(0, TIOCGETP, &otty);
     ntty = otty;
     ntty.sg_flags |= RAW;
@@ -85,7 +87,7 @@ parse_menus()
 
     TtyCommands = (struct parse_node *)malloc(sizeof(struct parse_node) *
                                              NumMenus * 3);
-    bzero(TtyCommands, sizeof(struct parse_node) * NumMenus * 3);
+    memset(TtyCommands, 0, sizeof(struct parse_node) * NumMenus * 3);
     arg = 0;
     parse_menu_recursive(&MenuRoot, "", &arg);
     TtyCommands[arg].p_word = "help";
@@ -119,10 +121,10 @@ int *i;
        /* insert command into parse tree */
        p = TtyRoot;
        prev = (struct parse_node **) &TtyRoot;
-       for (word = cmd; word; word = index(word, ' ')) {
+       for (word = cmd; word; word = strchr(word, ' ')) {
            if (*word == ' ')
              word++;
-           s = index(word, ' ');
+           s = strchr(word, ' ');
            if (s)
              len = s - word;
            else
@@ -253,7 +255,7 @@ EntryForm *f;
              StoreField(f, i, "");
            break;
        case FT_KEYWORD:
-           k = index(p->prompt, '|');
+           k = strchr(p->prompt, '|');
            if (k) *k = 0;
            done = 0;
            while (done != 1) {
index 627e4f9b8c4935262923569897c8235f15a65240..17a2f97b60bbd4325d6cbf9b6d67696c3961b4ad 100644 (file)
@@ -14,6 +14,7 @@ static char *rcsid_get_file_c = "$Header$";
 #include <stdio.h>
 #include <gdb.h>
 #include <ctype.h>
+#include <string.h>
 #include <sys/param.h>
 #include <sys/file.h>
 #include <fcntl.h>
@@ -87,7 +88,11 @@ get_file(pathname, file_size, checksum, mode, encrypt)
     }
     if (done)                  /* re-initialize data */
        initialize();
+#ifdef POSIX
+    if (setuid(uid) < 0) {
+#else
     if (setreuid(0, uid) < 0) {
+#endif
        com_err(whoami, errno, "Unable to setuid to %d\n", uid);
        exit(1);
     }
@@ -141,7 +146,7 @@ get_file(pathname, file_size, checksum, mode, encrypt)
                session[4], session[5], session[6], session[7]);
 #endif /* DEBUG */
        des_key_sched(session, sched);
-       bcopy(session, ivec, sizeof(ivec));
+       memcpy(ivec, session, sizeof(ivec));
     }
     n_written = 0;
     while (n_written < file_size && code == 0) {
@@ -219,7 +224,7 @@ get_block(fd, max_size, encrypt)
        des_pcbc_encrypt(src, dst, n, sched, ivec, 1);
        for (i = 0; i < 8; i++)
          ivec[i] = src[n - 8 + i] ^ dst[n - 8 + i];
-       bcopy(dst, STRING_DATA(data), n);
+       memcpy(STRING_DATA(data), dst, n);
     }
 
     n_read = MIN(MAX_STRING_SIZE(data), max_size);
index 9f45d8701d1660f2b1be3376cd0baf26beb8129d..54c162e1a866e8ff6b41238e7088b6fb50825321 100644 (file)
@@ -14,13 +14,13 @@ static char *rcsid_dispatch_c = "$Header$";
 #include <stdio.h>
 #include <gdb.h>
 #include <errno.h>
-#include <strings.h>
+#include <string.h>
 #include <pwd.h>
 #include <moira.h>
 #include <sys/file.h>
 #include <fcntl.h>
 #include <sys/ioctl.h>
-#ifdef SOLARIS
+#ifdef POSIX
 #include <termios.h>
 #endif
 #include "update.h"
@@ -82,7 +82,7 @@ main(argc, argv)
      gdb_debug(GDB_NOFORK);
 #endif /* DEBUG */
 
-     whoami = rindex(argv[0], '/');
+     whoami = strrchr(argv[0], '/');
      if (whoami)
         whoami++;
      else
@@ -98,11 +98,15 @@ main(argc, argv)
      if (!config_lookup("nofork")) {
         if (fork())
           exit(0);
+#ifdef POSIX
+        setsid();
+#else
         n = open("/dev/tty", O_RDWR|FNDELAY);
         if (n > 0) {
             (void) ioctl(n, TIOCNOTTY, (char *)NULL);
             (void) close(n);
         }
+#endif
      } else
        gdb_debug(GDB_NOFORK);
 #endif
@@ -163,7 +167,7 @@ main(argc, argv)
              sever_connection(conn);
              exit(1);
          }
-         cp = index(STRING_DATA(str), ' ');
+         cp = strchr(STRING_DATA(str), ' ');
          if (cp)
               *cp = '\0';
          for (d = dispatch_table; d->str; d++) {
This page took 1.003736 seconds and 5 git commands to generate.