brouhaha / tapeutils

GNU General Public License v2.0
21 stars 5 forks source link

NetBSD support #13

Open larsbrinkhoff opened 3 years ago

larsbrinkhoff commented 3 years ago

@Rhialto reported in https://github.com/PDP-10/its/issues/2055#issuecomment-881710802:

[...] Stuff mostly works on NetBSD :) Although in tools/tapeutils I had to add a bit:

+ifeq ($(UNAME),NetBSD)
+       LIBS=-lcompat
+endif
Rhialto commented 2 years ago

I tried compiling this version directly on NetBSD, and the compiler complains about rexec():

cc -g -Wall   -c -o tapeio.o tapeio.c
tapeio.c: In function 'opentape':
tapeio.c:297:28: warning: implicit declaration of function 'rexec'; did you mean 'exect'? [-Wimplicit-function-declaration]
       if ((mtape->tapefd = rexec (&p, htons (512), user, NULL, "/etc/rmt",
                            ^~~~~
                            exect

The way this is "handled" for some operating systems (simply omitting this line) isn't really useful and won't work because mtape->tapefd is left uninitialized but is used already a few lines later. Nasal demons will ensue.

Further complains are

 read20.c:558:16: warning: implicit declaration of function 're_exec'; did you mean 'regexec'? [-Wimplicit-function-declaration]
   if ((match = re_exec(topsname)) == -1)
                ^~~~~~~
                regexec
cc -g  read20.o tapeio.o   -o read20
ld: read20.o: in function `expmatch':
/mnt/vol1/rhialto/cvs/other/tapeutils/read20.c:558: undefined reference to `re_exec'

Defining the replacement re_exec() etc functions near the top of read20.c also for NetBSD would be good; better than needing -lcompat for that.

Same for rexec(3) which has been replaced by rcmd(3).