1
0
mirror of https://github.com/Interlisp/maiko.git synced 2026-01-18 09:02:39 +00:00
Interlisp.maiko/inc/lispver1.h
Nick Briggs 4f79f55c20
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.
2021-09-08 09:58:01 -07:00

48 lines
1.1 KiB
C

#ifndef LISPVER1_H
#define LISPVER1_H 1
/* $Id: lispver1.h,v 1.2 1999/01/03 02:06:08 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/* DOS version of LispVersionToUnixVersion */
#define LispVersionToUnixVersion(pathname, ver) \
{ \
\
register char *cp; \
register char *vp; \
char ver_buf[VERSIONLEN]; \
\
cp = pathname; \
vp = NULL; \
while (*cp) \
{ \
switch (*cp) \
{ \
\
case ';': \
*cp = 0; \
cp++; \
vp = cp; \
break; \
\
case '\'': \
if (*(cp + 1) != 0) cp += 2; \
else cp++; \
break; \
\
default: \
cp++; \
break; \
} \
} \
\
if (vp) \
{ \
NumericStringP(vp, YES, NO); \
NO: *vp = 0; \
YES: \
if ((*vp)) ver = strtol(vp, (char **)NULL, 10); \
else ver = -1; \
} \
else ver = -1; \
}
#endif /* LISPVER1_H */