[comp.sys.att] rn vs. Sys V questions

neal@smcnet.UUCP (Neal S. Pollack) (02/20/90)

I am trying to install rn on an AT&T 3B2/600 with SYS V rel 3.2
software.  Thanks to help from the net, I was able to get it to
compile.  However, it does not work.

When you type rn at the prompt to start it, it complains
getwd: read error in ..

I looked at util.c, where this occurs in getting the working dir,
and it seems related to the question of libndir, usendir, and
dirent.h for the ATT environment.

I was given rn Patchlevel 39.  I have defined usendir in config.h
by hand, since configure undef'd both libndir and usendir.

ATT has a /usr/include/dirent.h which defines DIR for ngdata.c 
and util.c.   Should I be editing dome files to use this dirent.h
instead?

Sincerely,
Neal Pollack
uunet!ucla-cs!smcnet!neal

stealth@caen.engin.umich.edu (Mike Peltier) (02/24/90)

In article <665@smcnet.UUCP> neal@smcnet.UUCP (Neal S. Pollack) writes:
>
>When you type rn at the prompt to start it, it complains
>getwd: read error in ..
>
>I looked at util.c, where this occurs in getting the working dir,
>and it seems related to the question of libndir, usendir, and
>dirent.h for the ATT environment.
>
>Neal Pollack
>uunet!ucla-cs!smcnet!neal

Heh...  I ran into this problem too, and I solved it by editing out
both of the getwd() functions in util.c, forcing the program to use
the system call.  What's the point of having the getwd() function
duplicated (is it?) in the rn source code?

-- 
-	-	-	-	-	-	-	-	-
Michael V. Peltier         | Computer Aided Engineering Network      
1420 King George Blvd.     | University of Michigan,  Ann Arbor       
Ann Arbor, MI  48104-6924  |    stealth@caen.engin.umich.edu          

woods@eci386.uucp (Greg A. Woods) (02/27/90)

In article <665@smcnet.UUCP> neal@smcnet.UUCP (Neal S. Pollack) writes:
> I am trying to install rn on an AT&T 3B2/600 with SYS V rel 3.2
> software.  Thanks to help from the net, I was able to get it to
> compile.  However, it does not work.

I guess the help you got from the net was wrong.  SysVr3+ has standard
directory routines (i.e. IEEE 1003.1 versions).  DON'T use the
ndir.[ch] that comes with rn.  It may break on RFS or NFS, and
probably on other strange filesystems (i.e. BSD :-) that some vendors
ship with their SysV's (remember SysV doesn't necessarily always have
UFS type filesystems).

Here's what's necessary for rn patchlevel 40 and up.  I imagine this
will work on your P39 version too.  (Yes, you should use <dirent.h>,
and let Configure use the opendir it finds in libc.a.  This will work
for any SysVr3+, or if you use Gwyn's libdirent.a.  You should always
use <dirent.h> where available, and make the necessary adaptations to
the code to conform to the IEEE1003.1 interface!)

Index: ngdata.c
*** Standard Input	Wed Dec 31 19:00:00 1969
--- ngdata.c	Wed Jun 14 19:16:31 1989
***************
*** 8,14 ****
  
  #include "EXTERN.h"
  #include "common.h"
! #include "ndir.h"
  #include "rcstuff.h"
  #include "rn.h"
  #include "intrp.h"
--- 8,14 ----
  
  #include "EXTERN.h"
  #include "common.h"
! #include <dirent.h>
  #include "rcstuff.h"
  #include "rn.h"
  #include "intrp.h"
***************
*** 185,191 ****
  ART_NUM floor;
  {
      register DIR *dirp;
!     register struct direct *dp;
      register ART_NUM min = 1000000;
      register ART_NUM maybe;
      register char *p;
--- 185,191 ----
  ART_NUM floor;
  {
      register DIR *dirp;
!     register struct dirent *dp;
      register ART_NUM min = 1000000;
      register ART_NUM maybe;
      register char *p;
***************
*** 194,200 ****
      dirp = opendir(dirname);
      if (!dirp)
  	return 0;
!     while ((dp = readdir(dirp)) != Null(struct direct *)) {
  	if ((maybe = atol(dp->d_name)) < min && maybe > floor) {
  	    for (p = dp->d_name; *p; p++)
  		if (!isdigit(*p))
--- 194,200 ----
      dirp = opendir(dirname);
      if (!dirp)
  	return 0;
!     while ((dp = readdir(dirp)) != Null(struct dirent *)) {
  	if ((maybe = atol(dp->d_name)) < min && maybe > floor) {
  	    for (p = dp->d_name; *p; p++)
  		if (!isdigit(*p))

There's also a problem with sprintf(), even in P44.  I didn't bother
to #ifdef it, so don't give the patched source back to a BSD site!

Index: common.h
*** Standard Input	Wed Dec 31 19:00:00 1969
--- common.h	Mon Nov 14 21:31:20 1988
***************
*** 670,676 ****
  char	*getenv();
  char	*strcat();
  char	*strcpy();
! char	*sprintf();
  
  EXT char buf[LBUFLEN+1];	/* general purpose line buffer */
  EXT char cmd_buf[CBUFLEN];	/* buffer for formatting system commands */
--- 670,676 ----
  char	*getenv();
  char	*strcat();
  char	*strcpy();
! int	sprintf();
  
  EXT char buf[LBUFLEN+1];	/* general purpose line buffer */
  EXT char cmd_buf[CBUFLEN];	/* buffer for formatting system commands */
-- 
						Greg A. Woods

woods@{eci386,gate,robohack,ontmoh,tmsoft,gpu.utcs.UToronto.CA,utorgpu.BITNET}
+1-416-443-1734 [h]  +1-416-595-5425 [w]    VE3-TCP	Toronto, Ontario CANADA