summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEamon Walsh <ewalsh@epoch.ncsc.mil>2004-05-04 19:41:11 +0000
committerEamon Walsh <ewalsh@epoch.ncsc.mil>2004-05-04 19:41:11 +0000
commit03aa90de4e9db1366da660c15659d15649328a01 (patch)
tree1d577f6979d917c6aa8a3aec5ddb456a228dc778
parent881c7c61455a43fe609f687c542c98ba4aa922e6 (diff)
Merge the new release from HEADXACE-SELINUX
-rw-r--r--cleanlinks.man5
-rw-r--r--imake.c168
-rw-r--r--imakemdep.h14
-rw-r--r--mkhtmlindex.man8
-rw-r--r--mkhtmlindex.pl14
-rw-r--r--mkhtmlindex.sh4
6 files changed, 140 insertions, 73 deletions
diff --git a/cleanlinks.man b/cleanlinks.man
index 403710c..d550ef5 100644
--- a/cleanlinks.man
+++ b/cleanlinks.man
@@ -21,8 +21,9 @@ directory.
.BR lndir (1).
.SH AUTHOR
.PP
-David Dawes wrote the
+The version of the
.I cleanlinks
-program for XFree86.
+included in this X.Org Foundation release was originally written
+by David Dawes wrote as a part of XFree86.
.PP
Colin Watson wrote this manual page, originally for the Debian Project.
diff --git a/imake.c b/imake.c
index 6e3e2f1..49867cc 100644
--- a/imake.c
+++ b/imake.c
@@ -1178,67 +1178,133 @@ get_binary_format(FILE *inFile)
#endif
#if defined(sun) && defined(__SVR4)
+/* Runs Sun compiler command and parses output - this is a bit of a hack
+ * as it depends on the particular output format of the -V flag, but it's
+ * worked for many releases.
+ *
+ * Input : cmd - command to run (called with -V flag)
+ * path - path to command to run (use $PATH if NULL)
+ * Output: cmajor & cminor - major and minor versions if found
+ * Returns: 0 if successful, -1 if not.
+ */
+static int
+ask_sun_compiler_for_versions(const char *cmd, const char *path,
+ int *cmajor, int *cminor)
+{
+ char buf[BUFSIZ];
+ char cmdtorun[PATH_MAX];
+ char* vptr;
+ FILE* ccproc;
+ const char vflag[] = " -V 2>&1";
+ int retval = -1;
+
+ int len = strlen(cmd) + sizeof(vflag);
+
+ if (path != NULL) {
+ len += strlen(path) + 1;
+ }
+
+ if (len < sizeof(cmdtorun)) {
+ if (path != NULL) {
+ sprintf(cmdtorun, "%s/%s %s", path, cmd, vflag);
+ } else {
+ sprintf(cmdtorun, "%s %s", cmd, vflag);
+ }
+
+ if ((ccproc = popen (cmdtorun, "r")) != NULL) {
+ if (fgets (buf, sizeof(buf), ccproc) != NULL) {
+ vptr = strrchr (buf, 'C');
+ if (vptr) {
+ for (; (*vptr != '\0') && !isdigit(*vptr); vptr++) {
+ /* Do nothing - just scanning for first digit */
+ }
+ if (*vptr != '\0') {
+ if (sscanf (vptr, "%d.%d", cmajor, cminor) == 2) {
+ retval = 0;
+ }
+ }
+ }
+ if (retval != 0) {
+ fprintf(stderr,
+ "warning: could not parse version number in output of:\n"
+ " %s\n", cmdtorun);
+ }
+ while (fgets (buf, sizeof(buf), ccproc) != NULL) {};
+ }
+ pclose (ccproc);
+ }
+ }
+ return retval;
+}
+
+/* Find Sun compilers and their versions if present */
static void
get_sun_compiler_versions (FILE *inFile)
{
- char buf[PATH_MAX];
- char cmd[PATH_MAX];
- static char* sunpro_cc = "/opt/SUNWspro/bin/cc";
- static char* sunpro_CC = "/opt/SUNWspro/bin/CC";
- int cmajor, cminor;
- char* vptr;
+ const char* sunpro_path = "/opt/SUNWspro/bin";
+ int cmajor, cminor, found = 0;
struct stat sb;
- FILE* ccproc;
+
+ /* If cross-compiling, only check CrossCompilerDir for compilers.
+ * If not cross-compiling, first check cc in users $PATH,
+ * then try /opt/SUNWspro if not found in the users $PATH
+ */
#if defined CROSSCOMPILE
if (CrossCompiling) {
- int len = strlen(CrossCompileDir);
- len += 3;
- sunpro_cc = (char *) malloc(len);
- sunpro_CC = (char *) malloc(len);
- strcpy(sunpro_cc,CrossCompileDir);
- strcpy(sunpro_CC,CrossCompileDir);
- strcat(sunpro_cc,"/cc");
- strcat(sunpro_CC,"/CC");
- }
-#endif
- if (lstat (sunpro_cc, &sb) == 0) {
- strcpy (cmd, sunpro_cc);
- strcat (cmd, " -V 2>&1");
- if ((ccproc = popen (cmd, "r")) != NULL) {
- if (fgets (buf, PATH_MAX, ccproc) != NULL) {
- vptr = strrchr (buf, 'C');
- for (; !isdigit(*vptr); vptr++);
- (void) sscanf (vptr, "%d.%d", &cmajor, &cminor);
- fprintf (inFile,
- "#define DefaultSunProCCompilerMajorVersion %d\n",
- cmajor);
- fprintf (inFile,
- "#define DefaultSunProCCompilerMinorVersion %d\n",
- cminor);
+ if (ask_sun_compiler_for_versions("cc", CrossCompileDir,
+ &cmajor, &cminor) == 0) {
+ found = 1;
+ }
+ }
+ else
+#endif
+ {
+ if (ask_sun_compiler_for_versions("cc", NULL, &cmajor, &cminor) == 0) {
+ found = 1;
+ } else if (ask_sun_compiler_for_versions("cc", sunpro_path,
+ &cmajor, &cminor) == 0) {
+ found = 1;
+ fprintf(inFile, "#define DefaultSunProCCompilerDir %s", sunpro_path);
}
- while (fgets (buf, PATH_MAX, ccproc) != NULL) {};
- pclose (ccproc);
- }
}
- if (lstat (sunpro_CC, &sb) == 0) {
- strcpy (cmd, sunpro_CC);
- strcat (cmd, " -V 2>&1");
- if ((ccproc = popen (cmd, "r")) != NULL) {
- if (fgets (buf, PATH_MAX, ccproc) != NULL) {
- vptr = strrchr (buf, 'C');
- for (; !isdigit(*vptr); vptr++);
- (void) sscanf (vptr, "%d.%d", &cmajor, &cminor);
- fprintf (inFile,
- "#define DefaultSunProCplusplusCompilerMajorVersion %d\n",
- cmajor);
- fprintf (inFile,
- "#define DefaultSunProCplusplusCompilerMinorVersion %d\n",
- cminor);
+
+ if (found) {
+ fprintf (inFile,
+ "#define DefaultSunProCCompilerMajorVersion %d\n", cmajor);
+ fprintf (inFile,
+ "#define DefaultSunProCCompilerMinorVersion %d\n", cminor);
+ }
+
+ /* Now do it again for C++ compiler (CC) */
+ found = 0;
+#if defined CROSSCOMPILE
+ if (CrossCompiling) {
+ if (ask_sun_compiler_for_versions("CC", CrossCompileDir,
+ &cmajor, &cminor) == 0) {
+ found = 1;
}
- while (fgets (buf, PATH_MAX, ccproc) != NULL) {};
- pclose (ccproc);
- }
+ }
+ else
+#endif
+ {
+ if (ask_sun_compiler_for_versions("CC", NULL, &cmajor, &cminor) == 0) {
+ found = 1;
+ } else if (ask_sun_compiler_for_versions("CC", sunpro_path,
+ &cmajor, &cminor) == 0) {
+ found = 1;
+ fprintf(inFile,
+ "#define DefaultSunProCplusplusCompilerDir %s", sunpro_path);
+ }
+ }
+
+ if (found) {
+ fprintf (inFile,
+ "#define DefaultSunProCplusplusCompilerMajorVersion %d\n",
+ cmajor);
+ fprintf (inFile,
+ "#define DefaultSunProCplusplusCompilerMinorVersion %d\n",
+ cminor);
}
}
#endif
diff --git a/imakemdep.h b/imakemdep.h
index db17752..38a6d95 100644
--- a/imakemdep.h
+++ b/imakemdep.h
@@ -371,11 +371,11 @@ char *cpp_argv[ARGUMENTS] = {
# ifdef __ia64__
"-D__ia64__",
# endif
-# ifdef __AMD64__
- "-D__AMD64__",
+# ifdef __amd64__
+ "-D__amd64__",
# endif
# ifdef __x86_64__
- "-D__AMD64__",
+ "-D__amd64__",
# endif
# ifdef __s390__
"-D__s390__",
@@ -1264,12 +1264,12 @@ struct symtab predefs[] = {
# ifdef __ia64__
{"__ia64__", "1"},
# endif
-# if defined (AMD64) || defined (x86_64)
- {"AMD64", "1"},
+# if defined (amd64) || defined (x86_64)
+ {"amd64", "1"},
{"x86_64", "1"},
# endif
-# if defined (__AMD64__) || defined (__x86_64__)
- {"__AMD64__", "1"},
+# if defined (__amd64__) || defined (__x86_64__)
+ {"__amd64__", "1"},
{"__x86_64__", "1"},
# endif
# ifdef __i386
diff --git a/mkhtmlindex.man b/mkhtmlindex.man
index c673e94..fc8a427 100644
--- a/mkhtmlindex.man
+++ b/mkhtmlindex.man
@@ -20,13 +20,13 @@ section of each page.
.I mkhtmlindex
takes only one argument: the directory to process.
.SH NOTES
-This utility is currently rather specific to XFree86.
+This utility is currently rather specific to X manual pages.
In particular, the format of the index files it outputs is not configurable,
nor is the HTML formatting it expects of manual pages.
.SH AUTHOR
-.PP
-David Dawes wrote the
+The version of the
.I mkhtmlindex
-program for XFree86.
+included in this X.Org Foundation release was originally written
+by David Dawes wrote as a part of XFree86.
.PP
Colin Watson wrote this manual page, originally for the Debian Project.
diff --git a/mkhtmlindex.pl b/mkhtmlindex.pl
index dda3f44..e0c6b78 100644
--- a/mkhtmlindex.pl
+++ b/mkhtmlindex.pl
@@ -43,11 +43,11 @@ foreach $vol (@vollist) {
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
-<TITLE>XFree86[tm] Manual pages: Section $vol</TITLE>
+<TITLE>X.Org Manual pages: Section $vol</TITLE>
</HEAD>
<BODY BGCOLOR="#efefef" TEXT="black" LINK="blue" VLINK="#551A8B" ALINK="red">
-<H1>XFree86[tm] Manual pages: Section $vol</H1>
+<H1>X.Org Manual pages: Section $vol</H1>
<P>
<UL>
EOF
@@ -57,15 +57,15 @@ EOF
open(file, "<$dir/$file") || die "Can't open $dir/$file";
while (<file>) {
chop;
- if (/^<H2>/) {
- if (! /<\/H2>$/) {
- while (<file> && ! /<\/H2>$/) {
+ if (/^<[hH]2>/) {
+ if (! /<\/[hH]2>$/) {
+ while (<file> && ! /<\/[hH]2>$/) {
;
}
}
$heading = "";
while (<file>) {
- if (/^<H2>/) {
+ if (/^<[hH]2>/) {
last;
}
$heading = "$heading" . "$_";
@@ -76,7 +76,7 @@ EOF
($name, $descr) = split(/-/, $heading, 2);
$file =~ /(.*)\.$vol\.html/;
$fname = $1;
- $descr =~ s/<[P]>//g;
+ $descr =~ s/<[pP]>//g;
print mindex
"<LI><A href=\"$file\">$fname</A> - $descr</LI>";
}
diff --git a/mkhtmlindex.sh b/mkhtmlindex.sh
index 539812d..fb3a437 100644
--- a/mkhtmlindex.sh
+++ b/mkhtmlindex.sh
@@ -34,11 +34,11 @@ for s in $VOLLIST; do
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
-<TITLE>XFree86[tm] Manual pages: Section $s</TITLE>
+<TITLE>X.Org Manual pages: Section $s</TITLE>
</HEAD>
<BODY BGCOLOR="#efefef" TEXT="black" LINK="blue" VLINK="#551A8B" ALINK="red">
-<H1>XFree86[tm] Manual pages: Section $s</H1>
+<H1>X.Org Manual pages: Section $s</H1>
<P>
<UL>
EOF