Subject: | Failed to link on AIX because of missing Fputc() |
The perl module Math-BigInteger versjon 1.0 fail to link on AIX because
the function Fputc(), used in bn.c, is missing. I was unable to find any trace of this function anywhere, and suspect it is a typo in the code.
Changing Fputc() to fputc() solved the problem. It really puzzles me
that the code was able to compile and link on all the other platforms
I tried, Linux, HP/UX, Irix, Solaris, Tru64 Unix and Mac OS X. The
new code still work on the other platforms. Here is a patch to fix the
problem:
diff -ur src-1.0/bn.c src-1.0-local/bn.c
--- src-1.0/bn.c 1996-05-05 17:30:55.000000000 +0200
+++ src-1.0-local/bn.c 2002-10-30 11:37:03.000000000 +0100
@@ -304,8 +304,10 @@
int i,j,v,z=0;
static char *hex="0123456789ABCDEF";
- if (a->neg) Fputc('-',fp);
- if (a->top == 0) Fputc('0',fp);
+/* I have no idea what Fputc() is, but it was missing on AIX. I renamed it
+ to fputc(), and it seem to work. [pere 2002-10-30] */
+ if (a->neg) fputc('-',fp);
+ if (a->top == 0) fputc('0',fp);
for (i=a->top-1; i >=0; i--)
{
for (j=BITS2-4; j >= 0; j-=4)
@@ -314,7 +316,7 @@
v=(a->d[i]>>j)&0x0f;
if (z || (v != 0))
{
- Fputc(hex[v],fp);
+ fputc(hex[v],fp);
z=1;
}
}