jbm@uncle.UUCP (John B. Milton) (11/12/88)
Assuming you have already installed finger for the UNIX_PC, the patches below modify finger.[ch] to use syslocal(2) instead of nlist() to get the addresses of v and proc. I hope they put some form of the syslocal(SYSL_KADDR,) in SYSV.4 John *** orig/finger.c Sat Nov 12 02:15:23 1988 --- finger.c Sat Nov 12 01:55:46 1988 *************** *** 33,38 #include <nlist.h> #endif /* NEED_NLIST.H */ #include <fcntl.h> #include <utmp.h> #include <pwd.h> --- 33,42 ----- #include <nlist.h> #endif /* NEED_NLIST.H */ + #ifdef UNIX_PC + #include <sys/syslocal.h> + #endif /* UNIX_PC */ + #include <fcntl.h> #include <utmp.h> #include <pwd.h> *************** *** 65,71 char *progname, /* Our name. */ - *kernel_file = KERNEL_FILE, /* The kernal file. */ *kmem_file = KMEM_FILE, /* Kernals memory file. */ *mem_file = MEM_FILE, /* Physical memory file. */ *swap_file = SWAP_FILE, /* Swappin' file. */ --- 69,74 ----- char *progname, /* Our name. */ *kmem_file = KMEM_FILE, /* Kernals memory file. */ *mem_file = MEM_FILE, /* Physical memory file. */ *swap_file = SWAP_FILE, /* Swappin' file. */ *************** *** 69,74 *kmem_file = KMEM_FILE, /* Kernals memory file. */ *mem_file = MEM_FILE, /* Physical memory file. */ *swap_file = SWAP_FILE, /* Swappin' file. */ *nlist_file = NLIST_FILE, /* Our nlist file. */ *whois_dbase_dir = WHOIS_DBASE_DIR; /* Whois data base stuff. */ --- 72,79 ----- *kmem_file = KMEM_FILE, /* Kernals memory file. */ *mem_file = MEM_FILE, /* Physical memory file. */ *swap_file = SWAP_FILE, /* Swappin' file. */ + #ifndef UNIX_PC + *kernel_file = KERNEL_FILE, /* The kernal file. */ *nlist_file = NLIST_FILE, /* Our nlist file. */ #endif *whois_dbase_dir = WHOIS_DBASE_DIR; /* Whois data base stuff. */ *************** *** 70,75 *mem_file = MEM_FILE, /* Physical memory file. */ *swap_file = SWAP_FILE, /* Swappin' file. */ *nlist_file = NLIST_FILE, /* Our nlist file. */ *whois_dbase_dir = WHOIS_DBASE_DIR; /* Whois data base stuff. */ int --- 75,81 ----- #ifndef UNIX_PC *kernel_file = KERNEL_FILE, /* The kernal file. */ *nlist_file = NLIST_FILE, /* Our nlist file. */ + #endif *whois_dbase_dir = WHOIS_DBASE_DIR; /* Whois data base stuff. */ #ifdef UNIX_PC *************** *** 72,77 *nlist_file = NLIST_FILE, /* Our nlist file. */ *whois_dbase_dir = WHOIS_DBASE_DIR; /* Whois data base stuff. */ int whatarewe = FINGER, /* list of what we should be doing. */ idle_time = -1, /* Maximum idle time; -1 == not defined. */ --- 78,87 ----- #endif *whois_dbase_dir = WHOIS_DBASE_DIR; /* Whois data base stuff. */ + #ifdef UNIX_PC + long v_addr, proc_addr; + #endif + int whatarewe = FINGER, /* list of what we should be doing. */ idle_time = -1, /* Maximum idle time; -1 == not defined. */ *************** *** 331,336 ** and print the pup. */ /* ** Check to see if our nlist is up to date (stat its time against /xenix). ** If not, nlist /xenix and update it for future use. --- 341,351 ----- ** and print the pup. */ + #ifdef UNIX_PC + v_addr=syslocal(SYSL_KADDR,SLA_V); /* Boy, they made it easy! */ + proc_addr=syslocal(SYSL_KADDR,SLA_PROC); + #else + /* ** Check to see if our nlist is up to date (stat its time against /xenix). ** If not, nlist /xenix and update it for future use. *************** *** 405,410 } } } close(fd); --- 420,426 ----- } } } + #endif /* ndef UNIX_PC */ close(fd); *************** *** 863,868 f->next = keep; } /* ** nlist kernel for _v and write it out to nlist_file for future reference. */ --- 879,885 ----- f->next = keep; } + #ifndef UNIX_PC /* ** nlist kernel for _v and write it out to nlist_file for future reference. */ *************** *** 944,949 } } } /* ** get_what() - returns the name of program PID is currently running. --- 961,967 ----- } } } + #endif /* UNIX_PC */ /* ** get_what() - returns the name of program PID is currently running. *** orig/finger.h Sat Nov 12 02:15:31 1988 --- finger.h Sat Nov 12 02:20:44 1988 *************** *** 43,48 /* ** Some defines for easy access to nlist struct. */ #define v_addr nl[0].n_value #define proc_addr nl[1].n_value --- 43,49 ----- /* ** Some defines for easy access to nlist struct. */ + #ifndef UNIX_PC #define v_addr nl[0].n_value #define proc_addr nl[1].n_value #endif *************** *** 45,50 */ #define v_addr nl[0].n_value #define proc_addr nl[1].n_value /* ** Below are machine dependent macros and definitions. On XENIX --- 46,52 ----- #ifndef UNIX_PC #define v_addr nl[0].n_value #define proc_addr nl[1].n_value + #endif /* ** Below are machine dependent macros and definitions. On XENIX *************** *** 125,131 ** Symbols on the Unix PC do not have prefixed underlines. */ #define NO_PREFIXED_UNDERLINES_IN_SYMBOLS ! #define NEED_NLIST.H #endif /* UNIX_PC */ #ifdef SYSV_3B5 --- 127,133 ----- ** Symbols on the Unix PC do not have prefixed underlines. */ #define NO_PREFIXED_UNDERLINES_IN_SYMBOLS ! /*#define NEED_NLIST.H /* now using syslocal(2) instead */ #endif /* UNIX_PC */ #ifdef SYSV_3B5 *************** *** 150,155 ** nlist structure. */ #ifdef NO_PREFIX_UNDERLINES_IN_SYMBOLS struct nlist nl[] = { --- 152,158 ----- ** nlist structure. */ + #ifndef UNIX_PC #ifdef NO_PREFIX_UNDERLINES_IN_SYMBOLS struct nlist nl[] = { *************** *** 165,167 { "", }, }; #endif /* NO_PREFIX_UNDERLINES_IN_SYMBOLS */ --- 168,171 ----- { "", }, }; #endif /* NO_PREFIX_UNDERLINES_IN_SYMBOLS */ + #endif /* ndef UNIX_PC */ -- John Bly Milton IV, jbm@uncle.UUCP, n8emr!uncle!jbm@osu-cis.cis.ohio-state.edu (614) h:294-4823, w:764-4272; MS-DOS is a beautiful flower that smells bad!