Generify source code
Previously we would fail in some parts of the code if we did not have a premade configuration, now we use any code that was marked as Linux, BSD and Solaris as our basis in order to support building unknown Unix systems.
This commit is contained in:
@@ -38,11 +38,9 @@
|
||||
#include <time.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#if defined(_AIX) || defined(sun) || defined(__linux__) || defined(CSRG_BASED)
|
||||
#include <unistd.h>
|
||||
#include <locale.h>
|
||||
#include <fcntl.h>
|
||||
#endif
|
||||
|
||||
#define MAXHEADLINES 3
|
||||
#define FNAMELEN 513
|
||||
@@ -170,19 +168,11 @@ struct search {
|
||||
EXTERN SEARCH *path INIT(NULL) ;
|
||||
EXTERN SEARCH **endpath INIT(&path) ;
|
||||
EXTERN char dirsep
|
||||
#if defined(_AIX) || defined(sun) || defined(__linux__) || defined(CSRG_BASED)
|
||||
INIT('/')
|
||||
#else
|
||||
****define directory separator here****
|
||||
#endif
|
||||
;
|
||||
|
||||
#if defined(_AIX) || defined(sun) || defined(__linux__) || defined(CSRG_BASED)
|
||||
#define CSEP '/'
|
||||
#define SSEP "/"
|
||||
#else
|
||||
****define directory separator here****
|
||||
#endif
|
||||
|
||||
/* Location in .TEX file of two \wlog messages */
|
||||
EXTERN long wlog ;
|
||||
|
||||
@@ -349,10 +349,7 @@ m_free(string, "GetDefaultHeaderString return");
|
||||
/* construct a qualified file name */
|
||||
static int mb_getqualified(char *qualname, char *unqualname)
|
||||
{
|
||||
#if defined(_AIX) || defined(sun) || defined(__linux__) || defined(CSRG_BASED)
|
||||
|
||||
FILE *f;
|
||||
#endif
|
||||
char fn[FNAMELEN];
|
||||
char tokstr [ 20 ], *gp, *p, *pp, *fnp, curdir[FNAMELEN-1];
|
||||
int roomleft = FNAMELEN - 1;
|
||||
@@ -374,7 +371,6 @@ else
|
||||
|
||||
fnp = fn;
|
||||
|
||||
#if defined(_AIX) || defined(sun) || defined(__linux__) || defined(CSRG_BASED)
|
||||
qualname[0] = '\0';
|
||||
gp = qualname + strlen(qualname);
|
||||
roomleft = roomleft - strlen(qualname);
|
||||
@@ -402,49 +398,6 @@ else
|
||||
strcat(qualname,SSEP);
|
||||
roomleft--;
|
||||
}
|
||||
#else
|
||||
/* if MS-DOS, force to upper case, then get drive spec */
|
||||
strupr ( fn );
|
||||
if ( fn[1] == ':' ) {
|
||||
strncpy ( qualname, fn, 2 );
|
||||
fnp += 2;
|
||||
}
|
||||
else {
|
||||
getcwd(qualname, roomleft);
|
||||
}
|
||||
qualname[2] = '\0';
|
||||
gp = qualname + strlen ( qualname );
|
||||
roomleft = roomleft - strlen ( qualname );
|
||||
/* if path is from root, tack that on, else tack on the current
|
||||
directory (for the referenced drive, if MS-DOS) */
|
||||
if ( *fnp == CSEP ) {
|
||||
strcat ( qualname, SSEP );
|
||||
roomleft--;
|
||||
++fnp;
|
||||
}
|
||||
else {
|
||||
/* assume current directory always !!! */
|
||||
*gp = CSEP;
|
||||
getcwd(curdir, FNAMELEN-1);
|
||||
if (*curdir != *qualname) {
|
||||
m_err1("Relative directory %s for non-current drive, can't qualify",
|
||||
unqualname);
|
||||
return (-1);
|
||||
}
|
||||
if (strlen(curdir) > 3) {
|
||||
if ((strlen(curdir+3)+1) < roomleft) { /* "1" for SSEP */
|
||||
strcpy( gp+1, curdir+3 );
|
||||
strcat ( qualname, SSEP );
|
||||
roomleft = roomleft - strlen(curdir+3) - 1; /* "1" for SSEP */
|
||||
}
|
||||
else {
|
||||
m_err1("Internal error. File name too long for qualifying: %s",
|
||||
unqualname);
|
||||
return (-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
strcpy(tokstr, " \r\n\t");
|
||||
strcat(tokstr, SSEP);
|
||||
@@ -488,11 +441,6 @@ do {
|
||||
while (1);
|
||||
*strrchr(qualname, CSEP) = '\0';
|
||||
|
||||
#if defined(_AIX) || defined(sun) || defined(__linux__) || defined(CSRG_BASED)
|
||||
#else
|
||||
strupr ( qualname );
|
||||
#endif
|
||||
|
||||
return ( 0 );
|
||||
} /* end mb_getqualified */
|
||||
|
||||
|
||||
@@ -350,9 +350,7 @@ m_free(string, "GetDefaultHeaderString return");
|
||||
/* construct a qualified file name */
|
||||
static int mb_getqualified(char *qualname, char *unqualname)
|
||||
{
|
||||
#if defined(_AIX) || defined(sun) || defined(__linux__) || defined(CSRG_BASED)
|
||||
FILE *f;
|
||||
#endif
|
||||
char fn[FNAMELEN];
|
||||
char tokstr [ 20 ], *gp, *p, *pp, *fnp, curdir[FNAMELEN-1];
|
||||
int roomleft = FNAMELEN - 1;
|
||||
@@ -374,7 +372,6 @@ else
|
||||
|
||||
fnp = fn;
|
||||
|
||||
#if defined(_AIX) || defined(sun) || defined(__linux__) || defined(CSRG_BASED)
|
||||
qualname[0] = '\0';
|
||||
gp = qualname + strlen(qualname);
|
||||
roomleft = roomleft - strlen(qualname);
|
||||
@@ -402,49 +399,6 @@ else
|
||||
strcat(qualname,SSEP);
|
||||
roomleft--;
|
||||
}
|
||||
#else
|
||||
/* if MS-DOS, force to upper case, then get drive spec */
|
||||
strupr ( fn );
|
||||
if ( fn[1] == ':' ) {
|
||||
strncpy ( qualname, fn, 2 );
|
||||
fnp += 2;
|
||||
}
|
||||
else {
|
||||
getcwd(qualname, roomleft);
|
||||
}
|
||||
qualname[2] = '\0';
|
||||
gp = qualname + strlen ( qualname );
|
||||
roomleft = roomleft - strlen ( qualname );
|
||||
/* if path is from root, tack that on, else tack on the current
|
||||
directory (for the referenced drive, if MS-DOS) */
|
||||
if ( *fnp == CSEP ) {
|
||||
strcat ( qualname, SSEP );
|
||||
roomleft--;
|
||||
++fnp;
|
||||
}
|
||||
else {
|
||||
/* assume current directory always !!! */
|
||||
*gp = CSEP;
|
||||
getcwd(curdir, FNAMELEN-1);
|
||||
if (*curdir != *qualname) {
|
||||
m_err1("Relative directory %s for non-current drive, can't qualify",
|
||||
unqualname);
|
||||
return (-1);
|
||||
}
|
||||
if (strlen(curdir) > 3) {
|
||||
if ((strlen(curdir+3)+1) < roomleft) { /* "1" for SSEP */
|
||||
strcpy( gp+1, curdir+3 );
|
||||
strcat ( qualname, SSEP );
|
||||
roomleft = roomleft - strlen(curdir+3) - 1; /* "1" for SSEP */
|
||||
}
|
||||
else {
|
||||
m_err1("Internal error. File name too long for qualifying: %s",
|
||||
unqualname);
|
||||
return (-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
strcpy(tokstr, " \r\n\t");
|
||||
strcat(tokstr, SSEP);
|
||||
@@ -488,11 +442,6 @@ do {
|
||||
while (1);
|
||||
*strrchr(qualname, CSEP) = '\0';
|
||||
|
||||
#if defined(_AIX) || defined(sun) || defined(__linux__) || defined(CSRG_BASED)
|
||||
#else
|
||||
strupr ( qualname );
|
||||
#endif
|
||||
|
||||
return ( 0 );
|
||||
} /* end mb_getqualified */
|
||||
|
||||
|
||||
@@ -38,11 +38,9 @@
|
||||
#include <time.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#if defined(_AIX) || defined(sun) || defined(__linux__) || defined(CSRG_BASED)
|
||||
#include <unistd.h>
|
||||
#include <locale.h>
|
||||
#include <fcntl.h>
|
||||
#endif
|
||||
|
||||
#ifndef MB_MAX_LEN
|
||||
#define MB_MAX_LEN 4
|
||||
|
||||
Reference in New Issue
Block a user