Article View: comp.sources.d
Article #1279Re: problems building abc
From: Jay Maynard
Date: Wed, 26 Dec 1990 19:26
Date: Wed, 26 Dec 1990 19:26
242 lines
6872 bytes
6872 bytes
In article <565@cadlab.sublink.ORG> staff@cadlab.sublink.ORG (Alex Martelli) writes:
>There are problems with the large, interesting abc package.
>Some have already been identified (i.e. the getwd() business),
>although the suggested patch as posted does not seem to clear
>them up yet - a minor point, though.
Oops. Minor flaw in my patch. If you've already applied it, just change
#ifdef GETCWD to #ifdef HAS_GETCWD both places it appears in unix/u1file.c,
and it'll work OK. If you haven't applied it yet, the corrected patch is at
the end of this article.
As another poster noted, there are several files missing from the version
posted to comp.unix.sources. I finally gave up on that one, FTPd the whole
thing from uunet.uu.net (it's in languages/abc/abc.unix.tar.Z, if memory
serves), and built it (after applying my corrected patch). Unfortunately,
it blows up when I try any of the examples. The problem appears to be in the
division routines, and can be reproduced (on my NCR Tower XP) by issuing
WRITE 280/204...the PC executable reports 1.372-something-or-other, but the
compiled Unix one reports 1. I haven't tracked this one down yet.
Here's the corrected getcwd() patch:
--------------------8<---------------cut here--------------->8---------------
*** Setup.orig
--- Setup
**************
*** 686,691
perror="#define"
mkdir="#define"
getwd="#define"
rename="#define"
select="#define"
readdir="#define"
--- 686,692 -----
perror="#define"
mkdir="#define"
getwd="#define"
+ getcwd="#undef "
rename="#define"
select="#define"
readdir="#define"
**************
*** 695,700
perror="#define"
mkdir="#undef "
getwd="#undef "
rename="#undef "
select="#undef "
readdir="#undef "
--- 696,702 -----
perror="#define"
mkdir="#undef "
getwd="#undef "
+ getcwd="#undef "
rename="#undef "
select="#undef "
readdir="#undef "
**************
*** 704,709
perror="#define"
mkdir="#define"
getwd="#undef "
rename="#undef "
select="#undef "
readdir="#undef "
--- 706,712 -----
perror="#define"
mkdir="#define"
getwd="#undef "
+ getcwd="#define"
rename="#undef "
select="#undef "
readdir="#undef "
**************
*** 714,719
perror="#undef "
mkdir="#undef "
getwd="#undef "
rename="#undef "
select="#undef "
readdir="#undef "
--- 717,723 -----
perror="#undef "
mkdir="#undef "
getwd="#undef "
+ getcwd="#undef "
rename="#undef "
select="#undef "
readdir="#undef "
**************
*** 751,756
/^#define HAS_PERROR/s?#define?$perror?
/^#define HAS_MKDIR/s?#define?$mkdir?
/^#define HAS_GETWD/s?#define?$getwd?
/^#define HAS_RENAME/s?#define?$rename?
/^#define HAS_SELECT/s?#define?$select?
/^#define HAS_READDIR/s?#define?$readdir?
--- 755,761 -----
/^#define HAS_PERROR/s?#define?$perror?
/^#define HAS_MKDIR/s?#define?$mkdir?
/^#define HAS_GETWD/s?#define?$getwd?
+ /^#define HAS_GETCWD/s?#define?$getcwd?
/^#define HAS_RENAME/s?#define?$rename?
/^#define HAS_SELECT/s?#define?$select?
/^#define HAS_READDIR/s?#define?$readdir?
**************
*** 801,817
case $strchr in
strchr) $editor uhdrs/os.h <<EOF
/#define strchr/,/#define strrchr/d
- w
- q
- EOF
- ;;
- esac
-
- case $unix in
- ATT) $editor uhdrs/os.h <<EOF
- /#define HAS_GETWD/a
- #define getwd(path) getcwd(path, SIZE_PATH)
- .
w
q
EOF
--- 806,811 -----
case $strchr in
strchr) $editor uhdrs/os.h <<EOF
/#define strchr/,/#define strrchr/d
w
q
EOF
*** unix/u1file.c.orig
--- unix/u1file.c
**************
*** 6,11
#include "bfil.h"
extern char *getenv();
extern char *getwd();
Visible char *curdir() {
--- 6,14 -----
#include "bfil.h"
extern char *getenv();
+ #ifdef HAS_GETCWD
+ extern char *getcwd();
+ #else
extern char *getwd();
#endif
**************
*** 7,12
extern char *getenv();
extern char *getwd();
Visible char *curdir() {
static char buffer[SIZE_PATH];
--- 10,16 -----
extern char *getcwd();
#else
extern char *getwd();
+ #endif
Visible char *curdir() {
static char buffer[SIZE_PATH];
**************
*** 10,15
Visible char *curdir() {
static char buffer[SIZE_PATH];
return getwd(buffer);
}
--- 14,22 -----
Visible char *curdir() {
static char buffer[SIZE_PATH];
+ #ifdef HAS_GETCWD
+ return getcwd(buffer, SIZE_PATH);
+ #else
return getwd(buffer);
#endif
}
**************
*** 11,16
Visible char *curdir() {
static char buffer[SIZE_PATH];
return getwd(buffer);
}
Hidden string searchfile(base, abclib) string base; string abclib; {
--- 18,24 -----
return getcwd(buffer, SIZE_PATH);
#else
return getwd(buffer);
+ #endif
}
Hidden string searchfile(base, abclib) string base; string abclib; {
*** unix/u1os.c.orig
--- unix/u1os.c
**************
*** 16,21
#endif /* !NDEBUG */
#ifndef HAS_GETWD
/* getwd - get working directory */
--- 16,24 -----
#endif /* !NDEBUG */
+ #ifdef HAS_GETCWD
+ #define HAS_GETWD /* merge the two #defines */
+ #endif
#ifndef HAS_GETWD
/* getwd - get working directory */
*** uhdrs/os.h.gen.orig
--- uhdrs/os.h.gen
**************
*** 67,72
#define HAS_PERROR /* can use sys_errlist and sys_nerr (from perror(3)) */
#define HAS_MKDIR /* mkdir() and rmdir() available */
#define HAS_GETWD /* getwd() available */
#define HAS_RENAME /* rename() available */
#define HAS_SELECT /* 4.2 BSD select() system call available */
#define HAS_READDIR /* Berkeley style directory reading routines */
--- 67,73 -----
#define HAS_PERROR /* can use sys_errlist and sys_nerr (from perror(3)) */
#define HAS_MKDIR /* mkdir() and rmdir() available */
#define HAS_GETWD /* getwd() available */
+ #define HAS_GETCWD /* getcwd() available? */
#define HAS_RENAME /* rename() available */
#define HAS_SELECT /* 4.2 BSD select() system call available */
#define HAS_READDIR /* Berkeley style directory reading routines */
--
Jay Maynard, EMT-P, K5ZC, PP-ASEL | Never ascribe to malice that which can
jmaynard@thesis1.hsch.utexas.edu | adequately be explained by stupidity.
"...flames are a specific art form of Usenet..." -- Gregory G. Woodbury
Technical Details
Message-ID:
<4499@lib.tmc.edu>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!bcm!lib!thesis1.hsch.utexas.eduReferences:
<565@cadlab.sublink.ORG>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!bcm!lib!thesis1.hsch.utexas.edu From: jmaynard@thesis1.hsch.utexas.edu (Jay Maynard) Newsgroups: comp.sources.d Subject: Re: problems building abc Message-ID: <4499@lib.tmc.edu> Date: 26 Dec 90 19:26:05 GMT References: <565@cadlab.sublink.ORG> Sender: usenet@lib.tmc.edu Distribution: comp Organization: University of Texas Medical School at Houston Lines: 242 Nntp-Posting-Host: thesis1.hsch.utexas.edu