diff --git a/Makefile b/Makefile index 89a34be..33b6ed2 100644 --- a/Makefile +++ b/Makefile @@ -32,7 +32,7 @@ HDR=ebind.h edef.h efunc.h epath.h estruct.h evar.h util.h version.h # DO NOT ADD OR MODIFY ANY LINES ABOVE THIS -- make source creates them -CC=gcc +CC=cc WARNINGS=-Wall -Wstrict-prototypes CFLAGS=-O2 $(WARNINGS) -g #CC=c89 +O3 # HP @@ -48,6 +48,9 @@ endif ifeq ($(uname_S),Darwin) DEFINES=-DAUTOCONF -DPOSIX -DSYSV -D_DARWIN_C_SOURCE -D_BSD_SOURCE -D_SVID_SOURCE -D_XOPEN_SOURCE=600 endif +ifeq ($(uname_S),OpenBSD) + DEFINES=-DAUTOCONF -DPOSIX -DBSD -D_BSD_SOURCE +endif #DEFINES=-DAUTOCONF #LIBS=-ltermcap # BSD LIBS=-lcurses # SYSV diff --git a/lock.c b/lock.c index dce53a7..7161a4b 100644 --- a/lock.c +++ b/lock.c @@ -13,6 +13,10 @@ #if BSD | SVR4 #include +#ifdef __OpenBSD__ +#include +#endif + static char *lname[NLOCKS]; /* names of all locked files */ static int numlocks; /* # of current locks active */ diff --git a/pklock.c b/pklock.c index dc30b76..a90337b 100644 --- a/pklock.c +++ b/pklock.c @@ -81,7 +81,11 @@ char *dolock(char *fname) if ((n = read(fd, locker, MAXNAME)) < 1) { lseek(fd, 0, SEEK_SET); /* strcpy(locker, getlogin()); */ +#ifdef __OpenBSD__ + getlogin_r(locker, MAXNAME + 1); +#else cuserid(locker); +#endif strcat(locker + strlen(locker), "@"); gethostname(locker + strlen(locker), 64); write(fd, locker, strlen(locker));