scsh-users
[Top] [All Lists]

patch for io.c: scsh won't build with gcc 4.0.2

To: scsh-users@scsh.net
Subject: patch for io.c: scsh won't build with gcc 4.0.2
From: George Demmy <gdemmy@gmail.com>
Date: Mon, 20 Feb 2006 11:50:37 -0500
List-id: <scsh-users.list-id.scsh.net>
I've been playing with scsh since the early 0.5 days, so imagine my
surprise when a routine configure; make ; make install for 0.6.6 blew
up on a Fedora 4 box. The problem is with c/unix/io.c. gcc 4.0.2
doesn't like the storage class specification for the declaration of
write_integer in ps_write_integer (and I don't blame it). Also, it's
freaking out about type mismatches arisiing from mixed use of singed
and unsigned longs. I've checked the CVS sources out, and get the same
problem. I've included a patch that fixes the problem. The fix is
simple: I moved the definition of write_integer above
ps_write_integer, and nuked the internal declaration. I've also
dropped the unsigned specifier. since ps_write_integer consumes signed
longs, and this is the only function I can find that uses
write_integer, this should not cause a problem.

Kindest regards,

G

--- scsh/c/unix/io.c    2006-02-20 11:05:52.000000000 -0500
+++ patch/c/unix/io.c   2006-02-20 10:52:06.000000000 -0500
@@ -146,13 +146,27 @@
       return 0; }
 }
 
+static long
+write_integer(long n, FILE *port)
+{
+  char ch;
+  long status;
+
+  if (n == 0)
+    status = 0;
+  else {
+    status = write_integer(n / 10, port);
+    if (status == 0) {
+      ch = (n % 10) + '0';
+      WRITE_CHAR(ch, port,status); } }
+  return status;
+}
+
 long
 ps_write_integer(long n, FILE *port)
 {
   int status;
 
-  static long write_integer(unsigned long n, FILE *port);
-
   if (n == 0) {
     WRITE_CHAR('0', port, status);
     return status; }
@@ -166,22 +180,6 @@
       return status; }
 }
 
-static long
-write_integer(unsigned long n, FILE *port)
-{
-  char ch;
-  long status;
-
-  if (n == 0)
-    status = 0;
-  else {
-    status = write_integer(n / 10, port);
-    if (status == 0) {
-      ch = (n % 10) + '0';
-      WRITE_CHAR(ch, port,status); } }
-  return status;
-}
-
 long
 ps_write_string(char *string, FILE *port)
 {



<Prev in Thread] Current Thread [Next in Thread>