home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / unix / sysv386 / 12486 < prev    next >
Encoding:
Text File  |  1992-07-27  |  14.2 KB  |  494 lines

  1. Xref: sparky comp.unix.sysv386:12486 biz.sco.general:2711
  2. Newsgroups: comp.unix.sysv386,biz.sco.general
  3. Path: sparky!uunet!kithrup!sef
  4. From: sef@kithrup.COM (Sean Eric Fagan)
  5. Subject: diffs to net/2 finger for SCO 3.2v2
  6. Organization: Kithrup Enterprises, Ltd.
  7. Date: Mon, 27 Jul 1992 11:13:31 GMT
  8. Message-ID: <1992Jul27.111331.1556@kithrup.COM>
  9. Sender: sef@kithrup.COM (Sean Eric Fagan)
  10. Lines: 482
  11.  
  12. Here are the diffs necessary to make the Net/2 finger compile and,
  13. apparantly, run under SCO UNIX 3.2v2.  As with the fingerd changes, they
  14. have not been tested extensively, just enough to make sure it works.  If you
  15. run it on a 3.2v4 system, for example, I would worry about symlinks!
  16.  
  17. Note that, while it doesn't give very useful information about last login
  18. times, neither does the native version, although I'm tryinig to figure out
  19. a way to change that.
  20.  
  21. As with the previous set of diffs, use at your own discretion.  If you find
  22. some bugs, please let me know, but I may not be able to fix them in time to
  23. make you happy.  Also, any bugs with something other than what is changed
  24. with the set of patches should go to berkeley people, not me 8-).
  25.  
  26. Share and enjoy!
  27.  
  28. -- snip snip --
  29. *** finger/Makefile.~1~    Mon Jul 27 00:48:37 1992
  30. --- finger/Makefile    Mon Jul 27 03:52:53 1992
  31. ***************
  32. *** 1,6 ****
  33.   #    @(#)Makefile    5.3 (Berkeley) 5/11/90
  34.   
  35.   PROG=    finger
  36. ! SRCS=    finger.c lprint.c net.c sprint.c util.c
  37.   
  38. ! .include <bsd.prog.mk>
  39. --- 1,13 ----
  40.   #    @(#)Makefile    5.3 (Berkeley) 5/11/90
  41.   
  42.   PROG=    finger
  43. ! SRCS=    finger.c lprint.c net.c sprint.c util.c strsep.c
  44. ! CC=    gcc
  45. ! CFLAGS=    -g -O -I.
  46. ! LIBS=    -lsocket
  47. ! OBJS=    finger.o lprint.o net.o sprint.o util.o strsep.o
  48.   
  49. ! all:    $(PROG)
  50. ! $(PROG):    $(OBJS)
  51. !     $(CC) $(CFLAGS) $(OBJS) -o $(PROG) $(LIBS)
  52. *** finger/finger.c.~1~    Mon Jul 27 00:48:40 1992
  53. --- finger/finger.c    Mon Jul 27 03:52:42 1992
  54. ***************
  55. *** 57,64 ****
  56.    * mail info, and .plan/.project files.
  57.    */
  58.   
  59.   #include <sys/param.h>
  60. ! #include <sys/file.h>
  61.   #include <stdio.h>
  62.   #include "finger.h"
  63.   
  64. --- 57,65 ----
  65.    * mail info, and .plan/.project files.
  66.    */
  67.   
  68. + #include <sys/types.h>
  69.   #include <sys/param.h>
  70. ! #include <fcntl.h>
  71.   #include <stdio.h>
  72.   #include "finger.h"
  73.   
  74. ***************
  75. *** 98,104 ****
  76.       argv += optind;
  77.   
  78.       (void)time(&now);
  79. !     setpassent(1);
  80.       if (!*argv) {
  81.           /*
  82.            * Assign explicit "small" format if no names given and -l
  83. --- 99,105 ----
  84.       argv += optind;
  85.   
  86.       (void)time(&now);
  87. ! /*    setpassent(1); */    /* what is setpassent?! */
  88.       if (!*argv) {
  89.           /*
  90.            * Assign explicit "small" format if no names given and -l
  91. *** finger/finger.h.~1~    Mon Jul 27 00:48:42 1992
  92. --- finger/finger.h    Mon Jul 27 03:49:38 1992
  93. ***************
  94. *** 39,44 ****
  95. --- 39,48 ----
  96.   #include <pwd.h>
  97.   #include <utmp.h>
  98.   
  99. + #ifndef _PATH_UTMP
  100. + # define _PATH_UTMP "/etc/utmp"
  101. + #endif
  102.   /*
  103.    * All unique persons are linked in a list headed by "head" and linkd
  104.    * by the "next" field, as well as kept in a hash table.
  105. ***************
  106. *** 60,65 ****
  107. --- 64,77 ----
  108.   
  109.   enum status { LASTLOG, LOGGEDIN };
  110.   
  111. + #ifndef UT_LINESIZE
  112. + # define UT_LINESIZE 12
  113. + #endif
  114. + #ifndef UT_NAMESIZE
  115. + # define    UT_NAMESIZE    8
  116. + #endif
  117.   typedef struct where {
  118.       struct where *next;        /* next place he is or has been */
  119.       enum status info;        /* type/status of request */
  120. ***************
  121. *** 67,73 ****
  122. --- 79,87 ----
  123.       time_t loginat;            /* time of (last) login */
  124.       time_t idletime;        /* how long idle (if logged in) */
  125.       char tty[UT_LINESIZE+1];    /* null terminated tty line */
  126. + #ifdef UT_HOSTSIZE
  127.       char host[UT_HOSTSIZE+1];    /* null terminated remote host name */
  128. + #endif
  129.   } WHERE;
  130.   
  131.   #define    HBITS    8            /* number of bits in hash code */
  132. ***************
  133. *** 83,85 ****
  134. --- 97,107 ----
  135.   WHERE *walloc();
  136.   
  137.   extern char tbuf[1024];            /* temp buffer for anybody */
  138. + #ifndef HAVE_LASTLOG
  139. + struct lastlog {
  140. +   time_t ll_time;
  141. +   char ll_line[8];
  142. +   char ll_host[16];
  143. + };
  144. + #endif    /* !HAVE_LASTLOG */
  145. *** finger/lprint.c.~1~    Mon Jul 27 00:48:44 1992
  146. --- finger/lprint.c    Mon Jul 27 01:03:22 1992
  147. ***************
  148. *** 39,51 ****
  149.   #endif /* not lint */
  150.   
  151.   #include <sys/types.h>
  152. ! #include <sys/file.h>
  153.   #include <sys/stat.h>
  154. ! #include <sys/time.h>
  155. ! #include <tzfile.h>
  156.   #include <stdio.h>
  157.   #include <ctype.h>
  158.   #include <paths.h>
  159.   #include "finger.h"
  160.   
  161.   #define    LINE_LEN    80
  162. --- 39,51 ----
  163.   #endif /* not lint */
  164.   
  165.   #include <sys/types.h>
  166. ! #include <fcntl.h>
  167.   #include <sys/stat.h>
  168. ! #include <time.h>
  169.   #include <stdio.h>
  170.   #include <ctype.h>
  171.   #include <paths.h>
  172. + #include <tzfile.h>
  173.   #include "finger.h"
  174.   
  175.   #define    LINE_LEN    80
  176. ***************
  177. *** 146,152 ****
  178.           case LOGGEDIN:
  179.               tp = localtime(&w->loginat);
  180.               t = asctime(tp);
  181. !             tzn = tp->tm_zone;
  182.               cpr = printf("On since %.16s (%s) on %s",
  183.                   t, tzn, w->tty);
  184.               /*
  185. --- 146,152 ----
  186.           case LOGGEDIN:
  187.               tp = localtime(&w->loginat);
  188.               t = asctime(tp);
  189. !             tzn = tp->tm_name;
  190.               cpr = printf("On since %.16s (%s) on %s",
  191.                   t, tzn, w->tty);
  192.               /*
  193. ***************
  194. *** 165,174 ****
  195. --- 165,176 ----
  196.                   }
  197.                   cpr += printf("%d:%02d",
  198.                       delta->tm_hour, delta->tm_min);
  199. + #ifdef UT_HOSTSIZE
  200.                   if (*w->host) {
  201.                       putchar(',');
  202.                       ++cpr;
  203.                   }
  204. + #endif
  205.               }
  206.               if (!w->writable)
  207.                   cpr += printf(" (messages off)");
  208. ***************
  209. *** 180,186 ****
  210.               }
  211.               tp = localtime(&w->loginat);
  212.               t = asctime(tp);
  213. !             tzn = tp->tm_zone;
  214.               if (now - w->loginat > SECSPERDAY * DAYSPERNYEAR / 2)
  215.                   cpr =
  216.                       printf("Last login %.16s %.4s (%s) on %s",
  217. --- 182,188 ----
  218.               }
  219.               tp = localtime(&w->loginat);
  220.               t = asctime(tp);
  221. !             tzn = tp->tm_name;
  222.               if (now - w->loginat > SECSPERDAY * DAYSPERNYEAR / 2)
  223.                   cpr =
  224.                       printf("Last login %.16s %.4s (%s) on %s",
  225. ***************
  226. *** 190,200 ****
  227. --- 192,204 ----
  228.                       t, tzn, w->tty);
  229.               break;
  230.           }
  231. + #ifdef UT_HOSTSIZE
  232.           if (*w->host) {
  233.               if (LINE_LEN < (cpr + 6 + strlen(w->host)))
  234.                   (void)printf("\n   ");
  235.               (void)printf(" from %s", w->host);
  236.           }
  237. + #endif
  238.           putchar('\n');
  239.       }
  240.   }
  241. *** finger/paths.h.~1~    Mon Jul 27 04:04:41 1992
  242. --- finger/paths.h    Mon Jul 27 03:44:24 1992
  243. ***************
  244. *** 0 ****
  245. --- 1,8 ----
  246. + #ifndef _PATHS_H
  247. + # define _PATHS_H
  248. + # define _PATH_BSHELL "/bin/sh"
  249. + # define _PATH_DEV "/dev/"
  250. + # define _PATH_LASTLOG "/etc/lastlog"
  251. + #endif
  252. *** finger/sprint.c.~1~    Mon Jul 27 00:48:47 1992
  253. --- finger/sprint.c    Mon Jul 27 01:58:32 1992
  254. ***************
  255. *** 39,45 ****
  256.   #endif /* not lint */
  257.   
  258.   #include <sys/types.h>
  259. ! #include <sys/time.h>
  260.   #include <tzfile.h>
  261.   #include <stdio.h>
  262.   #include "finger.h"
  263. --- 39,45 ----
  264.   #endif /* not lint */
  265.   
  266.   #include <sys/types.h>
  267. ! #include <time.h>
  268.   #include <tzfile.h>
  269.   #include <stdio.h>
  270.   #include "finger.h"
  271. *** finger/strsep.c.~1~    Mon Jul 27 04:05:01 1992
  272. --- finger/strsep.c    Mon Jul 27 03:53:30 1992
  273. ***************
  274. *** 0 ****
  275. --- 1,79 ----
  276. + /*-
  277. +  * Copyright (c) 1990 The Regents of the University of California.
  278. +  * All rights reserved.
  279. +  *
  280. +  * Redistribution and use in source and binary forms, with or without
  281. +  * modification, are permitted provided that the following conditions
  282. +  * are met:
  283. +  * 1. Redistributions of source code must retain the above copyright
  284. +  *    notice, this list of conditions and the following disclaimer.
  285. +  * 2. Redistributions in binary form must reproduce the above copyright
  286. +  *    notice, this list of conditions and the following disclaimer in the
  287. +  *    documentation and/or other materials provided with the distribution.
  288. +  * 3. All advertising materials mentioning features or use of this software
  289. +  *    must display the following acknowledgement:
  290. +  *    This product includes software developed by the University of
  291. +  *    California, Berkeley and its contributors.
  292. +  * 4. Neither the name of the University nor the names of its contributors
  293. +  *    may be used to endorse or promote products derived from this software
  294. +  *    without specific prior written permission.
  295. +  *
  296. +  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  297. +  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  298. +  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  299. +  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  300. +  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  301. +  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  302. +  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  303. +  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  304. +  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  305. +  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  306. +  * SUCH DAMAGE.
  307. +  */
  308. + #include <string.h>
  309. + #include <stdio.h>
  310. + #if defined(LIBC_SCCS) && !defined(lint)
  311. + static const char sccsid[] = "@(#)strsep.c    5.4 (Berkeley) 1/26/91";
  312. + #endif /* LIBC_SCCS and not lint */
  313. + /*
  314. +  * Get next token from string *stringp, where tokens are nonempty
  315. +  * strings separated by characters from delim.  
  316. +  *
  317. +  * Writes NULs into the string at *stringp to end tokens.
  318. +  * delim need not remain constant from call to call.
  319. +  * On return, *stringp points past the last NUL written (if there might
  320. +  * be further tokens), or is NULL (if there are definitely no more tokens).
  321. +  *
  322. +  * If *stringp is NULL, strtoken returns NULL.
  323. +  */
  324. + char *
  325. + strsep(stringp, delim)
  326. +     register char **stringp;
  327. +     register const char *delim;
  328. + {
  329. +     register char *s;
  330. +     register const char *spanp;
  331. +     register int c, sc;
  332. +     char *tok;
  333. +     if ((s = *stringp) == NULL)
  334. +         return (NULL);
  335. +     for (tok = s;;) {
  336. +         c = *s++;
  337. +         spanp = delim;
  338. +         do {
  339. +             if ((sc = *spanp++) == c) {
  340. +                 if (c == 0)
  341. +                     s = NULL;
  342. +                 else
  343. +                     s[-1] = 0;
  344. +                 *stringp = s;
  345. +                 return (tok);
  346. +             }
  347. +         } while (sc != 0);
  348. +     }
  349. +     /* NOTREACHED */
  350. + }
  351. *** finger/tzfile.h.~1~    Mon Jul 27 04:05:24 1992
  352. --- finger/tzfile.h    Mon Jul 27 00:58:38 1992
  353. ***************
  354. *** 0 ****
  355. --- 1,54 ----
  356. + /*
  357. +  * Copyright (c) 1988 Regents of the University of California.
  358. +  * All rights reserved.
  359. +  *
  360. +  * This code is derived from software contributed to Berkeley by
  361. +  * Arthur David Olson of the National Cancer Institute.
  362. +  *
  363. +  * Redistribution and use in source and binary forms, with or without
  364. +  * modification, are permitted provided that the following conditions
  365. +  * are met:
  366. +  * 1. Redistributions of source code must retain the above copyright
  367. +  *    notice, this list of conditions and the following disclaimer.
  368. +  * 2. Redistributions in binary form must reproduce the above copyright
  369. +  *    notice, this list of conditions and the following disclaimer in the
  370. +  *    documentation and/or other materials provided with the distribution.
  371. +  * 3. All advertising materials mentioning features or use of this software
  372. +  *    must display the following acknowledgement:
  373. +  *    This product includes software developed by the University of
  374. +  *    California, Berkeley and its contributors.
  375. +  * 4. Neither the name of the University nor the names of its contributors
  376. +  *    may be used to endorse or promote products derived from this software
  377. +  *    without specific prior written permission.
  378. +  *
  379. +  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  380. +  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  381. +  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  382. +  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  383. +  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  384. +  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  385. +  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  386. +  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  387. +  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  388. +  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  389. +  * SUCH DAMAGE.
  390. +  *
  391. +  *    @(#)tzfile.h    5.10 (Berkeley) 4/3/91
  392. +  */
  393. + #ifndef _TZFILE_H_
  394. + #define    _TZFILE_H_
  395. + #define SECSPERMIN    60
  396. + #define MINSPERHOUR    60
  397. + #define HOURSPERDAY    24
  398. + #define DAYSPERWEEK    7
  399. + #define DAYSPERNYEAR    365
  400. + #define DAYSPERLYEAR    366
  401. + #define SECSPERHOUR    (SECSPERMIN * MINSPERHOUR)
  402. + #define SECSPERDAY    ((long) SECSPERHOUR * HOURSPERDAY)
  403. + #define MONSPERYEAR    12
  404. + #define TM_SUNDAY    0
  405. + #endif /* !_TZFILE_H_ */
  406. *** finger/util.c.~1~    Mon Jul 27 00:48:48 1992
  407. --- finger/util.c    Mon Jul 27 03:49:42 1992
  408. ***************
  409. *** 38,46 ****
  410.   static char sccsid[] = "@(#)util.c    5.14 (Berkeley) 1/17/91";
  411.   #endif /* not lint */
  412.   
  413.   #include <sys/param.h>
  414.   #include <sys/stat.h>
  415. ! #include <sys/file.h>
  416.   #include <stdio.h>
  417.   #include <ctype.h>
  418.   #include <string.h>
  419. --- 38,48 ----
  420.   static char sccsid[] = "@(#)util.c    5.14 (Berkeley) 1/17/91";
  421.   #endif /* not lint */
  422.   
  423. + #include <unistd.h>
  424. + #include <sys/types.h>
  425.   #include <sys/param.h>
  426.   #include <sys/stat.h>
  427. ! #include <fcntl.h>
  428.   #include <stdio.h>
  429.   #include <ctype.h>
  430.   #include <string.h>
  431. ***************
  432. *** 150,156 ****
  433.           opened = 1;
  434.       }
  435.       if (fd == -1 ||
  436. !         lseek(fd, (long)pn->uid * sizeof(ll), L_SET) !=
  437.           (long)pn->uid * sizeof(ll) ||
  438.           read(fd, (char *)&ll, sizeof(ll)) != sizeof(ll)) {
  439.               /* as if never logged in */
  440. --- 152,158 ----
  441.           opened = 1;
  442.       }
  443.       if (fd == -1 ||
  444. !         lseek(fd, (long)pn->uid * sizeof(ll), SEEK_SET) !=
  445.           (long)pn->uid * sizeof(ll) ||
  446.           read(fd, (char *)&ll, sizeof(ll)) != sizeof(ll)) {
  447.               /* as if never logged in */
  448. ***************
  449. *** 179,186 ****
  450. --- 181,190 ----
  451.           w->info = LASTLOG;
  452.           bcopy(ll.ll_line, w->tty, UT_LINESIZE);
  453.           w->tty[UT_LINESIZE] = 0;
  454. + #ifdef UT_HOSTSIZE
  455.           bcopy(ll.ll_host, w->host, UT_HOSTSIZE);
  456.           w->host[UT_HOSTSIZE] = 0;
  457. + #endif
  458.           w->loginat = ll.ll_time;
  459.       }
  460.   }
  461. ***************
  462. *** 194,201 ****
  463. --- 198,207 ----
  464.       w->info = LOGGEDIN;
  465.       bcopy(ut->ut_line, w->tty, UT_LINESIZE);
  466.       w->tty[UT_LINESIZE] = 0;
  467. + #ifdef UT_HOSTSIZE
  468.       bcopy(ut->ut_host, w->host, UT_HOSTSIZE);
  469.       w->host[UT_HOSTSIZE] = 0;
  470. + #endif
  471.       w->loginat = (time_t)ut->ut_time;
  472.       find_idle_and_ttywrite(w);
  473.   }
  474. -- 
  475. Sean Eric Fagan  | "My psychiatrist says I have a messiah
  476. sef@kithrup.COM  |  complex.  But I forgive him."
  477. -----------------+              -- Jim Carrey
  478. Any opinions expressed are my own, and generally unpopular with others.
  479.