home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / misc / volume30 / tin / part03 < prev    next >
Encoding:
Text File  |  1992-05-19  |  55.2 KB  |  2,391 lines

  1. Newsgroups: comp.sources.misc
  2. From: iain%anl433.uucp@germany.eu.net (Iain J. Lea)
  3. Subject:  v30i003:  tin - threaded full screen newsreader, Part03/14
  4. Message-ID: <1992May20.172213.28619@sparky.imd.sterling.com>
  5. X-Md4-Signature: 20ce6cf814ad2429d2ff7d346223b4bc
  6. Date: Wed, 20 May 1992 17:22:13 GMT
  7. Approved: kent@sparky.imd.sterling.com
  8.  
  9. Submitted-by: iain%anl433.uucp@germany.eu.net (Iain J. Lea)
  10. Posting-number: Volume 30, Issue 3
  11. Archive-name: tin/part03
  12. Environment: BSD, SCO, ISC, SUNOS, SYSVR3, SYSVR4, ULTRIX, XENIX
  13. Supersedes: tin: Volume 29, Issue 19-30
  14.  
  15. #! /bin/sh
  16. # This is a shell archive.  Remove anything before this line, then feed it
  17. # into a shell via "sh file" or similar.  To overwrite existing files,
  18. # type "sh file -c".
  19. # The tool that generated this appeared in the comp.sources.unix newsgroup;
  20. # send mail to comp-sources-unix@uunet.uu.net if you want that tool.
  21. # Contents:  server.patch thread.c
  22. # Wrapped by kent@sparky on Tue May 19 13:38:02 1992
  23. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  24. echo If this archive is complete, you will see the following message:
  25. echo '          "shar: End of archive 3 (of 14)."'
  26. if test -f 'server.patch' -a "${1}" != "-c" ; then 
  27.   echo shar: Will not clobber existing file \"'server.patch'\"
  28. else
  29.   echo shar: Extracting \"'server.patch'\" \(34102 characters\)
  30.   sed "s/^X//" >'server.patch' <<'END_OF_FILE'
  31. Xdiff -rcs server.old/Makefile server/Makefile
  32. X*** server.old/Makefile    Mon May  4 07:03:54 1992
  33. X--- server/Makefile    Mon May  4 07:16:35 1992
  34. X***************
  35. X*** 6,18 ****
  36. X      ahbs.o globals.o group.o help.o ihave.o list.o misc.o netaux.o \
  37. X      newgroups.o newnews.o nextlast.o ngmatch.o post.o parsit.o scandir.o \
  38. X      slave.o spawn.o strcasecmp.o subnet.o time.o xhdr.o fakesyslog.o \
  39. X!     batch.o auth.o timer.o ../common/version.o
  40. X  
  41. X  SRVRSRC = main.c serve.c access.c access_inet.c access_dnet.c active.c \
  42. X      ahbs.c globals.c group.c help.c ihave.c list.c misc.c netaux.c \
  43. X      newgroups.c newnews.c nextlast.c ngmatch.c post.c parsit.c scandir.c \
  44. X      slave.c spawn.c strcasecmp.c subnet.c time.c xhdr.c fakesyslog.c \
  45. X!     batch.c auth.c timer.c ../common/version.c
  46. X  
  47. X  SRVRINC = common.h ../common/conf.h ../common/nntp.h timer.h
  48. X  
  49. X--- 6,18 ----
  50. X      ahbs.o globals.o group.o help.o ihave.o list.o misc.o netaux.o \
  51. X      newgroups.o newnews.o nextlast.o ngmatch.o post.o parsit.o scandir.o \
  52. X      slave.o spawn.o strcasecmp.o subnet.o time.o xhdr.o fakesyslog.o \
  53. X!     batch.o auth.o timer.o ../common/version.o xuser.o xindex.o
  54. X  
  55. X  SRVRSRC = main.c serve.c access.c access_inet.c access_dnet.c active.c \
  56. X      ahbs.c globals.c group.c help.c ihave.c list.c misc.c netaux.c \
  57. X      newgroups.c newnews.c nextlast.c ngmatch.c post.c parsit.c scandir.c \
  58. X      slave.c spawn.c strcasecmp.c subnet.c time.c xhdr.c fakesyslog.c \
  59. X!     batch.c auth.c timer.c ../common/version.c xuser.c xindex.c
  60. X  
  61. X  SRVRINC = common.h ../common/conf.h ../common/nntp.h timer.h
  62. X  
  63. XFiles server.old/README and server/README are identical
  64. XFiles server.old/SYSLOG and server/SYSLOG are identical
  65. Xdiff -rcs server.old/access.c server/access.c
  66. X*** server.old/access.c    Mon May  4 07:03:55 1992
  67. X--- server/access.c    Sat Mar  7 11:46:00 1992
  68. X***************
  69. X*** 44,50 ****
  70. X  
  71. X  #ifdef AUTH
  72. X  extern    int Needauth;
  73. X! #endif AUTH
  74. X  
  75. X  host_access(canread, canpost, canxfer, gdlist)
  76. X      int        *canread, *canpost, *canxfer;
  77. X--- 44,50 ----
  78. X  
  79. X  #ifdef AUTH
  80. X  extern    int Needauth;
  81. X! #endif /* AUTH */
  82. X  
  83. X  host_access(canread, canpost, canxfer, gdlist)
  84. X      int        *canread, *canpost, *canxfer;
  85. X***************
  86. X*** 230,236 ****
  87. X      /* do we require a userid and password for this guy? */
  88. X      if (isupper(readperm[0]) || isupper(postperm[0]))
  89. X          Needauth = 1;
  90. X! #endif AUTH
  91. X  }
  92. X  
  93. X  #ifdef DOMAINMATCH
  94. X--- 230,236 ----
  95. X      /* do we require a userid and password for this guy? */
  96. X      if (isupper(readperm[0]) || isupper(postperm[0]))
  97. X          Needauth = 1;
  98. X! #endif /* AUTH */
  99. X  }
  100. X  
  101. X  #ifdef DOMAINMATCH
  102. X***************
  103. X*** 267,270 ****
  104. X  
  105. X      return (0);
  106. X  }
  107. X! #endif DOMAINMATCH
  108. X--- 267,270 ----
  109. X  
  110. X      return (0);
  111. X  }
  112. X! #endif /* DOMAINMATCH */
  113. XFiles server.old/access_dnet.c and server/access_dnet.c are identical
  114. Xdiff -rcs server.old/access_inet.c server/access_inet.c
  115. X*** server.old/access_inet.c    Mon May  4 07:03:55 1992
  116. X--- server/access_inet.c    Sat Mar  7 11:46:00 1992
  117. X***************
  118. X*** 77,83 ****
  119. X      }
  120. X  #else
  121. X      subnet_name[0] = '\0';
  122. X! #endif SUBNET
  123. X  
  124. X      hp = gethostbyaddr((char *) &sin->sin_addr.s_addr,
  125. X          sizeof (sin->sin_addr.s_addr), AF_INET);
  126. X--- 77,83 ----
  127. X      }
  128. X  #else
  129. X      subnet_name[0] = '\0';
  130. X! #endif /* SUBNET */
  131. X  
  132. X      hp = gethostbyaddr((char *) &sin->sin_addr.s_addr,
  133. X          sizeof (sin->sin_addr.s_addr), AF_INET);
  134. XFiles server.old/active.c and server/active.c are identical
  135. XFiles server.old/ahbs.c and server/ahbs.c are identical
  136. Xdiff -rcs server.old/auth.c server/auth.c
  137. X*** server.old/auth.c    Mon May  4 07:03:55 1992
  138. X--- server/auth.c    Sat Mar  7 11:46:00 1992
  139. X***************
  140. X*** 149,152 ****
  141. X      Needauth = 0;
  142. X  }
  143. X  
  144. X! #endif AUTH
  145. X--- 149,152 ----
  146. X      Needauth = 0;
  147. X  }
  148. X  
  149. X! #endif /* AUTH */
  150. Xdiff -rcs server.old/batch.c server/batch.c
  151. X*** server.old/batch.c    Mon May  4 07:03:55 1992
  152. X--- server/batch.c    Sat Mar  7 11:46:00 1992
  153. X***************
  154. X*** 255,265 ****
  155. X  #ifdef SYSLOG
  156. X  #ifdef LOG
  157. X      syslog(LOG_ERR, "%s transfer_timeout", hostname);
  158. X! #endif LOG
  159. X  #endif
  160. X      (void) unlink(tempfile);
  161. X      exit(1);
  162. X! #endif XFER_TIMEOUT
  163. X  }
  164. X  
  165. X  /*
  166. X--- 255,265 ----
  167. X  #ifdef SYSLOG
  168. X  #ifdef LOG
  169. X      syslog(LOG_ERR, "%s transfer_timeout", hostname);
  170. X! #endif /* LOG */
  171. X  #endif
  172. X      (void) unlink(tempfile);
  173. X      exit(1);
  174. X! #endif /* XFER_TIMEOUT */
  175. X  }
  176. X  
  177. X  /*
  178. Xdiff -rcs server.old/common.h server/common.h
  179. X*** server.old/common.h    Mon May  4 07:03:55 1992
  180. X--- server/common.h    Sun Mar  8 11:26:19 1992
  181. X***************
  182. X*** 48,53 ****
  183. X--- 48,56 ----
  184. X  #endif
  185. X  #else /* not NDIR */
  186. X  # include <sys/dir.h>
  187. X+ # ifdef ISC
  188. X+ #  include <sys/dirent.h>
  189. X+ # endif
  190. X  #endif /* not NDIR */
  191. X  
  192. X  #ifdef FCNTL
  193. X***************
  194. X*** 157,162 ****
  195. X--- 160,166 ----
  196. X  extern    char    spooldir[];
  197. X  extern    char    activefile[];
  198. X  extern    char    distributionsfile[];
  199. X+ extern    char    subscriptionsfile[];
  200. X  extern    char    newsgroupsfile[];
  201. X  extern    char    accessfile[];
  202. X  extern    char    historyfile[];
  203. XOnly in server: cscope.out
  204. Xdiff -rcs server.old/fakesyslog.c server/fakesyslog.c
  205. X*** server.old/fakesyslog.c    Mon May  4 07:03:55 1992
  206. X--- server/fakesyslog.c    Sat Mar  7 11:46:00 1992
  207. X***************
  208. X*** 138,144 ****
  209. X      (void) strcpy(buf, ctime(&clock)+4);
  210. X      *(bp = buf + 16) = '\0';
  211. X  
  212. X!     (void) sprintf(bp, "localhost %s", ident ? ident : "");
  213. X      bp += strlen(bp);
  214. X  
  215. X      if (opt&LOG_PID) {
  216. X--- 138,145 ----
  217. X      (void) strcpy(buf, ctime(&clock)+4);
  218. X      *(bp = buf + 16) = '\0';
  219. X  
  220. X! /*    (void) sprintf(bp, "localhost %s", ident ? ident : ""); */
  221. X!     (void) sprintf(bp, "local %s", ident ? ident : "");
  222. X      bp += strlen(bp);
  223. X  
  224. X      if (opt&LOG_PID) {
  225. Xdiff -rcs server.old/fakesyslog.h server/fakesyslog.h
  226. X*** server.old/fakesyslog.h    Mon May  4 07:03:55 1992
  227. X--- server/fakesyslog.h    Thu Feb 20 08:27:03 1992
  228. X***************
  229. X*** 62,65 ****
  230. X  #define LOG_NDELAY    0
  231. X  #define LOG_NOWAIT    0
  232. X  
  233. X! #endif FAKESYSLOG
  234. X--- 62,65 ----
  235. X  #define LOG_NDELAY    0
  236. X  #define LOG_NOWAIT    0
  237. X  
  238. X! #endif /* FAKESYSLOG */
  239. Xdiff -rcs server.old/globals.c server/globals.c
  240. X*** server.old/globals.c    Mon May  4 07:03:56 1992
  241. X--- server/globals.c    Sun Mar  8 11:25:47 1992
  242. X***************
  243. X*** 16,21 ****
  244. X--- 16,22 ----
  245. X  char    activefile[] = ACTIVE_FILE;
  246. X  char    accessfile[] = ACCESS_FILE;
  247. X  char    distributionsfile[] = DISTRIBUTIONS_FILE;
  248. X+ char    subscriptionsfile[] = SUBSCRIPTIONS_FILE;
  249. X  char    newsgroupsfile[] = NEWSGROUPS_FILE;
  250. X  char    historyfile[] = HISTORY_FILE;
  251. X  #ifdef ACTIVE_TIMES_FILE
  252. X***************
  253. X*** 54,60 ****
  254. X  #ifdef AUTH
  255. X  int    Needauth;    /* 1 if we need to do authorization */
  256. X  char    User[10];    /* username for authentication */
  257. X! #endif AUTH
  258. X  
  259. X  #ifdef LOG
  260. X  int    arts_acsd;
  261. X--- 55,61 ----
  262. X  #ifdef AUTH
  263. X  int    Needauth;    /* 1 if we need to do authorization */
  264. X  char    User[10];    /* username for authentication */
  265. X! #endif /* AUTH */
  266. X  
  267. X  #ifdef LOG
  268. X  int    arts_acsd;
  269. Xdiff -rcs server.old/group.c server/group.c
  270. X*** server.old/group.c    Mon May  4 07:03:56 1992
  271. X--- server/group.c    Sat Mar  7 11:46:00 1992
  272. X***************
  273. X*** 49,54 ****
  274. X--- 49,55 ----
  275. X          return;
  276. X      }
  277. X  
  278. X+ 
  279. X      reqlist[0] = argv[1];
  280. X      reqlist[1] = NULL;
  281. X  
  282. X***************
  283. X*** 70,79 ****
  284. X      close_crnt();
  285. X      (void) chdir(spooldir);
  286. X  
  287. X- #ifdef LOG
  288. X-     syslog(LOG_INFO, "%s group %s", hostname, argv[1]);
  289. X- #endif
  290. X- 
  291. X      while ((cp = index(argv[1], '.')) != (char *) NULL)
  292. X          *cp = '/';
  293. X  
  294. X--- 71,76 ----
  295. X***************
  296. X*** 96,101 ****
  297. X--- 93,103 ----
  298. X      art_ptr = 0;
  299. X  
  300. X      ingroup = 1;
  301. X+     
  302. X+ #ifdef LOG    
  303. X+     syslog(LOG_INFO, "%s group=%s  high=%d  low=%d  arts=%d",
  304. X+          hostname, argv[1], high_msg, low_msg, num_arts);
  305. X+ #endif
  306. X  
  307. X      while ((cp = index(argv[1], '/')) != (char *) NULL)
  308. X          *cp = '.';
  309. Xdiff -rcs server.old/help.c server/help.c
  310. X*** server.old/help.c    Mon May  4 07:03:56 1992
  311. X--- server/help.c    Tue Mar 10 08:55:29 1992
  312. X***************
  313. X*** 21,28 ****
  314. X      printf("NEXT        POST         QUIT\r\n");
  315. X      printf("STAT        NEWGROUPS    HELP\r\n");
  316. X      printf("IHAVE       NEWNEWS      SLAVE\r\n");
  317. X!     printf("\r\nAdditionally, the following extention is supported:\r\n\r\n");
  318. X      printf("XHDR        Retrieve a single header line from a range of articles.\r\n");
  319. X      printf("\r\n");
  320. X      printf("Bugs to Stan Barber (Internet: nntp@tmc.edu; UUCP: ...!bcm!nntp)\r\n");
  321. X      printf(".\r\n");
  322. X--- 21,38 ----
  323. X      printf("NEXT        POST         QUIT\r\n");
  324. X      printf("STAT        NEWGROUPS    HELP\r\n");
  325. X      printf("IHAVE       NEWNEWS      SLAVE\r\n");
  326. X! #if defined(XHDR) || defined(XUSER) || defined(XINDEX)
  327. X!     printf("\r\nAdditionally, the following extentions are supported:\r\n\r\n");
  328. X! #  ifdef XHDR
  329. X      printf("XHDR        Retrieve a single header line from a range of articles.\r\n");
  330. X+ #  endif
  331. X+ #  ifdef XUSER    
  332. X+     printf("XUSER       Log a clients username to nntp logfile.\r\n");
  333. X+ #  endif    
  334. X+ #  ifdef XINDEX
  335. X+     printf("XINDEX      Retrieve a tin group index file.\r\n");
  336. X+ #  endif    
  337. X+ #endif    
  338. X      printf("\r\n");
  339. X      printf("Bugs to Stan Barber (Internet: nntp@tmc.edu; UUCP: ...!bcm!nntp)\r\n");
  340. X      printf(".\r\n");
  341. Xdiff -rcs server.old/ihave.c server/ihave.c
  342. X*** server.old/ihave.c    Mon May  4 07:03:56 1992
  343. X--- server/ihave.c    Sat Mar  7 11:46:00 1992
  344. X***************
  345. X*** 8,14 ****
  346. X  int    ih_accepted;
  347. X  int    ih_rejected;
  348. X  int    ih_failed;
  349. X! #endif LOG
  350. X  
  351. X  /*
  352. X   * IHAVE <messageid>
  353. X--- 8,14 ----
  354. X  int    ih_accepted;
  355. X  int    ih_rejected;
  356. X  int    ih_failed;
  357. X! #endif /* LOG */
  358. X  
  359. X  /*
  360. X   * IHAVE <messageid>
  361. X***************
  362. X*** 50,57 ****
  363. X          ih_rejected++;
  364. X  #ifdef IHAVE_DEBUG
  365. X          syslog(LOG_DEBUG, "%s ihave %s rejected", hostname, argv[1]);
  366. X! #endif IHAVE_DEBUG
  367. X! #endif LOG
  368. X          return;
  369. X      }
  370. X  
  371. X--- 50,57 ----
  372. X          ih_rejected++;
  373. X  #ifdef IHAVE_DEBUG
  374. X          syslog(LOG_DEBUG, "%s ihave %s rejected", hostname, argv[1]);
  375. X! #endif /* IHAVE_DEBUG */
  376. X! #endif /* LOG */
  377. X          return;
  378. X      }
  379. X  
  380. X***************
  381. X*** 100,106 ****
  382. X  #ifdef IHAVE_DEBUG
  383. X      syslog(LOG_DEBUG, "%s ihave %s accepted %s",
  384. X          hostname, argv[1], retcode == 1 ? "succeeded" : "failed");
  385. X! #endif IHAVE_DEBUG
  386. X! #endif LOG
  387. X  
  388. X  }
  389. X--- 100,106 ----
  390. X  #ifdef IHAVE_DEBUG
  391. X      syslog(LOG_DEBUG, "%s ihave %s accepted %s",
  392. X          hostname, argv[1], retcode == 1 ? "succeeded" : "failed");
  393. X! #endif /* IHAVE_DEBUG */
  394. X! #endif /* LOG */
  395. X  
  396. X  }
  397. Xdiff -rcs server.old/list.c server/list.c
  398. X*** server.old/list.c    Mon May  4 07:03:56 1992
  399. X--- server/list.c    Sun Mar  8 11:24:24 1992
  400. X***************
  401. X*** 7,14 ****
  402. X  /*
  403. X   * LIST
  404. X   *
  405. X!  * List active newsgroups, newsgroup descriptions, and distributions.
  406. X   *
  407. X   */
  408. X  
  409. X  list(argc, argv)
  410. X--- 7,17 ----
  411. X  /*
  412. X   * LIST
  413. X   *
  414. X!  * List active newsgroups, newsgroup descriptions, distributions
  415. X!  * and subscriptions.
  416. X   *
  417. X+  *
  418. X+  *
  419. X   */
  420. X  
  421. X  list(argc, argv)
  422. X***************
  423. X*** 45,52 ****
  424. X          filename = newsgroupsfile;
  425. X          items = "newsgroup descriptions";
  426. X          format = "Descriptions in form \"group description\".";
  427. X      } else {
  428. X!         printf("%d Usage: LIST [ACTIVE|NEWSGROUPS|DISTRIBUTIONS]\r\n",
  429. X              ERR_CMDSYN);
  430. X          (void) fflush(stdout);
  431. X          return;
  432. X--- 48,59 ----
  433. X          filename = newsgroupsfile;
  434. X          items = "newsgroup descriptions";
  435. X          format = "Descriptions in form \"group description\".";
  436. X+     } else if (argc == 2 && !strcasecmp(argv[1],"subscriptions")){
  437. X+         filename = subscriptionsfile;
  438. X+         items = "automatic group subscriptions";
  439. X+         format = "Subscriptions in form \"group\".";
  440. X      } else {
  441. X!         printf("%d Usage: LIST [ACTIVE|NEWSGROUPS|DISTRIBUTIONS|SUBSCRIPTIONS]\r\n",
  442. X              ERR_CMDSYN);
  443. X          (void) fflush(stdout);
  444. X          return;
  445. XFiles server.old/main.c and server/main.c are identical
  446. Xdiff -rcs server.old/misc.c server/misc.c
  447. X*** server.old/misc.c    Mon May  4 07:03:56 1992
  448. X--- server/misc.c    Sat Mar  7 11:46:00 1992
  449. X***************
  450. X*** 90,98 ****
  451. X  # ifndef DBM
  452. X  #  ifndef USGHIST
  453. X  #   define USGHIST
  454. X! #  endif not USGHIST
  455. X! # endif not DBM
  456. X! #endif not DBM
  457. X  
  458. X  char *
  459. X  gethistent(msg_id, lookup)
  460. X--- 90,98 ----
  461. X  # ifndef DBM
  462. X  #  ifndef USGHIST
  463. X  #   define USGHIST
  464. X! #  endif /* not USGHIST */
  465. X! # endif /* not DBM */
  466. X! #endif /* not DBM */
  467. X  
  468. X  char *
  469. X  gethistent(msg_id, lookup)
  470. X***************
  471. X*** 107,121 ****
  472. X  #ifdef USGHIST
  473. X      char        *histfile();
  474. X      register int    len;
  475. X! #else not USGHIST
  476. X  #ifdef DBM
  477. X      static int    dbopen = 0;
  478. X      datum        fetch();
  479. X! #else not DBM
  480. X      static DBM    *db = NULL;    /* History file, dbm version */
  481. X! #endif DBM
  482. X!     datum         key, content;
  483. X! #endif USGHIST
  484. X      static FILE    *hfp = NULL;    /* history file, text version */
  485. X  
  486. X  #ifdef CNEWS
  487. X--- 107,121 ----
  488. X  #ifdef USGHIST
  489. X      char        *histfile();
  490. X      register int    len;
  491. X! #else /* not USGHIST */
  492. X  #ifdef DBM
  493. X      static int    dbopen = 0;
  494. X      datum        fetch();
  495. X! #else /* not DBM */
  496. X      static DBM    *db = NULL;    /* History file, dbm version */
  497. X! #endif /* DBM */
  498. X!      datum         key, content;
  499. X! #endif /* USGHIST */
  500. X      static FILE    *hfp = NULL;    /* history file, text version */
  501. X  
  502. X  #ifdef CNEWS
  503. X***************
  504. X*** 140,146 ****
  505. X      if (hfp == NULL) {
  506. X  #ifdef SYSLOG
  507. X          syslog(LOG_ERR, "gethistent: histfile: %m");
  508. X! #endif SYSLOG
  509. X          return (NULL);
  510. X      }
  511. X  
  512. X--- 140,146 ----
  513. X      if (hfp == NULL) {
  514. X  #ifdef SYSLOG
  515. X          syslog(LOG_ERR, "gethistent: histfile: %m");
  516. X! #endif /* SYSLOG */
  517. X          return (NULL);
  518. X      }
  519. X  
  520. X***************
  521. X*** 153,159 ****
  522. X          (void) fclose(hfp);
  523. X          return (NULL);
  524. X      }
  525. X! #else not USGHIST
  526. X  #ifdef DBM
  527. X      if (!dbopen) {
  528. X          if (dbminit(historyfile) < 0) {
  529. X--- 153,159 ----
  530. X          (void) fclose(hfp);
  531. X          return (NULL);
  532. X      }
  533. X! #else /* not USGHIST */
  534. X  #ifdef DBM
  535. X      if (!dbopen) {
  536. X          if (dbminit(historyfile) < 0) {
  537. X***************
  538. X*** 160,166 ****
  539. X  #ifdef SYSLOG
  540. X              syslog(LOG_ERR, "openartbyid: dbminit %s: %m",
  541. X                  historyfile);
  542. X! #endif SYSLOG
  543. X              return (NULL);
  544. X          } else
  545. X              dbopen = 1;
  546. X--- 160,166 ----
  547. X  #ifdef SYSLOG
  548. X              syslog(LOG_ERR, "openartbyid: dbminit %s: %m",
  549. X                  historyfile);
  550. X! #endif /* SYSLOG */
  551. X              return (NULL);
  552. X          } else
  553. X              dbopen = 1;
  554. X***************
  555. X*** 172,182 ****
  556. X  #ifdef SYSLOG
  557. X              syslog(LOG_ERR, "openartbyid: dbm_open %s: %m",
  558. X                  historyfile);
  559. X! #endif SYSLOG
  560. X              return (NULL);
  561. X          }
  562. X      }
  563. X! #endif DBM
  564. X  
  565. X      key.dptr = msg_id;
  566. X      key.dsize = strlen(msg_id) + 1;
  567. X--- 172,182 ----
  568. X  #ifdef SYSLOG
  569. X              syslog(LOG_ERR, "openartbyid: dbm_open %s: %m",
  570. X                  historyfile);
  571. X! #endif /* SYSLOG */
  572. X              return (NULL);
  573. X          }
  574. X      }
  575. X! #endif /* DBM */
  576. X  
  577. X      key.dptr = msg_id;
  578. X      key.dsize = strlen(msg_id) + 1;
  579. X***************
  580. X*** 185,191 ****
  581. X      content = fetch(key);
  582. X  #else    /* ndbm */
  583. X      content = dbm_fetch(db, key);
  584. X! #endif DBM
  585. X      if (content.dptr == NULL)
  586. X          return (NULL);
  587. X  
  588. X--- 185,191 ----
  589. X      content = fetch(key);
  590. X  #else    /* ndbm */
  591. X      content = dbm_fetch(db, key);
  592. X! #endif /* DBM */
  593. X      if (content.dptr == NULL)
  594. X          return (NULL);
  595. X  
  596. X***************
  597. X*** 202,208 ****
  598. X  #ifdef SYSLOG
  599. X              syslog(LOG_ERR, "message: fopen %s: %m",
  600. X                  historyfile);
  601. X! #endif SYSLOG
  602. X              return (NULL);
  603. X          }
  604. X      } else {
  605. X--- 202,208 ----
  606. X  #ifdef SYSLOG
  607. X              syslog(LOG_ERR, "message: fopen %s: %m",
  608. X                  historyfile);
  609. X! #endif /* SYSLOG */
  610. X              return (NULL);
  611. X          }
  612. X      } else {
  613. X***************
  614. X*** 215,226 ****
  615. X  #ifdef SYSLOG
  616. X          syslog(LOG_ERR, "message: %s: fseek to %ld on %d: %m", 
  617. X                 historyfile, ltmp, hfp);
  618. X! #endif SYSLOG
  619. X          return (NULL);
  620. X      }
  621. X  
  622. X      (void) fgets(line, sizeof(line), hfp);
  623. X! #endif USGHIST
  624. X  
  625. X      if ((cp = index(line, '\n')) != NULL)
  626. X          *cp = '\0';
  627. X--- 215,226 ----
  628. X  #ifdef SYSLOG
  629. X          syslog(LOG_ERR, "message: %s: fseek to %ld on %d: %m", 
  630. X                 historyfile, ltmp, hfp);
  631. X! #endif /* SYSLOG */
  632. X          return (NULL);
  633. X      }
  634. X  
  635. X      (void) fgets(line, sizeof(line), hfp);
  636. X! #endif /* USGHIST */
  637. X  
  638. X      if ((cp = index(line, '\n')) != NULL)
  639. X          *cp = '\0';
  640. X***************
  641. X*** 232,238 ****
  642. X          syslog(LOG_ERR,
  643. X          "message: malformed line in history file at %ld bytes, id %s",
  644. X              ltmp, msg_id);
  645. X! #endif SYSLOG
  646. X      if (cp == NULL) return(NULL); /* this article has expired */
  647. X      tmp = cp+1;
  648. X  
  649. X--- 232,238 ----
  650. X          syslog(LOG_ERR,
  651. X          "message: malformed line in history file at %ld bytes, id %s",
  652. X              ltmp, msg_id);
  653. X! #endif /* SYSLOG */
  654. X      if (cp == NULL) return(NULL); /* this article has expired */
  655. X      tmp = cp+1;
  656. X  
  657. X***************
  658. X*** 613,619 ****
  659. X          chr = '0';
  660. X      return chr;
  661. X  }
  662. X! #endif USGHIST
  663. X  #ifdef USG
  664. X  #ifndef GAZETTE
  665. X  bcopy(s, d, l)
  666. X--- 613,619 ----
  667. X          chr = '0';
  668. X      return chr;
  669. X  }
  670. X! #endif /* USGHIST */
  671. X  #ifdef USG
  672. X  #ifndef GAZETTE
  673. X  bcopy(s, d, l)
  674. X***************
  675. X*** 775,781 ****
  676. X  #define blkavail(fs)    ((fs).f_tfree)
  677. X                  /* USG doesn't reserve blocks for root */
  678. X  #define filfree(fs)    ((fs).f_tinode)    
  679. X! #endif USG
  680. X  
  681. X  #ifdef CMU_MACH
  682. X  /* This code supplied by Tom Lane <tgl@cs.cmu.edu> */
  683. X--- 775,781 ----
  684. X  #define blkavail(fs)    ((fs).f_tfree)
  685. X                  /* USG doesn't reserve blocks for root */
  686. X  #define filfree(fs)    ((fs).f_tinode)    
  687. X! #endif /* USG */
  688. X  
  689. X  #ifdef CMU_MACH
  690. X  /* This code supplied by Tom Lane <tgl@cs.cmu.edu> */
  691. X***************
  692. X*** 799,805 ****
  693. X  #define bombed(call)    ((call) < 0)
  694. X  #define blkfree(fs)    ((fs).fsp_free-((fs).fsp_size*(fs).fsp_minfree+99)/100)
  695. X  #define blkavail(fs)    (-1)
  696. X! #endif MACH
  697. X  
  698. X  dfree(spool,free_space)
  699. X  char *spool;
  700. X--- 799,805 ----
  701. X  #define bombed(call)    ((call) < 0)
  702. X  #define blkfree(fs)    ((fs).fsp_free-((fs).fsp_size*(fs).fsp_minfree+99)/100)
  703. X  #define blkavail(fs)    (-1)
  704. X! #endif /* MACH */
  705. X  
  706. X  dfree(spool,free_space)
  707. X  char *spool;
  708. X***************
  709. X*** 825,831 ****
  710. X      return( DFREE_OK );
  711. X  }
  712. X  
  713. X! #else READ_SUPER
  714. X  /*
  715. X   * This code is used if you've got to directly read the superblock
  716. X   * to determine how much space you've got left.  It's copied from
  717. X--- 825,831 ----
  718. X      return( DFREE_OK );
  719. X  }
  720. X  
  721. X! #else /* READ_SUPER */
  722. X  /*
  723. X   * This code is used if you've got to directly read the superblock
  724. X   * to determine how much space you've got left.  It's copied from
  725. X***************
  726. X*** 919,925 ****
  727. X     return( DFREE_OK );
  728. X  }
  729. X  
  730. X! #endif READ_SUPER
  731. X  
  732. X  #ifdef LOAD
  733. X  /*
  734. X--- 919,925 ----
  735. X     return( DFREE_OK );
  736. X  }
  737. X  
  738. X! #endif /* READ_SUPER */
  739. X  
  740. X  #ifdef LOAD
  741. X  /*
  742. X***************
  743. X*** 987,990 ****
  744. X  # endif
  745. X  }
  746. X  #endif
  747. X! #endif LOAD
  748. X--- 987,990 ----
  749. X  # endif
  750. X  }
  751. X  #endif
  752. X! #endif /* LOAD */
  753. Xdiff -rcs server.old/netaux.c server/netaux.c
  754. X*** server.old/netaux.c    Mon May  4 07:03:56 1992
  755. X--- server/netaux.c    Sat Mar  7 11:46:00 1992
  756. X***************
  757. X*** 12,25 ****
  758. X  #include <netinet/in.h>
  759. X  #ifndef EXCELAN
  760. X  #include <netdb.h>
  761. X! #endif not EXCELAN
  762. X  #include <sys/ioctl.h>
  763. X  #include <signal.h>
  764. X  #ifdef USG
  765. X  #include <time.h>
  766. X! #else not USG
  767. X  #include <sys/time.h>
  768. X! #endif USG
  769. X  
  770. X  #ifdef ALONE
  771. X  
  772. X--- 12,25 ----
  773. X  #include <netinet/in.h>
  774. X  #ifndef EXCELAN
  775. X  #include <netdb.h>
  776. X! #endif /* not EXCELAN */
  777. X  #include <sys/ioctl.h>
  778. X  #include <signal.h>
  779. X  #ifdef USG
  780. X  #include <time.h>
  781. X! #else /* not USG */
  782. X  #include <sys/time.h>
  783. X! #endif /* USG */
  784. X  
  785. X  #ifdef ALONE
  786. X  
  787. X***************
  788. X*** 211,217 ****
  789. X      if (setitimer(ITIMER_REAL, &new, &old) < 0) {
  790. X  #ifdef SYSLOG
  791. X          syslog(LOG_ERR, "set_timer: setitimer: %m\n");
  792. X! #endif SYSLOG
  793. X          exit(1);
  794. X      }
  795. X  #endif /* not USG */
  796. X--- 211,217 ----
  797. X      if (setitimer(ITIMER_REAL, &new, &old) < 0) {
  798. X  #ifdef SYSLOG
  799. X          syslog(LOG_ERR, "set_timer: setitimer: %m\n");
  800. X! #endif /* SYSLOG */
  801. X          exit(1);
  802. X      }
  803. X  #endif /* not USG */
  804. XFiles server.old/newgroups.c and server/newgroups.c are identical
  805. Xdiff -rcs server.old/newnews.c server/newnews.c
  806. X*** server.old/newnews.c    Mon May  4 07:03:57 1992
  807. X--- server/newnews.c    Sat Mar  7 11:49:07 1992
  808. X***************
  809. X*** 39,45 ****
  810. X      FILE        *tmplst;
  811. X      int        i;
  812. X      char        *tmpfile;
  813. X! #endif USGHIST
  814. X  
  815. X      if (argc < 4) {
  816. X          printf("%d Usage: NEWNEWS newsgroups yymmdd hhmmss [\"GMT\"] [<distributions>].\r\n",
  817. X--- 39,45 ----
  818. X      FILE        *tmplst;
  819. X      int        i;
  820. X      char        *tmpfile;
  821. X! #endif /* USGHIST */
  822. X  
  823. X      if (argc < 4) {
  824. X          printf("%d Usage: NEWNEWS newsgroups yymmdd hhmmss [\"GMT\"] [<distributions>].\r\n",
  825. X***************
  826. X*** 131,137 ****
  827. X  
  828. X      for (i = 0; i < 9; i++) {
  829. X          sprintf(historyfile, "%s.d/%d", HISTORY_FILE, i);
  830. X! #endif USGHIST
  831. X  
  832. X      fp = fopen(historyfile, "r");
  833. X      if (fp == NULL) {
  834. X--- 131,137 ----
  835. X  
  836. X      for (i = 0; i < 9; i++) {
  837. X          sprintf(historyfile, "%s.d/%d", HISTORY_FILE, i);
  838. X! #endif /* USGHIST */
  839. X  
  840. X      fp = fopen(historyfile, "r");
  841. X      if (fp == NULL) {
  842. X***************
  843. X*** 142,167 ****
  844. X          printf("%d Cannot open history file.\r\n", ERR_FAULT);
  845. X          (void) fflush(stdout);
  846. X          return;
  847. X! #else USGHIST
  848. X          continue;
  849. X! #endif USGHIST
  850. X      }
  851. X  
  852. X  #ifndef USGHIST
  853. X      printf("%d New news by message id follows\r\n", OK_NEWNEWS);
  854. X! #endif not USGHIST
  855. X  
  856. X      if (seekuntil(fp, key, line, sizeof (line)) < 0) {
  857. X  #ifndef USGHIST
  858. X          printf(".\r\n");
  859. X          (void) fflush(stdout);
  860. X! #endif not USGHIST
  861. X          (void) fclose(fp);
  862. X  #ifndef USGHIST
  863. X          return;
  864. X! #else USGHIST
  865. X          continue;
  866. X! #endif USGHIST
  867. X      }
  868. X  
  869. X  /*
  870. X--- 142,167 ----
  871. X          printf("%d Cannot open history file.\r\n", ERR_FAULT);
  872. X          (void) fflush(stdout);
  873. X          return;
  874. X! #else /* USGHIST */
  875. X          continue;
  876. X! #endif /* USGHIST */
  877. X      }
  878. X  
  879. X  #ifndef USGHIST
  880. X      printf("%d New news by message id follows\r\n", OK_NEWNEWS);
  881. X! #endif /* not USGHIST */
  882. X  
  883. X      if (seekuntil(fp, key, line, sizeof (line)) < 0) {
  884. X  #ifndef USGHIST
  885. X          printf(".\r\n");
  886. X          (void) fflush(stdout);
  887. X! #endif /* not USGHIST */
  888. X          (void) fclose(fp);
  889. X  #ifndef USGHIST
  890. X          return;
  891. X! #else /* USGHIST */
  892. X          continue;
  893. X! #endif /* USGHIST */
  894. X      }
  895. X  
  896. X  /*
  897. X***************
  898. X*** 208,216 ****
  899. X  #ifdef USGHIST
  900. X          fputs(line, tmplst);
  901. X          fputc('\n', tmplst);
  902. X! #else not USGHIST
  903. X          putline(line);
  904. X! #endif not USGHIST
  905. X  #ifdef LOG
  906. X          nn_told++;
  907. X  #endif
  908. X--- 208,216 ----
  909. X  #ifdef USGHIST
  910. X          fputs(line, tmplst);
  911. X          fputc('\n', tmplst);
  912. X! #else /* not USGHIST */
  913. X          putline(line);
  914. X! #endif /* not USGHIST */
  915. X  #ifdef LOG
  916. X          nn_told++;
  917. X  #endif
  918. X***************
  919. X*** 235,241 ****
  920. X      (void) fflush(stdout);
  921. X      (void) fclose(tmplst);
  922. X      (void) unlink(tmpfile);
  923. X! #endif USGHIST
  924. X  }
  925. X  
  926. X  
  927. X--- 235,241 ----
  928. X      (void) fflush(stdout);
  929. X      (void) fclose(tmplst);
  930. X      (void) unlink(tmpfile);
  931. X! #endif /* USGHIST */
  932. X  }
  933. X  
  934. X  
  935. XFiles server.old/nextlast.c and server/nextlast.c are identical
  936. XFiles server.old/ngmatch.c and server/ngmatch.c are identical
  937. XFiles server.old/parsit.c and server/parsit.c are identical
  938. XFiles server.old/post.c and server/post.c are identical
  939. XFiles server.old/profile.c and server/profile.c are identical
  940. Xdiff -rcs server.old/scandir.c server/scandir.c
  941. X*** server.old/scandir.c    Mon May  4 07:03:57 1992
  942. X--- server/scandir.c    Sat Mar  7 11:46:00 1992
  943. X***************
  944. X*** 4,9 ****
  945. X--- 4,13 ----
  946. X  
  947. X  #include "common.h"
  948. X  
  949. X+ #ifdef ISC
  950. X+ #    include <dirent.h>
  951. X+ #endif
  952. X+ 
  953. X  /*
  954. X   * scan_dir -- scan the current directory for news articles,
  955. X   *    loading the article numbers into art_array.  Return
  956. X***************
  957. X*** 26,32 ****
  958. X--- 30,40 ----
  959. X  scan_dir(low_msg, high_msg)
  960. X  int    low_msg, high_msg;
  961. X  {
  962. X+ #ifdef ISC
  963. X+     register struct dirent    *dirent;
  964. X+ #else
  965. X      register struct direct    *dirent;
  966. X+ #endif
  967. X      register DIR        *dirp;
  968. X      int            artnum;
  969. X  
  970. X***************
  971. X*** 34,43 ****
  972. X  
  973. X      dirp = opendir(".");
  974. X  
  975. X!     if (dirp == NULL)
  976. X          return (0);
  977. X  
  978. X      while ((dirent = readdir(dirp)) != NULL) {
  979. X          artnum = atoi(dirent->d_name);
  980. X  #ifdef DYNAMIC_ART_ARRAY
  981. X          if (artnum == 0 || artnum < low_msg || artnum > high_msg)
  982. X--- 42,73 ----
  983. X  
  984. X      dirp = opendir(".");
  985. X  
  986. X!     if (dirp == NULL) {
  987. X! #ifdef LOG
  988. X!         syslog(LOG_ERR, "scan_dir(): opendir() failed. Returning num_arts=0");
  989. X! #endif
  990. X          return (0);
  991. X+     }
  992. X  
  993. X      while ((dirent = readdir(dirp)) != NULL) {
  994. X+ 
  995. X+ #ifdef LOG
  996. X+ /*
  997. X+ {
  998. X+         char pwd[256];
  999. X+     
  1000. X+         getcwd (pwd, 255);
  1001. X+ #ifdef ISC
  1002. X+         syslog(LOG_INFO, "%s: d->d_name=%s  d->d_ino=%d  d->d_reclen=%d",
  1003. X+             pwd, dirent->d_name, dirent->d_ino, dirent->d_reclen);
  1004. X+ #else        
  1005. X+         syslog(LOG_INFO, "%s: d->d_name=%s  d->d_ino=%d",
  1006. X+             pwd, dirent->d_name, dirent->d_ino);
  1007. X+ #endif
  1008. X+ }
  1009. X+ */            
  1010. X+ #endif
  1011. X+     
  1012. X          artnum = atoi(dirent->d_name);
  1013. X  #ifdef DYNAMIC_ART_ARRAY
  1014. X          if (artnum == 0 || artnum < low_msg || artnum > high_msg)
  1015. X***************
  1016. X*** 70,75 ****
  1017. X--- 100,110 ----
  1018. X          }
  1019. X          art_array[num_arts] = artnum;
  1020. X           ++num_arts;
  1021. X+ 
  1022. X+ #ifdef LOG
  1023. X+         syslog(LOG_INFO, "scan_dir(): artnum=%d  num_arts=%d", artnum, num_arts);
  1024. X+ #endif
  1025. X+ 
  1026. X  #else
  1027. X          if (artnum != 0 && artnum >= low_msg && artnum <= high_msg)
  1028. X              art_array[num_arts++] = artnum;
  1029. Xdiff -rcs server.old/serve.c server/serve.c
  1030. X*** server.old/serve.c    Mon May  4 07:03:57 1992
  1031. X--- server/serve.c    Tue Mar 10 09:32:32 1992
  1032. X***************
  1033. X*** 17,23 ****
  1034. X  #ifdef LOG
  1035. X  # ifndef USG
  1036. X  #  include <sys/resource.h>
  1037. X! # endif not USG
  1038. X  #endif
  1039. X  
  1040. X  #ifdef TIMERS
  1041. X--- 17,23 ----
  1042. X  #ifdef LOG
  1043. X  # ifndef USG
  1044. X  #  include <sys/resource.h>
  1045. X! # endif /* not USG */
  1046. X  #endif
  1047. X  
  1048. X  #ifdef TIMERS
  1049. X***************
  1050. X*** 27,38 ****
  1051. X  extern    int    ahbs(), group(), help(), ihave();
  1052. X  extern    int    list(), newgroups(), newnews(), nextlast(), post();
  1053. X  extern    int    slave(), stat(), xhdr();
  1054. X  
  1055. X  extern int errno;
  1056. X  
  1057. X  #ifdef AUTH
  1058. X  extern    int    doauth();
  1059. X! #endif AUTH
  1060. X  
  1061. X  static struct cmdent {
  1062. X      char    *cmd_name;
  1063. X--- 27,44 ----
  1064. X  extern    int    ahbs(), group(), help(), ihave();
  1065. X  extern    int    list(), newgroups(), newnews(), nextlast(), post();
  1066. X  extern    int    slave(), stat(), xhdr();
  1067. X+ #ifdef XUSER
  1068. X+ extern    int    xuser();
  1069. X+ #endif
  1070. X+ #ifdef XINDEX
  1071. X+ extern    int    xindex();
  1072. X+ #endif
  1073. X  
  1074. X  extern int errno;
  1075. X  
  1076. X  #ifdef AUTH
  1077. X  extern    int    doauth();
  1078. X! #endif /* AUTH */
  1079. X  
  1080. X  static struct cmdent {
  1081. X      char    *cmd_name;
  1082. X***************
  1083. X*** 43,49 ****
  1084. X      "authcap",    0,    doauth,
  1085. X      "authinfo",    0,    doauth,
  1086. X      "authsys",    0,    doauth,
  1087. X! #endif AUTH
  1088. X      "article",    0,    ahbs,
  1089. X      "body",        0,    ahbs,
  1090. X      "group",    0,    group,
  1091. X--- 49,55 ----
  1092. X      "authcap",    0,    doauth,
  1093. X      "authinfo",    0,    doauth,
  1094. X      "authsys",    0,    doauth,
  1095. X! #endif /* AUTH */
  1096. X      "article",    0,    ahbs,
  1097. X      "body",        0,    ahbs,
  1098. X      "group",    0,    group,
  1099. X***************
  1100. X*** 60,66 ****
  1101. X      "stat",        0,    ahbs,
  1102. X  #ifdef XHDR
  1103. X      "xhdr",        0,    xhdr,
  1104. X! #endif XHDR
  1105. X  };
  1106. X  #define NUMCMDS (sizeof(cmdtbl) / sizeof(struct cmdent))
  1107. X  
  1108. X--- 66,78 ----
  1109. X      "stat",        0,    ahbs,
  1110. X  #ifdef XHDR
  1111. X      "xhdr",        0,    xhdr,
  1112. X! #endif /* XHDR */
  1113. X! #ifdef XUSER
  1114. X!     "xuser",    0,    xuser,
  1115. X! #endif /* XUSER */
  1116. X! #ifdef XINDEX
  1117. X!     "xindex",    0,    xindex,
  1118. X! #endif /* XINDEX */
  1119. X  };
  1120. X  #define NUMCMDS (sizeof(cmdtbl) / sizeof(struct cmdent))
  1121. X  
  1122. X***************
  1123. X*** 98,104 ****
  1124. X  #ifdef AUTH
  1125. X  extern int    Needauth;
  1126. X  extern char    User[];
  1127. X! #endif AUTH
  1128. X  
  1129. X  /*
  1130. X   * serve -- given a connection on stdin/stdout, serve
  1131. X--- 110,116 ----
  1132. X  #ifdef AUTH
  1133. X  extern int    Needauth;
  1134. X  extern char    User[];
  1135. X! #endif /* AUTH */
  1136. X  
  1137. X  /*
  1138. X   * serve -- given a connection on stdin/stdout, serve
  1139. X***************
  1140. X*** 152,158 ****
  1141. X  #ifdef ALONE
  1142. X  #ifndef USG
  1143. X      (void) signal(SIGCHLD, SIG_IGN);
  1144. X! #endif not USG
  1145. X  #endif
  1146. X  
  1147. X      /* Ignore SIGPIPE, since we'll see closed connections with read */
  1148. X--- 164,170 ----
  1149. X  #ifdef ALONE
  1150. X  #ifndef USG
  1151. X      (void) signal(SIGCHLD, SIG_IGN);
  1152. X! #endif /* not USG */
  1153. X  #endif
  1154. X  
  1155. X      /* Ignore SIGPIPE, since we'll see closed connections with read */
  1156. X***************
  1157. X*** 163,169 ****
  1158. X  #ifdef AUTH
  1159. X      Needauth = 1;
  1160. X      strcpy(User,"");
  1161. X! #endif AUTH
  1162. X      host_access(&canread, &canpost, &canxfer, gdbuf);
  1163. X  
  1164. X      if (gethostname(host, sizeof(host)) < 0)
  1165. X--- 175,181 ----
  1166. X  #ifdef AUTH
  1167. X      Needauth = 1;
  1168. X      strcpy(User,"");
  1169. X! #endif /* AUTH */
  1170. X      host_access(&canread, &canpost, &canxfer, gdbuf);
  1171. X  
  1172. X      if (gethostname(host, sizeof(host)) < 0)
  1173. X***************
  1174. X*** 302,308 ****
  1175. X                  (void) fflush(stdout);
  1176. X                  continue;
  1177. X                  }
  1178. X! #endif AUTH
  1179. X              (*cmdtbl[i].cmd_fctn)(argnum, argp);
  1180. X          } else {
  1181. X  #ifdef SYSLOG
  1182. X--- 314,320 ----
  1183. X                  (void) fflush(stdout);
  1184. X                  continue;
  1185. X                  }
  1186. X! #endif /* AUTH */
  1187. X              (*cmdtbl[i].cmd_fctn)(argnum, argp);
  1188. X          } else {
  1189. X  #ifdef SYSLOG
  1190. X***************
  1191. X*** 490,493 ****
  1192. X          user, sys, Tfinish - Tstart);
  1193. X      syslog(LOG_INFO, "%s times %s", hostname, buf);
  1194. X  }
  1195. X! #endif LOG
  1196. X--- 502,505 ----
  1197. X          user, sys, Tfinish - Tstart);
  1198. X      syslog(LOG_INFO, "%s times %s", hostname, buf);
  1199. X  }
  1200. X! #endif /* LOG */
  1201. XFiles server.old/slave.c and server/slave.c are identical
  1202. Xdiff -rcs server.old/spawn.c server/spawn.c
  1203. X*** server.old/spawn.c    Mon May  4 07:03:58 1992
  1204. X--- server/spawn.c    Sat Mar  7 11:46:00 1992
  1205. X***************
  1206. X*** 65,73 ****
  1207. X  #endif
  1208. X  #ifdef USG
  1209. X      int        status;
  1210. X! #else not USG
  1211. X      union wait    status;
  1212. X! #endif not USG
  1213. X      register FILE    *fp;
  1214. X  
  1215. X  #ifdef CNEWS
  1216. X--- 65,73 ----
  1217. X  #endif
  1218. X  #ifdef USG
  1219. X      int        status;
  1220. X! #else /* not USG */
  1221. X      union wait    status;
  1222. X! #endif /* not USG */
  1223. X      register FILE    *fp;
  1224. X  
  1225. X  #ifdef CNEWS
  1226. X***************
  1227. X*** 91,97 ****
  1228. X      */
  1229. X      if (cont_code == CONT_POST)
  1230. X          fprintf(fp, "Nntp-Posting-Host: %s\n", hostname);
  1231. X! #endif AUTH
  1232. X  
  1233. X      printf("%d Ok\r\n", cont_code);
  1234. X      (void) fflush(stdout);
  1235. X--- 91,97 ----
  1236. X      */
  1237. X      if (cont_code == CONT_POST)
  1238. X          fprintf(fp, "Nntp-Posting-Host: %s\n", hostname);
  1239. X! #endif /* AUTH */
  1240. X  
  1241. X      printf("%d Ok\r\n", cont_code);
  1242. X      (void) fflush(stdout);
  1243. X***************
  1244. X*** 332,338 ****
  1245. X  
  1246. X  #ifdef LOG
  1247. X      syslog(LOG_ERR, "%s transfer_timeout", hostname);
  1248. X! #endif LOG
  1249. X  
  1250. X      (void) unlink(tempfile);
  1251. X  
  1252. X--- 332,338 ----
  1253. X  
  1254. X  #ifdef LOG
  1255. X      syslog(LOG_ERR, "%s transfer_timeout", hostname);
  1256. X! #endif /* LOG */
  1257. X  
  1258. X      (void) unlink(tempfile);
  1259. X  
  1260. X***************
  1261. X*** 339,343 ****
  1262. X      exit(1);
  1263. X  }
  1264. X  
  1265. X! #endif XFER_TIMEOUT
  1266. X  
  1267. X--- 339,343 ----
  1268. X      exit(1);
  1269. X  }
  1270. X  
  1271. X! #endif /* XFER_TIMEOUT */
  1272. X  
  1273. XFiles server.old/strcasecmp.c and server/strcasecmp.c are identical
  1274. Xdiff -rcs server.old/subnet.c server/subnet.c
  1275. X*** server.old/subnet.c    Mon May  4 07:03:58 1992
  1276. X--- server/subnet.c    Sat Mar  7 11:46:00 1992
  1277. X***************
  1278. X*** 1,5 ****
  1279. X  #ifndef lint
  1280. X! static    char    *sccsid = "@(#)$Header: subnet.c,v 1.8 90/12/12 02:21:38 sob Exp $";
  1281. X  #endif
  1282. X  
  1283. X  #include "../common/conf.h"
  1284. X--- 1,5 ----
  1285. X  #ifndef lint
  1286. X! static    char    *sccsid = "@(#)$Header: subnet.c,v 1.9 91/03/19 03:02:30 sob Exp $";
  1287. X  #endif
  1288. X  
  1289. X  #include "../common/conf.h"
  1290. X***************
  1291. X*** 7,19 ****
  1292. X  #ifdef SUBNET
  1293. X  
  1294. X  #include <sys/types.h>
  1295. X  #include <sys/socket.h>
  1296. X  #include <netinet/in.h>
  1297. X  #ifndef NETMASK
  1298. X  #include <net/if.h>
  1299. X  #endif
  1300. X  #include <sys/ioctl.h>
  1301. X! 
  1302. X  /*
  1303. X   * The following routines provide a general interface for
  1304. X   * subnet support.  Like the library function "inet_netof",
  1305. X--- 7,26 ----
  1306. X  #ifdef SUBNET
  1307. X  
  1308. X  #include <sys/types.h>
  1309. X+ #ifdef LAI_TCP
  1310. X+ #include <sys/bsdtypes.h>
  1311. X+ #include <sys/stream.h>
  1312. X+ #endif
  1313. X  #include <sys/socket.h>
  1314. X  #include <netinet/in.h>
  1315. X  #ifndef NETMASK
  1316. X  #include <net/if.h>
  1317. X  #endif
  1318. X+ #ifdef LAI_TCP
  1319. X+ #include <sys/sioctl.h>
  1320. X+ #else
  1321. X  #include <sys/ioctl.h>
  1322. X! #endif
  1323. X  /*
  1324. X   * The following routines provide a general interface for
  1325. X   * subnet support.  Like the library function "inet_netof",
  1326. Xdiff -rcs server.old/time.c server/time.c
  1327. X*** server.old/time.c    Mon May  4 07:03:58 1992
  1328. X--- server/time.c    Sat Mar  7 11:46:00 1992
  1329. X***************
  1330. X*** 10,18 ****
  1331. X  #include "common.h"
  1332. X  #ifdef USG
  1333. X  #include <time.h>
  1334. X! #else not USG
  1335. X  #include <sys/time.h>
  1336. X! #endif not USG
  1337. X  
  1338. X  /*
  1339. X   * dtol -- convert date to long integer.  This is not implicitly
  1340. X--- 10,18 ----
  1341. X  #include "common.h"
  1342. X  #ifdef USG
  1343. X  #include <time.h>
  1344. X! #else /* not USG */
  1345. X  #include <sys/time.h>
  1346. X! #endif /* not USG */
  1347. X  
  1348. X  /*
  1349. X   * dtol -- convert date to long integer.  This is not implicitly
  1350. XFiles server.old/time.h and server/time.h are identical
  1351. Xdiff -rcs server.old/timer.c server/timer.c
  1352. X*** server.old/timer.c    Mon May  4 07:03:58 1992
  1353. X--- server/timer.c    Sat Mar  7 11:46:00 1992
  1354. X***************
  1355. X*** 6,17 ****
  1356. X  #ifdef TIMERS
  1357. X  #ifndef lint
  1358. X  static char rcsid[] =
  1359. X!     "@(#) $Header: timer.c,v 1.2 90/12/27 22:16:27 sob Exp $ (NNTP with TIMERS)";
  1360. X  #endif
  1361. X  #else
  1362. X  #ifndef lint
  1363. X  static char rcsid[] =
  1364. X!     "@(#) $Header: timer.c,v 1.2 90/12/27 22:16:27 sob Exp $ (NNTP without TIMERS)";
  1365. X  #endif
  1366. X  #endif
  1367. X  
  1368. X--- 6,17 ----
  1369. X  #ifdef TIMERS
  1370. X  #ifndef lint
  1371. X  static char rcsid[] =
  1372. X!     "@(#) $Header: timer.c,v 1.3 91/03/19 03:02:41 sob Exp $ (NNTP with TIMERS)";
  1373. X  #endif
  1374. X  #else
  1375. X  #ifndef lint
  1376. X  static char rcsid[] =
  1377. X!     "@(#) $Header: timer.c,v 1.3 91/03/19 03:02:41 sob Exp $ (NNTP without TIMERS)";
  1378. X  #endif
  1379. X  #endif
  1380. X  
  1381. X***************
  1382. X*** 18,24 ****
  1383. X  #ifdef TIMERS
  1384. X  #include <sys/time.h>
  1385. X  #include "timer.h"
  1386. X! #ifndef USG
  1387. X  #ifndef FD_SETSIZE
  1388. X  /* Forward compatability */
  1389. X  #define FD_SET(n, p)    ((p)->fds_bits[0] |= (1<<(n)))
  1390. X--- 18,29 ----
  1391. X  #ifdef TIMERS
  1392. X  #include <sys/time.h>
  1393. X  #include "timer.h"
  1394. X! #ifdef USG
  1395. X! #ifdef LAI_TCP
  1396. X! #include <sys/bsdtypes.h>
  1397. X! #define BSDSELECT
  1398. X! #endif
  1399. X! #else
  1400. X  #ifndef FD_SETSIZE
  1401. X  /* Forward compatability */
  1402. X  #define FD_SET(n, p)    ((p)->fds_bits[0] |= (1<<(n)))
  1403. X***************
  1404. X*** 25,30 ****
  1405. X--- 30,36 ----
  1406. X  #define FD_CLR(n, p)    ((p)->fds_bits[0] &= ~(1<<(n)))
  1407. X  #define FD_ISSET(n, p)  ((p)->fds_bits[0] & (1<<(n)))
  1408. X  #define FD_ZERO(p)      ((p)->fds_bits[0] = 0)
  1409. X+ #define BSDSELECT
  1410. X  #endif
  1411. X  #endif
  1412. X  /* non-portable */
  1413. X***************
  1414. X*** 69,75 ****
  1415. X      register int i, n;
  1416. X      register struct timer *tp;
  1417. X      register long secs;
  1418. X! #ifdef USG
  1419. X      long timeout;
  1420. X      long readfds;
  1421. X  #else
  1422. X--- 75,81 ----
  1423. X      register int i, n;
  1424. X      register struct timer *tp;
  1425. X      register long secs;
  1426. X! #ifndef BSDSELECT
  1427. X      long timeout;
  1428. X      long readfds;
  1429. X  #else
  1430. X***************
  1431. X*** 83,89 ****
  1432. X          return(1);
  1433. X  
  1434. X      /* Length of next timeout is minimum of all "timers" */
  1435. X! #ifdef USG
  1436. X      timeout = -1;
  1437. X      for (i = ntimer, tp = timers; i > 0; --i, ++tp)
  1438. X          if (tp->left >= 0 &&
  1439. X--- 89,95 ----
  1440. X          return(1);
  1441. X  
  1442. X      /* Length of next timeout is minimum of all "timers" */
  1443. X! #ifndef BSDSELECT
  1444. X      timeout = -1;
  1445. X      for (i = ntimer, tp = timers; i > 0; --i, ++tp)
  1446. X          if (tp->left >= 0 &&
  1447. X***************
  1448. X*** 114,122 ****
  1449. X      /* Do select */
  1450. X      FD_ZERO(&readfds);
  1451. X      FD_SET(fileno(stdin), &readfds);
  1452. X! #endif /* !USG */
  1453. X      errno = 0;
  1454. X! #ifdef EXCELAN
  1455. X      n = select(fileno(stdin) + 1, &readfds, (long*)0, timeout);
  1456. X  #else
  1457. X      n = select(fileno(stdin) + 1,
  1458. X--- 120,128 ----
  1459. X      /* Do select */
  1460. X      FD_ZERO(&readfds);
  1461. X      FD_SET(fileno(stdin), &readfds);
  1462. X! #endif /* BSDSELECT */
  1463. X      errno = 0;
  1464. X! #if defined(EXCELAN) || defined(ULTRIX)
  1465. X      n = select(fileno(stdin) + 1, &readfds, (long*)0, timeout);
  1466. X  #else
  1467. X      n = select(fileno(stdin) + 1,
  1468. XFiles server.old/timer.h and server/timer.h are identical
  1469. Xdiff -rcs server.old/xhdr.c server/xhdr.c
  1470. X*** server.old/xhdr.c    Mon May  4 07:03:58 1992
  1471. X--- server/xhdr.c    Sat Mar  7 11:46:00 1992
  1472. X***************
  1473. X*** 158,164 ****
  1474. X      }
  1475. X  }
  1476. X  
  1477. X! #else not XHDR
  1478. X  
  1479. X  /* Kludge to get around Greenhills C compiler */
  1480. X  
  1481. X--- 158,164 ----
  1482. X      }
  1483. X  }
  1484. X  
  1485. X! #else /* not XHDR */
  1486. X  
  1487. X  /* Kludge to get around Greenhills C compiler */
  1488. X  
  1489. X***************
  1490. X*** 166,169 ****
  1491. X  {
  1492. X  }
  1493. X  
  1494. X! #endif not XHDR
  1495. X--- 166,169 ----
  1496. X  {
  1497. X  }
  1498. X  
  1499. X! #endif /* not XHDR */
  1500. XOnly in server: xindex.c
  1501. XOnly in server: xuser.c
  1502. END_OF_FILE
  1503.   if test 34102 -ne `wc -c <'server.patch'`; then
  1504.     echo shar: \"'server.patch'\" unpacked with wrong size!
  1505.   fi
  1506.   # end of 'server.patch'
  1507. fi
  1508. if test -f 'thread.c' -a "${1}" != "-c" ; then 
  1509.   echo shar: Will not clobber existing file \"'thread.c'\"
  1510. else
  1511.   echo shar: Extracting \"'thread.c'\" \(17796 characters\)
  1512.   sed "s/^X//" >'thread.c' <<'END_OF_FILE'
  1513. X/*
  1514. X *  Project   : tin - a threaded Netnews reader
  1515. X *  Module    : thread.c
  1516. X *  Author    : I.Lea
  1517. X *  Created   : 01-04-91
  1518. X *  Updated   : 11-05-92
  1519. X *  Notes     :
  1520. X *  Copyright : (c) Copyright 1991-92 by Iain Lea
  1521. X *              You may  freely  copy or  redistribute  this software,
  1522. X *              so  long as there is no profit made from its use, sale
  1523. X *              trade or  reproduction.  You may not change this copy-
  1524. X *              right notice, and it must be included in any copy made
  1525. X */
  1526. X
  1527. X#include    "tin.h"
  1528. X
  1529. Xextern int index_point;
  1530. Xint threaded_on_subject;
  1531. Xstatic int top_thread = 0;
  1532. Xstatic int thread_index_point = 0;
  1533. Xstatic int thread_basenote = 0;
  1534. Xstatic int thread_respnum = 0;
  1535. Xstatic int first_thread_on_screen = 0;
  1536. Xstatic int last_thread_on_screen = 0;
  1537. X
  1538. X
  1539. X/*
  1540. X * show current thread. If threaded on Subject: show
  1541. X *   <respnum> <name>    <respnum> <name>
  1542. X * If threaded on Archive-name: show
  1543. X *   <respnum> <subject> <name>
  1544. X */
  1545. Xint show_thread (respnum, group, group_path)
  1546. X    int respnum;
  1547. X    char *group;
  1548. X    char *group_path;
  1549. X{
  1550. X    int ret_code = TRUE;
  1551. X#ifndef INDEX_DAEMON
  1552. X    int ch;
  1553. X    int i, index, n;
  1554. X    int scroll_lines;
  1555. X
  1556. X    thread_respnum = respnum;
  1557. X    thread_basenote = which_thread (thread_respnum);
  1558. X    top_thread = num_of_responses (thread_basenote) + 1;
  1559. X
  1560. X    if (top_thread <= 0) {
  1561. X        info_message (txt_no_resps_in_thread);
  1562. X        return FALSE;
  1563. X    }
  1564. X
  1565. X    if (arts[thread_respnum].archive != (char *) 0) {
  1566. X        threaded_on_subject = FALSE;
  1567. X    } else {
  1568. X        threaded_on_subject = TRUE;
  1569. X    }
  1570. X
  1571. X    thread_index_point = top_thread;
  1572. X    if (space_mode) {
  1573. X        if (i = new_responses (thread_basenote)) {
  1574. X            for (n=0, i = base[thread_basenote]; i >= 0 ;
  1575. X                 i = arts[i].thread, n++) {
  1576. X                if (arts[i].unread == ART_UNREAD) {
  1577. X                    thread_index_point = n;
  1578. X                    break;
  1579. X                }
  1580. X            }
  1581. X        }
  1582. X    }
  1583. X
  1584. X    if (thread_index_point < 0) {
  1585. X        thread_index_point = 0;
  1586. X    }
  1587. X
  1588. X    show_thread_page ();
  1589. X
  1590. X    while (TRUE) {
  1591. X        ch = (char) ReadCh();
  1592. X
  1593. X        if (ch >= '0' && ch <= '9') {    /* 0 goes to basenote */
  1594. X            prompt_thread_num (ch);
  1595. X        } else switch (ch) {
  1596. X            case ESC:    /* common arrow keys */
  1597. X                switch (get_arrow_key ()) {
  1598. X                    case KEYMAP_UP:
  1599. X                        goto thread_up;
  1600. X
  1601. X                    case KEYMAP_DOWN:
  1602. X                        goto thread_down;
  1603. X
  1604. X                    case KEYMAP_PAGE_UP:
  1605. X                        goto thread_page_up;
  1606. X
  1607. X                    case KEYMAP_PAGE_DOWN:
  1608. X                        goto thread_page_down;
  1609. X
  1610. X                    case KEYMAP_HOME:
  1611. X                        if (thread_index_point != 0) {
  1612. X                            if (0 < first_thread_on_screen) {
  1613. X#ifndef USE_CLEARSCREEN
  1614. X                                erase_thread_arrow ();
  1615. X#endif
  1616. X                                thread_index_point = 0;
  1617. X                                show_thread_page ();
  1618. X                            } else {
  1619. X                                erase_thread_arrow ();
  1620. X                                thread_index_point = 0;
  1621. X                                draw_thread_arrow ();
  1622. X                            }
  1623. X                        }
  1624. X                        break;
  1625. X                    
  1626. X                    case KEYMAP_END:
  1627. X                        goto end_of_thread;
  1628. X                }
  1629. X                break;
  1630. X
  1631. X            case '$':    /* show last page of threads */
  1632. Xend_of_thread:            
  1633. X                if (thread_index_point < top_thread - 1) {
  1634. X                    if (top_thread > last_thread_on_screen) {
  1635. X#ifndef USE_CLEARSCREEN
  1636. X                        erase_thread_arrow ();
  1637. X#endif                    
  1638. X                        thread_index_point = top_thread - 1;
  1639. X                        show_thread_page ();
  1640. X                    } else {
  1641. X                        erase_thread_arrow ();
  1642. X                        thread_index_point = top_thread - 1;
  1643. X                        draw_thread_arrow ();
  1644. X                    }
  1645. X                }
  1646. X                break;
  1647. X                
  1648. X            case '\r':
  1649. X            case '\n':    /* read current article within thread */
  1650. X                n = choose_response (thread_basenote, thread_index_point);
  1651. X                n = show_page (n, &thread_index_point, group, group_path);
  1652. X                if (n == thread_basenote) {
  1653. X                    show_thread_page ();
  1654. X                } else {
  1655. X                    index_point = n;    
  1656. X                    goto thread_done;
  1657. X                }
  1658. X                break;
  1659. X
  1660. X            case '\t':
  1661. X                 space_mode = TRUE;
  1662. X                if (thread_index_point == 0) {
  1663. X                    n = thread_respnum;
  1664. X                } else {
  1665. X                    n = choose_response (thread_basenote, thread_index_point);
  1666. X                }
  1667. X                index = thread_index_point;
  1668. X                for (i = n ; i != -1 ; i = arts[i].thread) {
  1669. X                    if (arts[i].unread == ART_UNREAD) {
  1670. X                        n = show_page (i, &thread_index_point, group, group_path);
  1671. X                        break;
  1672. X                    }
  1673. X                    index++;
  1674. X                }
  1675. X                if (n == thread_basenote) {
  1676. X                    show_thread_page ();
  1677. X                } else {
  1678. X                    index_point = n;    
  1679. X                    goto thread_done;
  1680. X                }
  1681. X                break;
  1682. X    
  1683. X            case ' ':        /* page down */
  1684. X            case ctrl('D'):        /* vi style */
  1685. X            case ctrl('V'):        /* emacs style */
  1686. Xthread_page_down:
  1687. X                if (thread_index_point + 1 == top_thread) {
  1688. X#ifdef NO_LOOP_AROUND
  1689. X                    break;
  1690. X#else
  1691. X                    if (0 < first_thread_on_screen) {
  1692. X#    ifndef USE_CLEARSCREEN
  1693. X                        erase_thread_arrow ();
  1694. X#    endif                    
  1695. X                        thread_index_point = 0;
  1696. X                        show_thread_page ();
  1697. X                    } else {
  1698. X                        erase_thread_arrow ();
  1699. X                        thread_index_point = 0;
  1700. X                        draw_thread_arrow ();
  1701. X                    }
  1702. X                    break;
  1703. X#endif                    
  1704. X                }
  1705. X                erase_thread_arrow ();
  1706. X                scroll_lines = (full_page_scroll ? NOTESLINES : NOTESLINES / 2);
  1707. X                thread_index_point = ((thread_index_point + scroll_lines) /
  1708. X                            scroll_lines) * scroll_lines;
  1709. X                if (thread_index_point >= top_thread) {
  1710. X                    thread_index_point = (top_thread / scroll_lines) * scroll_lines;
  1711. X                    if (thread_index_point < top_thread - 1) {
  1712. X                        thread_index_point = top_thread - 1;
  1713. X                    }
  1714. X                }
  1715. X                if (thread_index_point < first_thread_on_screen ||
  1716. X                    thread_index_point >= last_thread_on_screen) {
  1717. X                    show_thread_page ();
  1718. X                } else {
  1719. X                    draw_thread_arrow ();
  1720. X                }
  1721. X                break;
  1722. X
  1723. X            case ctrl('L'):        /* redraw screen */
  1724. X            case ctrl('R'):
  1725. X            case ctrl('W'):
  1726. X#ifndef USE_CLEARSCREEN
  1727. X                ClearScreen ();
  1728. X#endif
  1729. X                show_thread_page ();
  1730. X                break;
  1731. X
  1732. X            case ctrl('N'):
  1733. X            case 'j':        /* line down */
  1734. Xthread_down:
  1735. X                if (thread_index_point + 1 >= top_thread) {
  1736. X#ifdef NO_LOOP_AROUND
  1737. X                    break;
  1738. X#else
  1739. X                    if (0 < first_thread_on_screen) {
  1740. X                        thread_index_point = 0;
  1741. X                        show_thread_page ();
  1742. X                    } else {
  1743. X                        erase_thread_arrow ();
  1744. X                        thread_index_point = 0;
  1745. X                        draw_thread_arrow ();
  1746. X                    }
  1747. X                    break;
  1748. X#endif                    
  1749. X                }
  1750. X                if (thread_index_point + 1 >= last_thread_on_screen) {
  1751. X#ifndef USE_CLEARSCREEN
  1752. X                    erase_thread_arrow ();
  1753. X#endif                    
  1754. X                    thread_index_point++;
  1755. X                    show_thread_page ();
  1756. X                } else {
  1757. X                    erase_thread_arrow ();
  1758. X                    thread_index_point++;
  1759. X                    draw_thread_arrow ();
  1760. X                }
  1761. X                break;
  1762. X
  1763. X            case ctrl('P'):
  1764. X            case 'k':        /* line up */
  1765. Xthread_up:
  1766. X                if (thread_index_point == 0) {
  1767. X#ifdef NO_LOOP_AROUND
  1768. X                    break;
  1769. X#else
  1770. X                    if (top_thread > last_thread_on_screen) {
  1771. X                        thread_index_point = top_thread - 1;
  1772. X                        show_thread_page ();
  1773. X                    } else {
  1774. X                        erase_thread_arrow ();
  1775. X                        thread_index_point = top_thread - 1;
  1776. X                        draw_thread_arrow ();
  1777. X                    }
  1778. X                    break;
  1779. X#endif
  1780. X                }
  1781. X                if (thread_index_point <= first_thread_on_screen) {
  1782. X                    thread_index_point--;
  1783. X                    show_thread_page ();
  1784. X                } else {
  1785. X                    erase_thread_arrow ();
  1786. X                    thread_index_point--;
  1787. X                    draw_thread_arrow ();
  1788. X                }
  1789. X                break;
  1790. X
  1791. X            case ctrl('U'):        /* page up */
  1792. X            case 'b':
  1793. Xthread_page_up:
  1794. X                if (thread_index_point == 0) {
  1795. X#ifdef NO_LOOP_AROUND
  1796. X                    break;
  1797. X#else
  1798. X                    if (top_thread > last_thread_on_screen) {
  1799. X                        thread_index_point = top_thread - 1;
  1800. X                        show_thread_page ();
  1801. X                    } else {
  1802. X                        erase_thread_arrow ();
  1803. X                        thread_index_point = top_thread - 1;
  1804. X                        draw_thread_arrow ();
  1805. X                    }
  1806. X                    break;
  1807. X#endif                    
  1808. X                }
  1809. X#ifndef USE_CLEARSCREEN
  1810. X                clear_message ();
  1811. X#endif
  1812. X                erase_thread_arrow ();
  1813. X                scroll_lines = (full_page_scroll ? NOTESLINES : NOTESLINES / 2);
  1814. X                if ((n = thread_index_point % scroll_lines) > 0) {
  1815. X                    thread_index_point = thread_index_point - n;
  1816. X                } else {
  1817. X                    thread_index_point = ((thread_index_point - scroll_lines) / scroll_lines) * scroll_lines;
  1818. X                }
  1819. X                if (thread_index_point < 0) {
  1820. X                    thread_index_point = 0;
  1821. X                }
  1822. X                if (thread_index_point < first_thread_on_screen
  1823. X                || thread_index_point >= last_thread_on_screen)
  1824. X                    show_thread_page ();
  1825. X                else
  1826. X                    draw_thread_arrow ();
  1827. X                break;
  1828. X
  1829. X            case 'B':    /* bug/gripe/comment mailed to author */
  1830. X                mail_bug_report ();
  1831. X#ifndef USE_CLEARSCREEN
  1832. X                ClearScreen ();
  1833. X#endif
  1834. X                show_thread_page ();
  1835. X                break;
  1836. X
  1837. X            case 'c':    /* catchup thread but ask for confirmation */
  1838. X            case 'K':    /* mark thread as read immediately */
  1839. X                if (ch == 'c') {
  1840. X                    if (confirm_action && !prompt_yn (LINES, txt_mark_thread_read, 'y')) {
  1841. X                        break;
  1842. X                    }
  1843. X                }
  1844. X                for (i = (int) base[thread_basenote] ; i != -1 ; i = arts[i].thread) {
  1845. X                    arts[i].unread = ART_READ;
  1846. X                }
  1847. X                goto thread_done;
  1848. X                break;
  1849. X
  1850. X            case 'd':    /* toggle display of subject & subj/author */
  1851. X                if (! threaded_on_subject) {
  1852. X                    toggle_subject_from ();
  1853. X                    show_thread_page ();
  1854. X                }    
  1855. X                break;
  1856. X                
  1857. X            case 'h':    /* help */
  1858. X                show_info_page (HELP_INFO, help_thread, txt_thread_com);
  1859. X                show_thread_page ();
  1860. X                break;
  1861. X
  1862. X            case 'I':    /* toggle inverse video */
  1863. X                toggle_inverse_video ();
  1864. X                show_thread_page ();
  1865. X                break;
  1866. X
  1867. X            case 'q':    /* return to previous level */
  1868. X                goto thread_done;
  1869. X
  1870. X            case 'Q':    /* quit */
  1871. X                ret_code = -2;
  1872. X                goto thread_done;
  1873. X
  1874. X             case 'T':    /* tag/untag art for mailing/piping/printing/saving */
  1875. X                 if (thread_index_point == 0) {
  1876. X                     n = thread_respnum;
  1877. X                 } else {
  1878. X                     n = choose_response (thread_basenote, thread_index_point);
  1879. X                 }
  1880. X                 if (n < 0)
  1881. X                     break;
  1882. X                 if (arts[n].tagged) {
  1883. X                     arts[n].tagged = 0;
  1884. X                     info_message (txt_untagged_art);
  1885. X                 } else {
  1886. X                     arts[n].tagged = ++num_of_tagged_arts;
  1887. X                    info_message (txt_tagged_art);
  1888. X                 }
  1889. X                 show_thread_page ();
  1890. X                 goto thread_down;
  1891. X                break;
  1892. X
  1893. X            case 'v':    /* version */
  1894. X                info_message (cvers);
  1895. X                break;
  1896. X
  1897. X            case 'z':    /* mark article as unread */
  1898. X                if (thread_index_point == 0) {
  1899. X                    n = thread_respnum;
  1900. X                } else {
  1901. X                    n = choose_response (thread_basenote, thread_index_point);
  1902. X                }
  1903. X                if (n >= 0) {
  1904. X                    arts[n].unread = ART_UNREAD;
  1905. X                    show_thread_page ();
  1906. X                    info_message (txt_art_marked_as_unread);
  1907. X                }
  1908. X                break;
  1909. X
  1910. X            case 'Z':    /* mark thread as unread */
  1911. X                for (i = (int) base[thread_basenote] ; i != -1 ; i = arts[i].thread) {
  1912. X                    arts[i].unread = ART_UNREAD;
  1913. X                }
  1914. X                show_thread_page ();
  1915. X                info_message (txt_thread_marked_as_unread);
  1916. X                break;
  1917. X                
  1918. X            default:
  1919. X                info_message (txt_bad_command);
  1920. X        }
  1921. X    }
  1922. X
  1923. Xthread_done:
  1924. X    clear_note_area ();
  1925. X
  1926. X#endif /* INDEX_DAEMON */
  1927. X
  1928. X    return (ret_code);
  1929. X}
  1930. X
  1931. X
  1932. Xvoid show_thread_page ()
  1933. X{
  1934. X#ifndef INDEX_DAEMON
  1935. X
  1936. X    extern int index_point;
  1937. X    char new_resps[8];
  1938. X    char from[LEN];
  1939. X    int i, j;
  1940. X    int len_from;
  1941. X    int len_subj = 0;
  1942. X    int off_subj = 0;
  1943. X    int off_both = 0;
  1944. X    static int index = 0;
  1945. X
  1946. X    set_signals_thread ();
  1947. X    
  1948. X    ClearScreen ();
  1949. X
  1950. X    if (threaded_on_subject) {
  1951. X        sprintf (msg, "Thread (%.*s)", COLS-23, arts[thread_respnum].subject);
  1952. X    } else {
  1953. X        sprintf (msg, "List Thread (%d of %d)", index_point+1, top_base);
  1954. X    }
  1955. X    show_title (msg);
  1956. X
  1957. X    MoveCursor (INDEX_TOP, 0);
  1958. X    if (thread_index_point > top_thread - 1) {
  1959. X        thread_index_point = top_thread - 1;
  1960. X    }
  1961. X
  1962. X    if (NOTESLINES <= 0) {
  1963. X        first_thread_on_screen = 0;
  1964. X    } else {
  1965. X        first_thread_on_screen = (thread_index_point / NOTESLINES) * NOTESLINES;
  1966. X        if (first_thread_on_screen < 0) {
  1967. X            first_thread_on_screen = 0;
  1968. X        }
  1969. X    }
  1970. X
  1971. X    last_thread_on_screen = first_thread_on_screen + NOTESLINES;
  1972. X
  1973. X    if (last_thread_on_screen >= top_thread) {
  1974. X        last_thread_on_screen = top_thread;
  1975. X        first_thread_on_screen = (top_thread / NOTESLINES) * NOTESLINES;
  1976. X
  1977. X        if (first_thread_on_screen == last_thread_on_screen ||
  1978. X            first_thread_on_screen < 0) {
  1979. X            if (first_thread_on_screen < 0) {
  1980. X                first_thread_on_screen = 0;
  1981. X            } else {
  1982. X                first_thread_on_screen = last_thread_on_screen - NOTESLINES;
  1983. X            }
  1984. X        }
  1985. X    }
  1986. X
  1987. X    if (top_thread == 0) {
  1988. X        first_thread_on_screen = 0;
  1989. X        last_thread_on_screen = 0;
  1990. X    }
  1991. X
  1992. X    index = choose_response (thread_basenote, first_thread_on_screen);
  1993. X    assert(first_thread_on_screen != 0 || index == thread_respnum);
  1994. X
  1995. X    if (! draw_arrow_mark) {
  1996. X        off_subj = 2;
  1997. X        off_both = 5;
  1998. X    }    
  1999. X
  2000. X    if (threaded_on_subject) {
  2001. X        len_from = max_subj+max_from+off_both;
  2002. X    } else {
  2003. X        if (show_author != SHOW_FROM_NONE) {
  2004. X            len_from = max_from;
  2005. X            len_subj = max_subj+off_subj;
  2006. X        } else {
  2007. X            len_from = 0;
  2008. X            len_subj = max_from+max_subj+off_subj;
  2009. X        }
  2010. X    }    
  2011. X
  2012. X    for (j=0, i = first_thread_on_screen; j < NOTESLINES && i < last_thread_on_screen; i++, j++) {
  2013. X        if (arts[index].tagged) {
  2014. X            sprintf (new_resps, "%3d", arts[index].tagged);
  2015. X        } else if (arts[index].unread == ART_UNREAD) {
  2016. X            if (arts[index].hot == 0)
  2017. X                sprintf (new_resps, "  %c", UNREAD_ART_MARK);
  2018. X            else
  2019. X                sprintf (new_resps, "  %c", HOT_ART_MARK);
  2020. X        } else if (arts[index].unread == ART_WILL_RETURN) {
  2021. X            sprintf (new_resps, "  %c", RETURN_ART_MARK);
  2022. X        } else {
  2023. X            strcpy (new_resps, "   ");
  2024. X        }
  2025. X
  2026. X        if (threaded_on_subject) {
  2027. X            get_author (TRUE, index, from);
  2028. X            sprintf (screen[j].col, "  %4d%3s  %-*.*s\r\n",
  2029. X                i, new_resps, len_from, len_from, from);
  2030. X        } else {
  2031. X            if (show_author != SHOW_FROM_NONE) {
  2032. X                get_author (TRUE, index, from);
  2033. X            }
  2034. X            sprintf (screen[j].col, "  %4d%3s  %-*.*s   %-*.*s\r\n",
  2035. X                i, new_resps, len_subj, len_subj,
  2036. X                arts[index].subject, len_from, len_from, from);
  2037. X        }
  2038. X        
  2039. X        fputs (screen[j].col, stdout);
  2040. X        
  2041. X        if ((index = next_response (index)) == -1) {
  2042. X            break;
  2043. X        }    
  2044. X    }
  2045. X
  2046. X#ifndef USE_CLEARSCREEN
  2047. X    CleartoEOS ();
  2048. X#endif
  2049. X
  2050. X    if (last_thread_on_screen == top_thread) {
  2051. X        info_message (txt_end_of_thread);
  2052. X    }
  2053. X
  2054. X    draw_thread_arrow ();
  2055. X
  2056. X#endif /* INDEX_DAEMON */
  2057. X}
  2058. X
  2059. X
  2060. Xvoid draw_thread_arrow ()
  2061. X{
  2062. X    draw_arrow (INDEX_TOP + (thread_index_point-first_thread_on_screen));
  2063. X}
  2064. X
  2065. X
  2066. Xvoid erase_thread_arrow ()
  2067. X{
  2068. X    erase_arrow (INDEX_TOP + (thread_index_point-first_thread_on_screen));
  2069. X}
  2070. X
  2071. X
  2072. Xint prompt_thread_num (ch)
  2073. X    char ch;
  2074. X{
  2075. X    int num;
  2076. X
  2077. X    clear_message ();
  2078. X
  2079. X    if ((num = prompt_num (ch, txt_read_art)) == -1) {
  2080. X        clear_message ();
  2081. X        return FALSE;
  2082. X    }
  2083. X
  2084. X    if (num >= top_thread)
  2085. X        num = top_thread - 1;
  2086. X
  2087. X    if (num >= first_thread_on_screen
  2088. X    &&  num < last_thread_on_screen) {
  2089. X        erase_thread_arrow ();
  2090. X        thread_index_point = num;
  2091. X        draw_thread_arrow ();
  2092. X    } else {
  2093. X#ifndef USE_CLEARSCREEN
  2094. X        erase_thread_arrow ();
  2095. X#endif        
  2096. X        thread_index_point = num;
  2097. X        show_thread_page ();
  2098. X    }
  2099. X    return TRUE;
  2100. X}
  2101. X
  2102. X/*
  2103. X *  Return the number of unread articles there are within a thread
  2104. X */
  2105. X
  2106. Xint new_responses (thread)
  2107. X    int thread;
  2108. X{
  2109. X    int i;
  2110. X    int sum = 0;
  2111. X
  2112. X    for (i = (int) base[thread]; i >= 0; i = arts[i].thread) {
  2113. X        if (arts[i].unread) {
  2114. X            sum++;
  2115. X        }
  2116. X    }
  2117. X    
  2118. X    return sum;
  2119. X}
  2120. X
  2121. X/*
  2122. X *  Which base note (an index into base[]) does a respnum
  2123. X *  (an index into arts[]) corresponsd to?
  2124. X *
  2125. X *  In other words, base[] points to an entry in arts[] which is
  2126. X *  the head of a thread, linked with arts[].thread.  For any q: arts[q],
  2127. X *  find i such that base[i]->arts[n]->arts[o]->...->arts[q]
  2128. X *
  2129. X *  Note that which_thread() can return -1 if in show_read_only mode and
  2130. X *  the article of interest has been read as well as all other articles in
  2131. X *  the thread,  thus resulting in no base[] entry for it.
  2132. X */
  2133. X
  2134. Xint which_thread (n)
  2135. X    int n;
  2136. X{
  2137. X    register int i, j;
  2138. X
  2139. X    for (i = 0; i < top_base; i++) {
  2140. X        for (j = (int) base[i] ; j >= 0 ; j = arts[j].thread) {
  2141. X            if (j == n) {
  2142. X                return i;
  2143. X            }
  2144. X        }
  2145. X    }
  2146. X
  2147. X    sprintf (msg, "%d", n);
  2148. X    error_message (txt_cannot_find_base_art, msg);
  2149. X    return -1;
  2150. X}
  2151. X
  2152. X/*
  2153. X *  Find how deep in a thread a response is.  Start counting at zero
  2154. X */
  2155. X
  2156. Xint which_response (n)
  2157. X    int n;
  2158. X{
  2159. X    int i, j;
  2160. X    int num = 0;
  2161. X
  2162. X    i = which_thread (n);
  2163. X    assert(i >= 0);
  2164. X
  2165. X    for (j = (int) base[i]; j != -1; j = arts[j].thread)
  2166. X        if (j == n)
  2167. X            break;
  2168. X        else
  2169. X            num++;
  2170. X
  2171. X    return num;
  2172. X}
  2173. X
  2174. X/*
  2175. X *  Given an index into base[], find the number of responses for
  2176. X *  that basenote
  2177. X */
  2178. X
  2179. Xint num_of_responses (n)
  2180. X    int n;
  2181. X{
  2182. X    int i;
  2183. X    int oldi = -3;
  2184. X    int sum = 0;
  2185. X
  2186. X    assert (n < top_base);
  2187. X
  2188. X    for (i = (int) base[n]; i != -1; i = arts[i].thread) {
  2189. X        assert (i != -2);
  2190. X        assert (i != oldi);
  2191. X        oldi = i;
  2192. X        sum++;
  2193. X    }
  2194. X
  2195. X    return sum - 1;
  2196. X}
  2197. X
  2198. X/*
  2199. X * Given an index into base[], return relevant statistics
  2200. X */
  2201. X
  2202. Xint stat_thread (n, sbuf)
  2203. X    int n;
  2204. X    struct art_stat_t *sbuf;
  2205. X{
  2206. X    int i;
  2207. X
  2208. X    sbuf->total  = 0;
  2209. X    sbuf->unread = 0;
  2210. X    sbuf->seen   = 0;
  2211. X    sbuf->hot_total = 0;
  2212. X    sbuf->hot_unread= 0;
  2213. X    sbuf->hot_seen  = 0;
  2214. X
  2215. X    for (i = (int) base[n]; i != -1; i = arts[i].thread) {
  2216. X        ++sbuf->total;
  2217. X        if (arts[i].unread == ART_UNREAD)
  2218. X            ++sbuf->unread;
  2219. X        else if (arts[i].unread == ART_WILL_RETURN)
  2220. X            ++sbuf->seen;
  2221. X
  2222. X        if (arts[i].hot) {
  2223. X            ++sbuf->hot_total;
  2224. X            if (arts[i].unread == ART_UNREAD)
  2225. X                ++sbuf->hot_unread;
  2226. X            else if (arts[i].unread == ART_WILL_RETURN)
  2227. X                ++sbuf->hot_seen;
  2228. X        }
  2229. X
  2230. X#if 0
  2231. X        if (arts[i].killed) {
  2232. X            ++sbuf->killed;
  2233. X        }
  2234. X#endif
  2235. X    }
  2236. X
  2237. X
  2238. X    if (sbuf->hot_unread)
  2239. X        sbuf->art_mark = HOT_ART_MARK;
  2240. X    else if (sbuf->unread)
  2241. X        sbuf->art_mark = UNREAD_ART_MARK;
  2242. X    else if (sbuf->seen)
  2243. X        sbuf->art_mark = RETURN_ART_MARK;
  2244. X    else
  2245. X        sbuf->art_mark = READ_ART_MARK;
  2246. X
  2247. X    return(sbuf->total);
  2248. X}
  2249. X
  2250. X
  2251. X/*
  2252. X *  Find the next response.  Go to the next basenote if there
  2253. X *  are no more responses in this thread
  2254. X */
  2255. X
  2256. Xint next_response (n)
  2257. X    int n;
  2258. X{
  2259. X    int i;
  2260. X
  2261. X    if (arts[n].thread >= 0)
  2262. X        return arts[n].thread;
  2263. X
  2264. X    i = which_thread (n) + 1;
  2265. X
  2266. X    if (i >= top_base)
  2267. X        return -1;
  2268. X
  2269. X    return (int) base[i];
  2270. X}
  2271. X
  2272. X/*
  2273. X *  Given a respnum (index into arts[]), find the respnum of the
  2274. X *  next basenote
  2275. X */
  2276. X
  2277. Xint next_thread (n)
  2278. X    int n;
  2279. X{
  2280. X    int i;
  2281. X
  2282. X    i = which_thread (n) + 1;
  2283. X    if (i >= top_base)
  2284. X        return -1;
  2285. X
  2286. X    return (int) base[i];
  2287. X}
  2288. X
  2289. X/*
  2290. X *  Find the previous response.  Go to the last response in the previous
  2291. X *  thread if we go past the beginning of this thread.
  2292. X */
  2293. X
  2294. Xint prev_response (n)
  2295. X    int n;
  2296. X{
  2297. X    int resp;
  2298. X    int i;
  2299. X
  2300. X    resp = which_response (n);
  2301. X
  2302. X    if (resp > 0)
  2303. X        return choose_response (which_thread (n), resp-1);
  2304. X
  2305. X    i = which_thread (n) - 1;
  2306. X
  2307. X    if (i < 0)
  2308. X        return -1;
  2309. X
  2310. X    return choose_response (i, num_of_responses (i));
  2311. X}
  2312. X
  2313. X/*
  2314. X *  return response number n from thread i
  2315. X */
  2316. X
  2317. Xint choose_response (i, n)
  2318. X    int i;
  2319. X    int n;
  2320. X{
  2321. X    int j;
  2322. X
  2323. X    j = (int) base[i];
  2324. X
  2325. X    while (n-- && arts[j].thread >= 0) {
  2326. X        j = arts[j].thread;
  2327. X    }
  2328. X
  2329. X    return j;
  2330. X}
  2331. X
  2332. X/*
  2333. X *  Find the next unread response in this group 
  2334. X */
  2335. X
  2336. Xint next_unread (n)
  2337. X    int n;
  2338. X{
  2339. X    while (n >= 0) {
  2340. X        if (arts[n].unread == ART_UNREAD) {
  2341. X            return n;
  2342. X        }
  2343. X        n = next_response (n);
  2344. X    }
  2345. X
  2346. X    return -1;
  2347. X}
  2348. X
  2349. X
  2350. X/*
  2351. X *  Find the previous unread response in this thread
  2352. X */
  2353. X
  2354. Xint prev_unread (n)
  2355. X    int n;
  2356. X{
  2357. X    while (n >= 0) {
  2358. X        if (arts[n].unread == ART_UNREAD) {
  2359. X            return n;
  2360. X        }
  2361. X        n = prev_response (n);
  2362. X    }
  2363. X
  2364. X    return -1;
  2365. X}
  2366. END_OF_FILE
  2367.   if test 17796 -ne `wc -c <'thread.c'`; then
  2368.     echo shar: \"'thread.c'\" unpacked with wrong size!
  2369.   fi
  2370.   # end of 'thread.c'
  2371. fi
  2372. echo shar: End of archive 3 \(of 14\).
  2373. cp /dev/null ark3isdone
  2374. MISSING=""
  2375. for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 ; do
  2376.     if test ! -f ark${I}isdone ; then
  2377.     MISSING="${MISSING} ${I}"
  2378.     fi
  2379. done
  2380. if test "${MISSING}" = "" ; then
  2381.     echo You have unpacked all 14 archives.
  2382.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  2383. else
  2384.     echo You still must unpack the following archives:
  2385.     echo "        " ${MISSING}
  2386. fi
  2387. exit 0
  2388. exit 0 # Just in case...
  2389.