*/
#include <mit-copyright.h>
+#include <string.h>
#include <stdio.h>
#include <ctype.h>
#include <des.h>
char *whoami;
int duplicate, errors;
-extern char *index();
extern char *FixCase(), *RemoveHyphens(), *strtrim();
extern int errno;
int usercheck(), scream();
/* 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++;
#include <stdio.h>
#include <ctype.h>
-#include <strings.h>
+#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <moira.h>
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);
} 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);
/* $Header$ */
#include <stdio.h>
-#include <strings.h>
+#include <string.h>
#include <X11/StringDefs.h>
#include <X11/IntrinsicP.h>
#include <X11/Shell.h>
if (current->type == FT_KEYWORD) {
char *p;
- p = index(current->prompt, '|');
+ p = strchr(current->prompt, '|');
if (p) {
*p++ = 0;
current->keyword_name = p;
#include <mit-copyright.h>
#include <stdio.h>
-#include <strings.h>
+#include <string.h>
#include <pwd.h>
#include <moira.h>
#include <com_err.h>
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++;
*/
#include <stdio.h>
-#include <strings.h>
+#include <string.h>
#include <ctype.h>
#include <moira.h>
#include <moira_site.h>
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);
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] = "";
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] = "";
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:
** 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>
#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$";
} 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);
#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"
sleep(10);
#endif /* DEBUG */
+#ifndef POSIX
ioctl(0, TIOCFLUSH, &arg);
+#endif
ioctl(0, TIOCGETP, &otty);
ntty = otty;
ntty.sg_flags |= RAW;
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";
/* 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
StoreField(f, i, "");
break;
case FT_KEYWORD:
- k = index(p->prompt, '|');
+ k = strchr(p->prompt, '|');
if (k) *k = 0;
done = 0;
while (done != 1) {
#include <stdio.h>
#include <gdb.h>
#include <ctype.h>
+#include <string.h>
#include <sys/param.h>
#include <sys/file.h>
#include <fcntl.h>
}
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);
}
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) {
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);
#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"
gdb_debug(GDB_NOFORK);
#endif /* DEBUG */
- whoami = rindex(argv[0], '/');
+ whoami = strrchr(argv[0], '/');
if (whoami)
whoami++;
else
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
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++) {