mirror of
https://github.com/Interlisp/maiko.git
synced 2026-02-01 22:32:40 +00:00
Replace uses of atoi() with strtol() or stroul() as appropriate (#394)
As a side-effect of this change, we also resolve a a problem with signed file version numbers, so that instead of version 2147483647 wrapping to -2147483648 we can go as far as 4294967296 before we have issues. Various sprintf() formats get changed from %d to %u. The DOS version code is left behind as int versions.
This commit is contained in:
@@ -247,14 +247,35 @@ void close_unix_descriptors(void) /* Get ready to shut Maiko down */
|
||||
|
||||
int FindUnixPipes(void) {
|
||||
char *envtmp;
|
||||
int inttmp;
|
||||
struct unixjob cleareduj;
|
||||
|
||||
DBPRINT(("Entering FindUnixPipes\n"));
|
||||
UnixPipeIn = UnixPipeOut = StartTime = UnixPID = -1;
|
||||
if ((envtmp = getenv("LDEPIPEIN"))) UnixPipeIn = atoi(envtmp);
|
||||
if ((envtmp = getenv("LDEPIPEOUT"))) UnixPipeOut = atoi(envtmp);
|
||||
if ((envtmp = getenv("LDESTARTTIME"))) StartTime = atoi(envtmp);
|
||||
if ((envtmp = getenv("LDEUNIXPID"))) UnixPID = atoi(envtmp);
|
||||
if ((envtmp = getenv("LDEPIPEIN"))) {
|
||||
errno = 0;
|
||||
inttmp = (int)strtol(envtmp, (char **)NULL, 10);
|
||||
if (errno == 0)
|
||||
UnixPipeIn = inttmp;
|
||||
}
|
||||
if ((envtmp = getenv("LDEPIPEOUT"))) {
|
||||
errno = 0;
|
||||
inttmp = (int)strtol(envtmp, (char **)NULL, 10);
|
||||
if (errno == 0)
|
||||
UnixPipeOut = inttmp;
|
||||
}
|
||||
if ((envtmp = getenv("LDESTARTTIME"))) {
|
||||
errno = 0;
|
||||
inttmp = (int)strtol(envtmp, (char **)NULL, 10);
|
||||
if (errno == 0)
|
||||
StartTime = inttmp;
|
||||
}
|
||||
if ((envtmp = getenv("LDEUNIXPID"))) {
|
||||
errno = 0;
|
||||
inttmp = (int)strtol(envtmp, (char **)NULL, 10);
|
||||
if (errno == 0)
|
||||
UnixPID = inttmp;
|
||||
}
|
||||
|
||||
/* This is a good place to initialize stuff like the UJ table */
|
||||
NPROCS = sysconf(_SC_OPEN_MAX);
|
||||
|
||||
Reference in New Issue
Block a user