Article View: news.software.nn
Article #3625Porting nn to HP 9000/HP-UX 8.0
From: Scott Stevens
Date: Mon, 18 Jan 1993 00:52
Date: Mon, 18 Jan 1993 00:52
648 lines
16395 bytes
16395 bytes
I have a feeling I've just re-invented the wheel here, but after a cursory
search I couldn't find relevant patches anywhere. Anyway...
Following are the changes that I had to make to nn 6.4.18 to get it to
compile on an HP 9000/827 running HP-UX 8.02. (We don't have the "real"
ANSI C compiler yet, so this work was done using the C compiler that
comes with the system.) These aren't what I'd call optimal, but they
appear to work. Note that I altered some .c files to use configuration
parameters that I defined in conf/s-hpux8-0.h, but I didn't update any
of the other conf/s-*.h files to define them.
Hope someone finds this useful; let me know if you find any mistakes!
-- Scott Stevens, Truevision
This is an UNofficial patch to nn release 6.4
---------------------------------------------
These are the changes that I had to make to get nn to compile on
an HP 9000/827 running HP-UX 8.02. I created conf/s-hpux8-0.h to
describe the OS configuration; I also had to make several patches
to the nn source, mostly to handle the declarations of variables
for user/group/process ids.
These patches are for nn 6.4, patchlevel 18.
-- Scott Stevens
-- Truevision Inc.
-- 17 Jan 1993
========================================================================
*** ./conf/s-hpux8-0.h.dist Sun Jan 17 19:28:23 1993
--- ./conf/s-hpux8-0.h Sun Jan 17 16:45:58 1993
***************
*** 0 ****
--- 1,205 ----
+ /*
+ * For HP-UX 8.0
+ * W. Scott Stevens, Truevision Inc., 17 Jan 1993
+ */
+
+
+ /*
+ * Include header files containing the following definitions:
+ *
+ * off_t, time_t, struct stat
+ */
+
+ #include <sys/types.h>
+ #include <sys/stat.h>
+
+ #include <unistd.h>
+
+
+ /*
+ * Define if your system has system V like ioctls
+ */
+
+ #define HAVE_TERMIO /* */
+
+ /*
+ * Define to use terminfo database.
+ * Otherwise, termcap is used
+ */
+
+ #define USE_TERMINFO /* */
+
+ /*
+ * Specify the library (or libraries) containing the termcap/terminfo
+ * routines.
+ *
+ * Notice: nn only uses the low-level terminal access routines
+ * (i.e. it does not use curses).
+ */
+
+ #define TERMLIB -lcurses
+
+ /*
+ * Define HAVE_STRCHR if strchr() and strrchr() are available
+ */
+
+ #define HAVE_STRCHR /* */
+
+ /*
+ * Define if a signal handler has type void (see signal.h)
+ */
+
+ #define SIGNAL_HANDLERS_ARE_VOID /* */
+
+ /*
+ * Define if signals must be set again after they are caught
+ */
+
+ #define RESET_SIGNAL_WHEN_CAUGHT /* */
+
+ /*
+ * Define if your system has BSD like job control (SIGTSTP works)
+ */
+
+ #define HAVE_JOBCONTROL /* */
+
+
+ /*
+ * Define if your system has a 4.3BSD like syslog library.
+ */
+
+ #define HAVE_SYSLOG
+
+ /*
+ * Define if your system provides the "directory(3X)" access routines
+ *
+ * If true, include the header file(s) required by the package below
+ * (remember that <sys/types.h> or equivalent is included above)
+ * Also typedef Direntry to the proper struct type.
+ */
+
+ #define HAVE_DIRECTORY /* */
+
+ #include <dirent.h> /* System V */
+
+ typedef struct dirent Direntry; /* System V */
+
+ /*
+ * Define if your system has a mkdir() library routine
+ */
+
+ #define HAVE_MKDIR /* */
+
+ /*
+ * Pick one:
+ * Define HAVE_GETHOSTNAME if you have a BSD like gethostname routine.
+ * Define HAVE_UNAME if a system V compatible uname() is available.
+ * Define HOSTNAME_FILE "...." to a file containing the hostname.
+ * Define HOSTNAME_WHOAMI if sysname is defined in <whoami.h>.
+ *
+ * As a final resort, define HOSTNAME to the name of your system
+ * (in config.h).
+ */
+
+ #define HAVE_GETHOSTNAME /* */
+
+ /*
+ * Define HAVE_MULTIGROUP if system has simultaneous multiple group
+ * membership capability (BSD style).
+ * Also define NGROUPS or include the proper .h file if NGROUPS is
+ * not defined in <sys/param.h>.
+ * Also define GIDSET_TYPE to the type of the elements in the array
+ * initialized by getgroups() if different from "int" (many systems
+ * have a gid_t, but very few use it for getgroups()).
+ */
+
+ #define HAVE_MULTIGROUP /* */
+ #include <sys/param.h> /* just for NGROUPS */
+ /* #define GIDSET_TYPE gid_t /* see below */
+
+ /*
+ * Define DETATCH_TERMINAL to be a command sequence which
+ * will detatch a process from the control terminal
+ * Also include system files needed to perform this HERE.
+ * If not possible, just define it (empty)
+ */
+
+ #define DETATCH_TERMINAL setsid();
+
+
+ /*
+ * Specify where the Bourne Shell is.
+ */
+
+ #define SHELL "/bin/sh"
+
+ /*
+ * Specify the default mailer to be invoked by nnmail
+ */
+
+ #define MAILX "/usr/bin/mailx" /* */
+
+ /*
+ * Define the maximum length of any pathname that may occur
+ */
+
+ #define FILENAME 1024
+
+ /*
+ * NNTP support requires tcp/ip with socket interface.
+ *
+ * Define NO_RENAME if the rename() system call is not available.
+ * Define NO_BZERO if the bzero() function is not available.
+ * Define EXCELAN if the tcp/ip package is EXCELAN based.
+ * Define NNTP_EXTRA_LIB to any libraries required only for nntp.
+ */
+
+ /* #define NO_RENAME /* */
+ /* #define NO_BZERO /* */
+ /* #define EXCELAN /* */
+ /* #define NNTP_EXTRA_LIB -lsocket /* */
+
+ /*
+ * Define standard compiler flags here:
+ */
+
+ #define COMPILER_FLAGS -O +Obb750
+
+ /*
+ * If your system requires other libraries when linking nn
+ * specify them here:
+ */
+
+ /* #define EXTRA_LIB /* */
+
+ /*
+ * The following added by W. Scott Stevens, 17 Jan 1993
+ */
+
+ /*
+ * Define SBRKVAL to be "void" if sbrk returns "void *"
+ * rather than "char *".
+ */
+
+ #define SBRKVAL void /* */
+
+ /*
+ * The return types of getuid() and getsid(). Typical choices
+ * are "unsigned short" and "uid_t"/"gid_t".
+ *
+ * The definition of GIDSET_TYPE has also been moved down here.
+ */
+
+ /* #define UID_TYPE unsigned short /* */
+ #define UID_TYPE uid_t /* */
+
+ /* #define GID_TYPE unsigned short /* */
+ #define GID_TYPE gid_t /* */
+ #define GIDSET_TYPE GID_TYPE /* */
+
+ /*
+ * And for getpid().
+ */
+
+ /* #define PID_TYPE int /* */
+ #define PID_TYPE pid_t /* */
*** ./nn.c.dist Sun Jan 17 15:30:43 1993
--- ./nn.c Sun Jan 17 15:35:24 1993
***************
*** 14,19 ****
--- 14,22 ----
#ifdef USE_MALLOC_H
#include <malloc.h>
#endif
+ #ifndef SBRKVAL
+ #define SBRKVAL char
+ #endif
import char *bin_directory;
***************
*** 677,683 ****
flag_type access_mode;
char *mask;
extern long initial_memory_break;
! extern char *sbrk();
initial_memory_break = (long)sbrk(0);
--- 680,686 ----
flag_type access_mode;
char *mask;
extern long initial_memory_break;
! extern SBRKVAL *sbrk();
initial_memory_break = (long)sbrk(0);
*** ./Makefile.dist Sun Jan 17 02:32:18 1993
--- ./Makefile Sun Jan 17 16:48:06 1993
***************
*** 9,15 ****
CC = cc
CPP = $(CC) -E
! CFLAGS = -g
LDFLAGS =
MAKE = make
--- 9,15 ----
CC = cc
CPP = $(CC) -E
! CFLAGS =
LDFLAGS =
MAKE = make
*** ./init.c.dist Sun Jan 17 15:30:45 1993
--- ./init.c Sun Jan 17 15:35:41 1993
***************
*** 13,18 ****
--- 13,21 ----
#ifdef USE_MALLOC_H
#include <malloc.h>
#endif
+ #ifndef SBRKVAL
+ #define SBRKVAL char
+ #endif
import char *help_directory, *db_directory;
***************
*** 489,495 ****
#endif
static long prev_mem = 0;
long cur_mem;
! extern char *sbrk();
clrdisp();
printf("group=%s, nart=%ld\n\r", current_group->group_name, n_articles);
--- 492,498 ----
#endif
static long prev_mem = 0;
long cur_mem;
! extern SBRKVAL *sbrk();
clrdisp();
printf("group=%s, nart=%ld\n\r", current_group->group_name, n_articles);
*** ./global.c.dist Sun Jan 17 15:37:22 1993
--- ./global.c Sun Jan 17 15:54:32 1993
***************
*** 43,51 ****
export int use_nntp = 0; /* bool: t iff we use nntp */
#endif
! export unsigned short user_eid;
! export unsigned short user_id, group_id;
! export int process_id;
export int who_am_i;
export int dont_write_console = 0;
export int mail_errors_mode = 2;
--- 43,52 ----
export int use_nntp = 0; /* bool: t iff we use nntp */
#endif
! export UID_TYPE user_eid;
! export UID_TYPE user_id;
! export GID_TYPE group_id;
! export PID_TYPE process_id;
export int who_am_i;
export int dont_write_console = 0;
export int mail_errors_mode = 2;
***************
*** 157,164 ****
init_global()
{
! unsigned short getuid(), getgid();
! int getpid();
int suspend_nn();
int i;
--- 158,166 ----
init_global()
{
! UID_TYPE getuid(), geteuid();
! GID_TYPE getgid(), getegid();
! PID_TYPE getpid();
int suspend_nn();
int i;
***************
*** 831,837 ****
user = getlogin();
if (user != NULL && *user != NUL) goto out;
! pw = getpwuid((int)user_id);
if (pw != NULL && pw->pw_name[0] != NUL) {
user = copy_str(pw->pw_name);
goto out;
--- 833,839 ----
user = getlogin();
if (user != NULL && *user != NUL) goto out;
! pw = getpwuid((UID_TYPE)user_id);
if (pw != NULL && pw->pw_name[0] != NUL) {
user = copy_str(pw->pw_name);
goto out;
*** ./fullname.c.dist Sun Jan 17 15:46:39 1993
--- ./fullname.c Sun Jan 17 15:55:02 1993
***************
*** 95,101 ****
if ((fullname = getenv("NAME")) != NULL)
return fullname;
! pw = getpwuid((int)user_id);
if (pw == NULL) return fullname = "?";
buildfname(pw->pw_gecos, pw->pw_name, inbuf);
--- 95,101 ----
if ((fullname = getenv("NAME")) != NULL)
return fullname;
! pw = getpwuid((PID_TYPE)user_id);
if (pw == NULL) return fullname = "?";
buildfname(pw->pw_gecos, pw->pw_name, inbuf);
*** ./usercheck.c.dist Sun Jan 17 15:46:40 1993
--- ./usercheck.c Sun Jan 17 15:58:34 1993
***************
*** 1,10 ****
/* check for whether caller is a specific uid (numeric) */
main(argc, argv)
int argc;
char *argv[];
{
! int uid = 0;
if (argc > 1) uid = atoi(argv[1]);
--- 1,13 ----
/* check for whether caller is a specific uid (numeric) */
+ #include "config.h"
+
main(argc, argv)
int argc;
char *argv[];
{
! UID_TYPE uid = 0;
! extern UID_TYPE getuid();
if (argc > 1) uid = atoi(argv[1]);
*** ./execute.c.dist Sun Jan 17 15:46:40 1993
--- ./execute.c Sun Jan 17 16:00:52 1993
***************
*** 35,41 ****
char *path, **args;
int toggle_visual;
{
! int was_raw, pid, i, status;
sig_type (*quit)(), (*intr)(), (*tstp)();
extern int errno;
--- 35,42 ----
char *path, **args;
int toggle_visual;
{
! int was_raw, i, status;
! PID_TYPE pid;
sig_type (*quit)(), (*intr)(), (*tstp)();
extern int errno;
*** ./master.c.dist Sun Jan 17 15:46:40 1993
--- ./master.c Sun Jan 17 16:40:38 1993
***************
*** 152,157 ****
--- 152,159 ----
nn_exit(n)
{
+ extern PID_TYPE proto_lock();
+
#ifdef NNTP
if (use_nntp) nntp_cleanup();
#endif /* NNTP */
***************
*** 587,592 ****
--- 589,595 ----
int temp;
int skip_pass;
long pass_no;
+ extern PID_TYPE proto_lock();
umask(002); /* avoid paranoia */
***************
*** 624,630 ****
if (proto_lock(I_AM_MASTER, PL_TERMINATE) < 0)
temp = 0;
else {
! int mpid;
extern char proto_host[];
if (proto_host[0]) {
--- 627,633 ----
if (proto_lock(I_AM_MASTER, PL_TERMINATE) < 0)
temp = 0;
else {
! PID_TYPE mpid;
extern char proto_host[];
if (proto_host[0]) {
*** ./proto.c.dist Sun Jan 17 15:46:40 1993
--- ./proto.c Sun Jan 17 16:09:46 1993
***************
*** 55,61 ****
fclose(m_pid);
}
! static int read_lock(lock)
char *lock;
{
FILE *m_pid;
--- 55,61 ----
fclose(m_pid);
}
! static PID_TYPE read_lock(lock)
char *lock;
{
FILE *m_pid;
***************
*** 80,92 ****
return -1; /* locked by another host */
proto_host[0] = NUL;
}
! return atoi(pid);
}
proto_lock(prog, command)
{
FILE *m_pid;
! int try, pid;
char buf[10], *any, *lock;
switch (prog) {
--- 80,94 ----
return -1; /* locked by another host */
proto_host[0] = NUL;
}
! return (PID_TYPE)atoi(pid);
}
+ PID_TYPE
proto_lock(prog, command)
{
FILE *m_pid;
! PID_TYPE pid;
! int try;
char buf[10], *any, *lock;
switch (prog) {
*** ./account.c.dist Sun Jan 17 16:06:14 1993
--- ./account.c Sun Jan 17 16:07:15 1993
***************
*** 382,387 ****
--- 382,388 ----
char *fname;
int users, i;
struct account ac, *actab;
+ extern PID_TYPE proto_lock();
who_am_i = I_AM_ACCT;
*** ./admin.c.dist Sun Jan 17 16:06:17 1993
--- ./admin.c Sun Jan 17 16:08:14 1993
***************
*** 537,542 ****
--- 537,544 ----
static kill_master(term)
int term;
{
+ extern PID_TYPE proto_lock();
+
switch (proto_lock(I_AM_MASTER, term ? PL_TERMINATE : PL_WAKEUP_SOFT)) {
case 1:
if (verbose)
***************
*** 554,560 ****
static master_run_check()
{
extern char proto_host[];
! int running = proto_lock(I_AM_MASTER, PL_CHECK) >= 0;
if (!verbose && pre_input != NULL)
exit(running ? 0 : 1);
--- 556,564 ----
static master_run_check()
{
extern char proto_host[];
! extern PID_TYPE proto_lock();
!
! PID_TYPE running = proto_lock(I_AM_MASTER, PL_CHECK) >= 0;
if (!verbose && pre_input != NULL)
exit(running ? 0 : 1);
*** ./global.h.dist Sun Jan 17 16:11:00 1993
--- ./global.h Sun Jan 17 16:13:44 1993
***************
*** 153,163 ****
#define I_AM_EXPIRE 11
#define I_AM_ACCT 12
! extern unsigned short /* as they are on most systems... */
! user_id,
group_id;
! extern int
process_id;
extern int errno;
--- 153,164 ----
#define I_AM_EXPIRE 11
#define I_AM_ACCT 12
! extern UID_TYPE
! user_id;
! extern GID_TYPE
group_id;
! extern PID_TYPE
process_id;
extern int errno;
*** ./term.c.dist Sun Jan 17 16:28:33 1993
--- ./term.c Sun Jan 17 16:31:14 1993
***************
*** 118,123 ****
--- 118,127 ----
#ifdef USE_TERMCAP
#include <termio.h>
+ #else
+ #ifndef VINTR
+ #include <termio.h>
+ #endif
#endif
#undef CBREAK
*** ./xmakefile.dist Sun Jan 17 16:37:02 1993
--- ./xmakefile Sun Jan 17 16:38:12 1993
***************
*** 159,165 ****
$(CC) -o cvt-help cvt-help.c $(LDFLAGS)
usercheck: PARALLEL config.h usercheck.c
! $(CC) -o usercheck usercheck.c $(LDFLAGS)
inst: config.h xmakefile inst.sh cvt-help usercheck mkprefix man/nn.1
@echo building install script: ./inst
--- 159,165 ----
$(CC) -o cvt-help cvt-help.c $(LDFLAGS)
usercheck: PARALLEL config.h usercheck.c
! $(CC) -o usercheck $(CFLAGS) usercheck.c $(LDFLAGS)
inst: config.h xmakefile inst.sh cvt-help usercheck mkprefix man/nn.1
@echo building install script: ./inst
Technical Details
Message-ID:
<1jcv1bINNefs@epic.truevision.com>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!archive!mbox2nntp-news.software.nn.mbox.zip!sparky!uunet!epicb!usenetShow Full Headers
Complete Article Headers
Message-ID: <1jcv1bINNefs@epic.truevision.com> Subject: Porting nn to HP 9000/HP-UX 8.0 Date: Mon, 18 Jan 1993 00:52:59 +0000 From: scott@truevision.com (Scott Stevens) Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!archive!mbox2nntp-news.software.nn.mbox.zip!sparky!uunet!epicb!usenet Newsgroups: news.software.nn Organization: Truevision Inc., Indianapolis, IN Lines: 648 NNTP-Posting-Host: epic.truevision.com Summary: Changes to nn 6.4.18 to compile on HP 9000/827 running HP-UX 8.02