bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Small patch to get bash 2.05b compiling on HP/UX 11.00


From: Petter Reinholdtsen
Subject: Small patch to get bash 2.05b compiling on HP/UX 11.00
Date: Tue, 24 Sep 2002 16:34:28 +0200

Here is a small patch to get bash 2.05b to compile on HP/UX 11.00
using the bundeled K/R C compiler.  The compiler is not very good, but
it is the one I have access to at the moment.

 - Suffix #UL is not supported.  Use ((unsigned long)(#)) instead.

 - It failes with 'unexpected character "}"' (or something similar if
   a goto target is followed by '}'.  Adding 'return;' fixed the
   problem.

 - The character constant '\a' is unknown.  Using ASCII #7 instead.

 - Keyword 'const' is not handled.  Make sure "config.h" is included
   to get the replacement define.

diff -ur src-2.05b/lib/malloc/malloc.c src-2.05b-local/lib/malloc/malloc.c
--- src-2.05b/lib/malloc/malloc.c       2002-06-21 21:16:49.000000000 +0200
+++ src-2.05b-local/lib/malloc/malloc.c 2002-09-24 15:52:58.000000000 +0200
@@ -231,12 +231,19 @@
 
 static char *memtop;   /* top of heap */
 
+/*
+ * The cc bundled with HP/UX 11.00 do not handle UL.  Using this define
+ * instead.
+ */
+#define UL(n) ((unsigned long)(n))
+
 static unsigned long binsizes[NBUCKETS] = {
-       8UL, 16UL, 32UL, 64UL, 128UL, 256UL, 512UL, 1024UL, 2048UL, 4096UL,
-       8192UL, 16384UL, 32768UL, 65536UL, 131072UL, 262144UL, 524288UL,
-       1048576UL, 2097152UL, 4194304UL, 8388608UL, 16777216UL, 33554432UL,
-       67108864UL, 134217728UL, 268435456UL, 536870912UL, 1073741824UL,
-       2147483648UL, 4294967296UL-1
+       UL(8), UL(16), UL(32), UL(64), UL(128), UL(256), UL(512), UL(1024), 
UL(2048), UL(4096),
+       UL(8192), UL(16384), UL(32768), UL(65536), UL(131072), UL(262144), 
UL(524288),
+       UL(1048576), UL(2097152), UL(4194304), UL(8388608), UL(16777216), 
UL(33554432),
+       UL(67108864), UL(134217728), UL(268435456), UL(536870912), 
UL(1073741824),
+       UL(2147483648),
+       UL(4294967295) /* 4294967296-1, but this gives overflow on HP/UX */
 };
 
 /* binsizes[x] == (1 << ((x) + 3)) */
@@ -901,6 +908,11 @@
   if (_malloc_nwatch > 0)
     _malloc_ckwatch (mem, file, line, W_FREE, ubytes);
 #endif
+
+  /* Make sure the free_return target have some content if all the #ifdefs
+   * above is false.
+   */
+  return;
 }
 
 static PTR_T
diff -ur src-2.05b/mksyntax.c src-2.05b-local/mksyntax.c
--- src-2.05b/mksyntax.c        2002-02-07 15:32:28.000000000 +0100
+++ src-2.05b-local/mksyntax.c  2002-09-24 15:48:48.000000000 +0200
@@ -128,7 +128,16 @@
     
   switch (i)
     {
+#if defined(__STDC__)
     case '\a': xbuf[1] = 'a'; break;
+#else /* not __STDC__ */
+    /*
+     * '\a' gives "warning 30: Character constant contains undefined
+     * escape sequence." on the cc bundled with HP/UX.  Use the ascii
+     * value instead.
+     */
+    case 7: xbuf[1] = 'a'; break;
+#endif /* not __STDC__ */
     case '\v': xbuf[1] = 'v'; break;
     case '\b': xbuf[1] = 'b'; break;
     case '\f': xbuf[1] = 'f'; break;
diff -ur src-2.05b/syntax.h src-2.05b-local/syntax.h
--- src-2.05b/syntax.h  2002-02-25 17:52:37.000000000 +0100
+++ src-2.05b-local/syntax.h    2002-09-24 15:22:04.000000000 +0200
@@ -21,6 +21,8 @@
 #ifndef _SYNTAX_H_
 #define _SYNTAX_H_
 
+#include "config.h" /* Get define for 'const' if needed */
+
 /* Defines for use by mksyntax.c */
 
 #define slashify_in_quotes "\\`$\"\n"





reply via email to

[Prev in Thread] Current Thread [Next in Thread]