strrchr() instead.
(setbuffer): Obsolete BSDism, unused; remove.
include ../make.defs
CFILES = bit.c dtable.c expect.c globals.c handle.c host.c \
- hpux.c ioqueue.c ipglob.c login.c main.c queue.c saveargv.c \
+ ioqueue.c ipglob.c login.c main.c queue.c saveargv.c \
servcmd.c serverio.c tags.c termio.c termlib.c
OFILES = bit.o dtable.o expect.o globals.o handle.o host.o \
- hpux.o ioqueue.o ipglob.o login.o main.o queue.o saveargv.o \
+ ioqueue.o ipglob.o login.o main.o queue.o saveargv.o \
servcmd.o serverio.o tags.o termio.o termlib.o
OBJFILES = bit.obj dtable.obj expect.obj globals.obj handle.obj host.obj \
hpux.obj ioqueue.obj ipglob.obj login.obj main.obj queue.obj saveargv.obj \
}
size -= n;
ptr[n] = '\0';
- } while ((p = index(ptr, '\n')) == 0);
+ } while ((p = strchr(ptr, '\n')) == 0);
newline = 1 + p - buf;
*p = 0;
} else
+++ /dev/null
-/*
- * Empire - A multi-player, client/server Internet based war game.
- * Copyright (C) 1986-2000, Dave Pare, Jeff Bailey, Thomas Ruschak,
- * Ken Stevens, Steve McClure
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * ---
- *
- * See the "LEGAL", "LICENSE", "CREDITS" and "README" files for all the
- * related information and legal notices. It is expected that any future
- * projects/authors will amend these files as needed.
- *
- * ---
- *
- * hpux.c: hpux dependencies
- *
- * Known contributors to this file:
- *
- */
-
-#ifdef hpux
-#include <memory.h>
-#define NULL 0
-#include "misc.h"
-
-s_char *
-rindex(sp, c)
-register s_char *sp;
-register int c;
-{
- register s_char *r;
-
- r = NULL;
- do {
- if (*sp == c)
- r = sp;
- } while (*sp++);
- return r;
-}
-
-s_char *
-index(sp, c)
-register s_char *sp;
-register int c;
-{
- do {
- if (*sp == c)
- return (sp);
- } while (*sp++);
- return NULL;
-}
-
-#endif
#include <ctype.h>
#include <stdio.h>
+#include <string.h>
#if !defined(_WIN32)
#include <unistd.h>
#endif
}
for (ptr = buf; !isspace(*ptr); ptr++) ;
ptr++;
- p = index(ptr, '\n');
+ p = strchr(ptr, '\n');
if (p != 0)
*p = 0;
if (atoi(ptr) != CLIENTPROTO) {
void ioq_drain();
-#ifdef _WIN32
-s_char *
-index(str, c)
-s_char *str;
-char c;
-{
- static s_char *p;
-
- p = str;
- while (p && *p) {
- if (*p == c)
- return (s_char *)p;
- p++;
- }
- return (s_char *)0;
-}
-
-#endif
-
int
main(ac, av)
int ac;
extern s_char *ctime();
extern s_char *strncpy();
extern s_char *strcpy();
-#ifndef NeXT
-extern s_char *index();
-extern s_char *rindex();
-#endif /* NeXT */
#endif /* !aix && !sgi */
extern time_t time();
char *_ipglob_copyright_header =
"/*\n * Empire - A multi-player, client/server Internet based war game.\n * Copyright (C) 1986-2000, Dave Pare, Jeff Bailey, Thomas Ruschak,\n * Ken Stevens, Steve McClure\n *\n * This program is free software; you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation; either version 2 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program; if not, write to the Free Software\n * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\n *\n * ---\n *\n * See the \"LEGAL\", \"LICENSE\", \"CREDITS\" and \"README\" files for all the\n * related information and legal notices. It is expected that any future\n * projects/authors will amend these files as needed.\n *\n * ---\n *\n * ipglob.c: This is an auto-generated file.\n * \n * Known contributors to this file:\n * Automatically generated by doconfig.c\n */\n\n";
-#if defined(_WIN32)
-char *
-rindex(char *path, char c)
-{
- int i;
- char *cp;
-
- i = strlen(path);
- cp = &path[i - 1];
-
- while (i) {
- if (*cp == c)
- return cp;
- i--;
- cp--;
- }
- return (char *)0;
-}
-
-char *
-index(char *path, char c)
-{
- int i;
- char *cp;
-
- cp = &path[0];
-
- i = 0;
- while (path[i]) {
- if (*cp == c)
- return cp;
- i++;
- cp++;
- }
- return (char *)0;
-}
-
-#endif
int
main()
exit(-1);
}
#if !defined(_WIN32)
- cp = (char *)rindex(pathname, '/');
+ cp = strrchr(pathname, '/');
*cp = '\0';
- cp = (char *)rindex(pathname, '/');
+ cp = strrchr(pathname, '/');
*cp = '\0';
#else
- cp = (char *)rindex(pathname, '\\');
+ cp = strrchr(pathname, '\\');
*cp = '\0';
- cp = (char *)rindex(pathname, '\\');
+ cp = strrchr(pathname, '\\');
*cp = '\0';
#endif
printf("Configuring...\n");
strcpy(buf, EF);
if (strlen(buf) > 0)
c = buf[strlen(buf) - 1];
- if (index("dhm", c) && strlen(buf) > 0) {
+ if (strchr("dhm", c) && strlen(buf) > 0) {
s_p_etu = atoi(buf);
if (c == 'd')
s_p_etu =
*/
#include <ctype.h>
+#include <string.h>
#include "misc.h"
#include "player.h"
#include "var.h"
getstarg(player->argp[3], "pinpoint, or strategic? ", buf)) == 0)
return RET_SYN;
mission = *p;
- if (index("ps", mission) == 0)
+ if (strchr("ps", mission) == 0)
return RET_SYN;
if ((p = getstarg(player->argp[4], "assembly point? ", buf)) == 0
|| *p == 0)
/*
* don't let sneaky people go outside the info directory
*/
- else if (NULL != (bp = rindex(player->argp[1], '/')))
+ else if (NULL != (bp = strrchr(player->argp[1], '/')))
bp++;
else
bp = player->argp[1];
* don't let sneaky people go outside the info directory
*/
bp = player->argp[1];
- if (NULL != (bp2 = rindex(bp, '/')))
+ if (NULL != (bp2 = strrchr(bp, '/')))
bp = ++bp2;
- if (NULL != (bp2 = rindex(bp, '\\')))
+ if (NULL != (bp2 = strrchr(bp, '\\')))
bp = ++bp2;
- if (NULL != (bp2 = rindex(bp, ':')))
+ if (NULL != (bp2 = strrchr(bp, ':')))
bp = ++bp2;
if (!*bp)
bp = "TOP";
*/
#include <ctype.h>
+#include <string.h>
#include "misc.h"
#include "player.h"
#include "file.h"
yorg = natp->nat_yorg;
if (!(cp = getstarg(player->argp[1], "sector or nation? ", buf)))
return RET_SYN;
- if (index(cp, ',')) { /* x, y pair for offset */
+ if (strchr(cp, ',')) { /* x, y pair for offset */
if (!sarg_xy(cp, &dx, &dy)) {
pr("Bad sector designation.\n");
return RET_SYN;
#include "gen.h"
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#include <ctype.h>
#include "common.h"
/* Allow for comments.. any line starting with # */
if (buf[0] == '#')
continue;
- p = rindex(buf, '\n');
+ p = strrchr(buf, '\n');
if (p != 0)
*p = 0;
- if ((p = index(buf, ':')) == 0) {
+ if ((p = strchr(buf, ':')) == 0) {
logerror("kw_read: Bad keyword line #%d\n", n);
return 0;
}
text = get_time(text, &data[0]);
break;
case CF_TIMERANGE:
- if ((next = index(text, '-')) == 0)
+ if ((next = strchr(text, '-')) == 0)
return 0;
next++;
if ((text = get_time(text, &data[0])) == 0)
loginit();
va_start(list, format);
vsprintf(buf, format, list);
- if ((p = index(buf, '\n')) != 0)
+ if ((p = strchr(buf, '\n')) != 0)
*p = 0;
(void)time(&now);
strcpy(cbuf, ctime(&now));
- if ((p = index(cbuf, '\n')) != 0)
+ if ((p = strchr(cbuf, '\n')) != 0)
*p = 0;
(void)sprintf(buf1, "%s %s\n", cbuf, buf);
if ((logf = open(logfile, O_WRONLY | O_CREAT | O_APPEND, 0666)) < 0)
NTLIB = $(SRCDIR)\lib\libgen.lib
OBJS = atoip.o bit.o chance.o copy.o disassoc.o dtable.o \
- emp_config.o getstarg.o getstring.o hpux.o inet.o io.o \
+ emp_config.o getstarg.o getstring.o inet.o io.o \
io_mask.o ioqueue.o lock.o mapdist.o minmax.o numstr.o onearg.o \
parse.o plur.o queue.o round.o scthash.o \
strdup.o
NTOBJS = atoip.obj bit.obj chance.obj copy.obj disassoc.obj dtable.obj \
- emp_config.obj getstarg.obj getstring.obj hpux.obj \
+ emp_config.obj getstarg.obj getstring.obj \
inet.obj io.obj io_mask.obj ioqueue.obj lock.obj mapdist.obj minmax.obj \
numstr.obj onearg.obj parse.obj plur.obj queue.obj round.obj \
scthash.obj strdup.obj
+++ /dev/null
-/*
- * Empire - A multi-player, client/server Internet based war game.
- * Copyright (C) 1986-2000, Dave Pare, Jeff Bailey, Thomas Ruschak,
- * Ken Stevens, Steve McClure
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * ---
- *
- * See the "LEGAL", "LICENSE", "CREDITS" and "README" files for all the
- * related information and legal notices. It is expected that any future
- * projects/authors will amend these files as needed.
- *
- * ---
- *
- * hpux.c: Things specific to hpux
- *
- * Known contributors to this file:
- *
- */
-
-#include "misc.h"
-
-#ifdef hpux
-#include <stdio.h>
-
-setbuffer(fp, buf, size)
-FILE *fp;
-s_char *buf;
-int size;
-{
- if (size > BUFSIZ)
- setbuf(fp, buf);
- /* XXX else report error */
-}
-
-s_char *
-rindex(sp, c)
-register s_char *sp;
-register int c;
-{
- register s_char *r;
-
- r = NULL;
- do {
- if (*sp == c)
- r = sp;
- } while (*sp++);
- return r;
-}
-
-s_char *
-index(sp, c)
-register s_char *sp;
-register int c;
-{
- do {
- if (*sp == c)
- return (sp);
- } while (*sp++);
- return NULL;
-}
-
-#endif
if (pl->curid == -1) {
outid(pl, id);
}
- p = index(bp, '\n');
+ p = strchr(bp, '\n');
if (p != 0) {
len = (p - bp) + 1;
if (pl->command && (pl->command->c_flags & C_MOD))
*/
#include <ctype.h>
+#include <string.h>
#include "misc.h"
#include "player.h"
#include "xy.h"
return NS_DIST;
if (c == '*')
return NS_ALL;
- if (c == '#' || index(ptr, ',') != 0)
+ if (c == '#' || strchr(ptr, ',') != 0)
return NS_AREA;
if (isdigit(c))
return NS_LIST;