home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / alt / sources / 2514 < prev    next >
Encoding:
Internet Message Format  |  1992-11-15  |  60.7 KB

  1. Path: sparky!uunet!psgrain!percy!hfglobe!ichips!iWarp.intel.com|eff!sol.ctr.columbia.edu!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!magnus.acs.ohio-state.edu!usenet.ins.cwru.edu!agate!doc.ic.ac.uk!uknet!mcsun!Germany.EU.net!anl433!Iain.Lea
  2. From: Iain.Lea%anl433.uucp@Germany.EU.net (Iain Lea)
  3. Newsgroups: alt.sources
  4. Subject: TIN newsreader v1.1 PL7 (Patch 02/10)
  5. Message-ID: <1992Nov15.155000.20056@anl433.uucp>
  6. Date: 15 Nov 92 15:50:00 GMT
  7. Sender: news@anl433.uucp (Netnews Administrator)
  8. Reply-To: Iain.Lea%anl433.uucp@Germany.EU.net
  9. Followup-To: alt.sources.d
  10. Organization: ANL A433, Siemens AG., Germany.
  11. Lines: 2245
  12. X-Newsreader: TIN [version 1.1 PL7]
  13.  
  14. Submitted-by: Iain.Lea%anl433.uucp@Germany.EU.net (Iain Lea)
  15. Archive-name: tin-1.17/part02
  16.  
  17. #!/bin/sh
  18. # this is tin.shar.02 (part 2 of tin-1.17)
  19. # do not concatenate these parts, unpack them in order with /bin/sh
  20. # file tin-1.17.patch continued
  21. #
  22. if test ! -r _shar_seq_.tmp; then
  23.     echo 'Please unpack part 1 first!'
  24.     exit 1
  25. fi
  26. (read Scheck
  27.  if test "$Scheck" != 2; then
  28.     echo Please unpack part "$Scheck" next!
  29.     exit 1
  30.  else
  31.     exit 0
  32.  fi
  33. ) < _shar_seq_.tmp || exit 1
  34. if test ! -f _shar_wnt_.tmp; then
  35.     echo 'x - still skipping tin-1.17.patch'
  36. else
  37. echo 'x - continuing file tin-1.17.patch'
  38. sed 's/^X//' << 'SHAR_EOF' >> 'tin-1.17.patch' &&
  39. X! o  Added tinrc variable 'default_sigfile=' to allow user random/fixed sigs.
  40. X! o  Added tinrc variable 'slow_speed_terminal=' to allow fast display via modem.
  41. X! o  Added group attribute 'organization=STRING'
  42. X! o  Added group attribute 'printer=STRING'.
  43. X! o  Added username/password capability for NNTP servers running authorization.
  44. X! o  Added path formating (ie, ~user/file) to group attribute variables.
  45. X! o  Added 'C'atchup and goto next unread group from article viewer level.
  46. X! o  Added auto-unpacking of multi-part lharc archives (AmigaDOS only).
  47. X! o  Added auto-unpacking of multi-part zip archives.
  48. X! o  Added integrity testing of unpacked zoo & zip archives.
  49. X! o  Added user abort (Esc Q q) when locally indexing a group.
  50. X! o  Added Followup-To: header to followup arts when more than 1 newsgroup.
  51. X! o  Changed 'C'ancel article to 'D'elete article for better command structure.
  52. X! o  Changed 'f'ollowup to art & 'F'ollowup to art with quoted text around.
  53. X! o  Changed 'r'eply thru mail & 'R'eply thru mail with quoted text around.
  54. X! o  Changed 1st time startup to subscribe to all groups by default.
  55. X! o  Changed tinrc variable 'maildir=' to 'default_maildir='.
  56. X! o  Changed tinrc variable 'savedir=' to 'default_savedir='.
  57. X! o  Changed tinrc variable 'printer=' to 'default_printer='.
  58. X! o  Fixed SIGSEGV caused by '?' search backwards at group selection level.
  59. X! o  Fixed SIGSEGV caused by load group_hash[] if group had 'x' in active file.
  60. X! o  Fixed SIGSEGV caused if new newswgroup had 'x' in active file.
  61. X! o  Fixed NNTP server patch that was causing compile problems on SunOS.
  62. X! o  Fixed saving of articles via NNTP that was causing art to be opened twice.
  63. X! o  Fixed "Welcome to tin..." message so its displayed 1st time tin is started.
  64. X! o  Fixed LOCK_FILE & LOG_USER_FILE #defines that caused old compilers to barf.
  65. X! o  Fixed spooldir level arrow that was using group level routine.
  66. X! o  Fixed so that aliased groups with '=' in active file are not loaded.
  67. X! o  Fixed extra newline in From: field when reading gateway name from file.
  68. X! o  Fixed offset problems when editing a file in editor that supports +N.
  69. X! o  Fixed 1 off article count if new group has never been read.
  70. X! o  Fixed screen always been redrawn when article is unavailable.
  71. X! o  Fixed so that when article is unavailable it skips to the next unread.
  72. X! o  Fixed parsing of From: line to handle exotic uucp addresses.
  73. X! o  Fixed cancel article so that Distribution: header is taken into account.
  74. X! o  Fixed reading of groups from cmd line & rereading of the active file.
  75. X  
  76. X  -------------------------------------------------------------------------------
  77. X  
  78. X***************
  79. X*** 61,72 ****
  80. X  
  81. X  For compilation and installation information read the INSTALL file.
  82. X  
  83. X  For ftp & non-ftp source & binary availability read the FTP file.
  84. X  
  85. X  -------------------------------------------------------------------------------
  86. X  
  87. X  I wish to thank all the people that sent me bug fixes and comments
  88. X! (especially Mark Tomlinson). I still  want to hear of any bug reports,
  89. X  gripes and comments but *PLEASE* read the INSTALL, TODO and tin.1 
  90. X  manual page before doing anything :-)!.
  91. X  
  92. X--- 82,95 ----
  93. X  
  94. X  For compilation and installation information read the INSTALL file.
  95. X  
  96. X+ For info. about my NNTP patches read the README.NNTP & INSTALL.NNTP files.
  97. X+ 
  98. X  For ftp & non-ftp source & binary availability read the FTP file.
  99. X  
  100. X  -------------------------------------------------------------------------------
  101. X  
  102. X  I wish to thank all the people that sent me bug fixes and comments
  103. X! (especially John Schmitz). I still  want to hear of any bug reports,
  104. X  gripes and comments but *PLEASE* read the INSTALL, TODO and tin.1 
  105. X  manual page before doing anything :-)!.
  106. X  
  107. XFiles ../1.16/README.AMIGA and ./README.AMIGA are identical
  108. Xdiff -rcs ../1.16/README.NNTP ./README.NNTP
  109. X*** ../1.16/README.NNTP    Sun Nov 15 18:41:35 1992
  110. X--- ./README.NNTP    Thu Nov  5 13:30:03 1992
  111. X***************
  112. X*** 1,9 ****
  113. X  This patch enables the TIN newsreader index files to be fetched from a
  114. X! NNTP server. The patch adds the following to the NNTP server nntpd:
  115. X  
  116. X!   o  XINDEX command to retrieve tin group index file from server.
  117. X       Syntax:  XINDEX alt.sources
  118. X  
  119. X    o  XUSER command to log tin clients username to nntp logfile.
  120. X       Syntax:  XUSER Iain Lea
  121. X  
  122. X--- 1,13 ----
  123. X  This patch enables the TIN newsreader index files to be fetched from a
  124. X! NNTP server. The patch adds the following to the NNTP 1.5.11 server:
  125. X  
  126. X!   o  XINDEX command to retrieve tin style or .overview style (ala Cnews)
  127. X!      group index files from the server.
  128. X       Syntax:  XINDEX alt.sources
  129. X  
  130. X+   o  XMOTD command to display a news message of the day file from server.
  131. X+      Syntax:  XMOTD 921231 235959
  132. X+ 
  133. X    o  XUSER command to log tin clients username to nntp logfile.
  134. X       Syntax:  XUSER Iain Lea
  135. X  
  136. X***************
  137. X*** 14,20 ****
  138. X       file /usr/lib/news/subscriptions.
  139. X       Syntax: LIST SUBSCRIPTIONS
  140. X  
  141. X!   o  HELP command changed to list XINDEX & XUSER as extensions.
  142. X  
  143. X    o  Added comments /* */ around '#endif /* text */' to stop some
  144. X       compilers producing warnings about text after '#endif text'.
  145. X--- 18,24 ----
  146. X       file /usr/lib/news/subscriptions.
  147. X       Syntax: LIST SUBSCRIPTIONS
  148. X  
  149. X!   o  HELP command changed to list XINDEX, XMOTD & XUSER as extensions.
  150. X  
  151. X    o  Added comments /* */ around '#endif /* text */' to stop some
  152. X       compilers producing warnings about text after '#endif text'.
  153. Xdiff -rcs ../1.16/TODO ./TODO
  154. X*** ../1.16/TODO    Sun Nov 15 18:41:30 1992
  155. X--- ./TODO    Sun Nov 15 12:57:25 1992
  156. X***************
  157. X*** 1,24 ****
  158. X  FIX FEATURES V1.x
  159. X  -----------------
  160. X  
  161. X! o  Fix(?) after save the '+' is not updated as art read.
  162. X  
  163. X! o  Refix broken pattern save (Hakan).
  164. X  
  165. X! o  Let user enter offset from GMT then print time format at art viewer level
  166. X!    with time_t -+ OFFset in time without having GMT,EST,-400 on the end.
  167. X!    Also get a strftime() function for formatting time string.
  168. X  
  169. X! o  Add Esc/^C to interrupt indexing a large group.
  170. X  
  171. X! o  Add tinrc variable so that len of groupname can be set. (Dave Sch??).
  172. X  
  173. X! o  Check RFC about group command for min, max & num of arts
  174. X  
  175. X! o  Mod tinrc & attributes files so that ~/Mail ~/News $ENV/zbc /home/iain
  176. X!    are understud when reading in and are converted back when written.
  177. X!    Will allow more portablabilty between machines.
  178. X  
  179. X  o  Fix so that 'x' crossposted arts that are tagged do not query the user
  180. X     if a yes is answered to the first crossposted art.
  181. X  
  182. X--- 1,87 ----
  183. X  FIX FEATURES V1.x
  184. X  -----------------
  185. X  
  186. X! o  WHEN creating the patch to PL6 don't forget to add the following files:
  187. X!      amiga.h
  188. X!      mail.c
  189. X!      sigfile.c
  190. X!      strftime.c
  191. X!      strftime.3
  192. X!      xmotd.c
  193. X! 
  194. X! -------- PL 8 ---------------
  195. X! 
  196. X! o  Add global attributes file for site. LIST ATTRIBUTES / LIBDIR/attributes
  197. X! 
  198. X! o  Fix '+' & '=' in strfpath() to allow mailbox & groupname dir saving.
  199. X! 
  200. X! o  Fix 423 problems that cause assert() failure in thread.c.
  201. X! 
  202. X! o  Fix pattern/hot save so that archive-name is not used but explicit 
  203. X!    entered path (Hakan).
  204. X! 
  205. X! o  Add default_organiztion= to tinrc therefore replacing ~/.tin/organization
  206. X! 
  207. X! o  Fix mailing so that if editor is never entered the screen will not be 
  208. X!    redrawn.
  209. X! 
  210. X! o  When 'tin -R' is used don't reread the active file ever.
  211. X! 
  212. X! o  Fix thread & hot saves so that arts are in correct order.
  213. X! 
  214. X! o  Use stat_article() when doing 'File exists a)ppend o)verwrite q)uit: q'
  215. X!    to stop art being brought over via NNTP and therefore wasting bandwidth.
  216. X! 
  217. X! o  Modify low level parsing routines so that upper level does'nt give a damn 
  218. X!    where it gets its data from (tin / .overview files). When first passed the 
  219. X!    groupname stat() the groupdir for an .overview file and if found return it 
  220. X!    otherwise go with the present tin index file method.
  221. X! 
  222. X! o  Fix 'z' command mark all unread when in R mode at group select level.
  223. X!    It is not recognizing current group but group when all groups are been
  224. X!    read. Is my_group[] or index_point been used as index?
  225. X! 
  226. X! o  Add ROT13 as option on cmd line post menu. Encode from End of Header
  227. X!    to -- before sig. Put [Rot13 encoded text follows] as note for reader.
  228. X  
  229. X! o  Fix 'm' mail thread and then q)uit still mails the thread.
  230. X  
  231. X! o  Add scrolling patch from John Schmitz
  232. X  
  233. X! o  Fix 'm'ove group when all groups are shown (R off).
  234. X  
  235. X! o  Fix -R (read saved news) to use mail_active code to save to active.save
  236. X!    mail should use active.mail.
  237. X!    All other groups should be not allowed to be read. 
  238. X!    The saved groups are written to save.active if attr.batch_save=ON
  239. X!    What should happen if -f Newsrc-file is specified on command line?
  240. X  
  241. X! o  I can help with this one.  You have two options:  '|' the thread
  242. X!    into 'cat > file' or use '=' as the first letter of the save
  243. X!    filename.  The '=' causes the save to be in mailbox form (which is
  244. X!    one file), but it has the disadvantage that the sorting order is
  245. X!    lost (this doesn't happen with piping).
  246. X  
  247. X! o  When in unread mode only apply saves print etc. to unread arts.
  248. X  
  249. X+ o  msplit -m mbox format   msplit -M MH format
  250. X+ 
  251. X+ o  Fix 'm' 'g' & 'R' is in force and group has no unread reset 'R' mode 
  252. X+    to show all and then goto it.
  253. X+ 
  254. X+ o  Fix Floating point exception on SCO Unix when doing a 'q' menu.
  255. X+ 
  256. X+ o  Fix compile problems on MX331 when compiled over net.
  257. X+ 
  258. X+ o  Add "Reconnecting to %s..." when -1 received from nntp. set IO FILE
  259. X+    pointers to NULL before redoing a server_init() ?.
  260. X+ 
  261. X+ o  smtp_open() smtp_close() in smtplib.[ch] (plus #defines for SMTP responses.
  262. X+    burp_open() burp_close() in burplib.[ch] (plus #defines for BURP responses.
  263. X+    All will use the nntplib C routines from clientlib.c 
  264. X+ 
  265. X+ o  Fix(?) after save the '+' is not updated as art read.
  266. X+ 
  267. X  o  Fix so that 'x' crossposted arts that are tagged do not query the user
  268. X     if a yes is answered to the first crossposted art.
  269. X  
  270. X***************
  271. X*** 80,86 ****
  272. X  
  273. X  o  Change write_attributes_file () to write active attributes that are 
  274. X     different than global settings. Also a menu 'M' interface to set all 
  275. X!    the options PL7.
  276. X  
  277. X  o  Add options to 'M' menu to allow setting all the variables that are now in 
  278. X     the tinrc file.
  279. X--- 143,149 ----
  280. X  
  281. X  o  Change write_attributes_file () to write active attributes that are 
  282. X     different than global settings. Also a menu 'M' interface to set all 
  283. X!    the options PL8.
  284. X  
  285. X  o  Add options to 'M' menu to allow setting all the variables that are now in 
  286. X     the tinrc file.
  287. X***************
  288. X*** 133,141 ****
  289. X  
  290. X  o  Find out how good hash routine is on active file.
  291. X  
  292. X- o  Add tinrc variable to allow the length of groupnames to be defined 
  293. X-    so that more of the newsgroups text can be shown. (Dvae Sch??)
  294. X- 
  295. X  o  Add Xref handling of articles so that read ones are marked read in 
  296. X     other groups. Use update_group() to do it?
  297. X     Needs to handle 'c' 'C' 'k' 'K' commands. Perhaps it should be an
  298. X--- 196,201 ----
  299. X***************
  300. X*** 200,221 ****
  301. X  o  Add Virtual newsgroups (combination of newsgroups ie. virtual.ibm
  302. X     consists of comp.sys.ibm.* groups). ~/.tin/virtual
  303. X  
  304. X! Group        Read    Thread    Save  Savedir  Maildir  Sigfile    
  305. X!              Unread  Unthread  Mail  ProcTyp  Mailbox
  306. X! -----------------------------------------------------------------------------
  307. X! junk         Unread  OFF       OFF   Default  Default  Default
  308. X! alt.sources  Read    ON        ON    $SRC/alt Default  ~/.Sig-alt
  309. X! 
  310. X! Also following fields (to override globally defined ones in tinrc):
  311. X! replyto:
  312. X! organization:
  313. X! cc:
  314. X! 
  315. X! Add a menu interface to define all this. Also add edit menu for entries in
  316. X! kill file.
  317. X! 
  318. X! Each group could have a field to say which NNTP/local connection to use so
  319. X! as to be able to plug into different NNTP servers for different newsgroups
  320. X! 
  321. X! Add global attributes file for site. LIST ATTRIBUTES ??
  322. X! 
  323. X--- 260,264 ----
  324. X  o  Add Virtual newsgroups (combination of newsgroups ie. virtual.ibm
  325. X     consists of comp.sys.ibm.* groups). ~/.tin/virtual
  326. X  
  327. X! o  Each group could have a field to say which NNTP/local connection to use so
  328. X!    as to be able to plug into different NNTP servers for different newsgroups
  329. XOnly in .: XX
  330. Xdiff -rcs ../1.16/active.c ./active.c
  331. X*** ../1.16/active.c    Sun Nov 15 18:41:44 1992
  332. X--- ./active.c    Sun Nov 15 16:02:48 1992
  333. X***************
  334. X*** 3,9 ****
  335. X   *  Module    : active.c
  336. X   *  Author    : I.Lea
  337. X   *  Created   : 16-02-92
  338. X!  *  Updated   : 12-09-92
  339. X   *  Notes     :
  340. X   *  Copyright : (c) Copyright 1991-92 by Iain Lea
  341. X   *              You may  freely  copy or  redistribute  this software,
  342. X--- 3,9 ----
  343. X   *  Module    : active.c
  344. X   *  Author    : I.Lea
  345. X   *  Created   : 16-02-92
  346. X!  *  Updated   : 07-11-92
  347. X   *  Notes     :
  348. X   *  Copyright : (c) Copyright 1991-92 by Iain Lea
  349. X   *              You may  freely  copy or  redistribute  this software,
  350. X***************
  351. X*** 38,48 ****
  352. X          free_active_arrays ();
  353. X          max_active = DEFAULT_ACTIVE_NUM;
  354. X          expand_active ();
  355. X!         read_active_file ();
  356. X          read_attributes_file ();
  357. X          read_newsgroups_file ();
  358. X!         read_newsrc (TRUE);
  359. X!         toggle_my_groups (show_only_unread_groups, old_group);
  360. X          set_groupname_len (FALSE);
  361. X          set_alarm_signal ();
  362. X          mail_setup ();
  363. X--- 38,52 ----
  364. X          free_active_arrays ();
  365. X          max_active = DEFAULT_ACTIVE_NUM;
  366. X          expand_active ();
  367. X!         read_mail_active_file ();
  368. X!         read_news_active_file ();
  369. X          read_attributes_file ();
  370. X+         read_mailgroups_file ();
  371. X          read_newsgroups_file ();
  372. X!         if (! read_cmd_line_groups ()) {
  373. X!             read_newsrc (TRUE);
  374. X!             toggle_my_groups (show_only_unread_groups, old_group);
  375. X!         }
  376. X          set_groupname_len (FALSE);
  377. X          set_alarm_signal ();
  378. X          mail_setup ();
  379. X***************
  380. X*** 78,174 ****
  381. X  }
  382. X  
  383. X  /*
  384. X!  *  Load the active file into active[] and create copy of active ~/.tin/active
  385. X   */
  386. X  
  387. X! void read_active_file ()
  388. X  {
  389. X      FILE *fp;
  390. X-     char *p, *q, *r;
  391. X      char buf[LEN];
  392. X!     char moderated = 'y';
  393. X      int i;
  394. X!     long h;
  395. X          
  396. X-     num_active = 0;
  397. X- 
  398. X      if ((update && update_fork) || ! update) {
  399. X!         wait_message (txt_reading_active_file);
  400. X      }
  401. X  
  402. X!     if ((fp = open_active_fp ()) == NULL) {
  403. X          if (compiled_with_nntp) {
  404. X!             sprintf (msg, txt_cannot_open_active_file, active_file, progname);
  405. X              error_message (msg, "");
  406. X          } else {
  407. X              if (cmd_line) {
  408. X                  fputc ('\n', stderr);
  409. X              }
  410. X!             error_message (txt_cannot_open, active_file);
  411. X          }
  412. X!         exit (1);
  413. X      }
  414. X  
  415. X!     for (i = 0; i < TABLE_SIZE; i++) {
  416. X!         group_hash[i] = -1;
  417. X      }
  418. X  
  419. X      while (fgets (buf, sizeof (buf), fp) != NULL) {
  420. X!         for (p = buf; *p && *p != ' ' && *p != '\n'; p++)
  421. X!             continue;
  422. X!         if (*p != ' ') {
  423. X!             error_message (txt_bad_active_file, buf);
  424. X              continue;
  425. X          }
  426. X-         *p++ = '\0';
  427. X- 
  428. X-         if (num_active >= max_active) {
  429. X-             debug_nntp ("read_active_file", "EXPANDING active file");
  430. X-             expand_active ();
  431. X-         }
  432. X- 
  433. X-         h = hash_groupname (buf);
  434. X  
  435. X!         if (group_hash[h] == -1) {
  436. X!             group_hash[h] = num_active;
  437. X!         } else {                /* hash linked list chaining */
  438. X!             for (i=group_hash[h]; active[i].next >= 0; i=active[i].next) {
  439. X!                 if (strcmp(active[i].name, buf) == 0) {
  440. X!                     goto read_active_continue;        /* kill dups */
  441. X!                 }
  442. X              }
  443. X-             if (strcmp(active[i].name, buf) == 0)
  444. X-                 goto read_active_continue;
  445. X-             active[i].next = num_active;
  446. X-         }
  447. X  
  448. X!         for (q = p; *q && *q != ' '; q++)
  449. X!             continue;
  450. X!         if (*q != ' ') {
  451. X!             error_message (txt_bad_active_file, buf);
  452. X!             continue;
  453. X!         }
  454. X!         *q++ = '\0';
  455. X  
  456. X!         for (r = q; *r && *r != '\n'; r++) {
  457. X!             if (*r == 'y' || *r == 'm' || *r == 'x') {
  458. X!                 moderated = *r;
  459. X!                 break;
  460. X              }
  461. X-         }
  462. X  
  463. X-         /*
  464. X-          * Don't load group if 'x' junked group in active file
  465. X-          */
  466. X-         if (moderated != 'x') {
  467. X              /*
  468. X!              * Group info.
  469. X               */
  470. X              active[num_active].name = str_dup (buf);
  471. X              active[num_active].description = (char *) 0;
  472. X!             active[num_active].max = (long) atol (p);
  473. X!             active[num_active].min = (long) atol (q);
  474. X!             active[num_active].moderated = moderated;
  475. X              active[num_active].next = -1;            /* hash chaining */
  476. X              active[num_active].my_group = UNSUBSCRIBED;    /* not in my_group[] yet */
  477. X              active[num_active].unread = 0;
  478. X--- 82,223 ----
  479. X  }
  480. X  
  481. X  /*
  482. X!  * parse line from news or mail active files
  483. X!  */
  484. X!  
  485. X! int parse_active_line (line, max, min, moderated)
  486. X!     char *line;
  487. X!     long *max;
  488. X!     long *min;
  489. X!     char *moderated;
  490. X! {
  491. X!     char *p, *q, *r;
  492. X!     
  493. X!     if (line[0] == '#' || line[0] == '\n') {
  494. X!         return FALSE;
  495. X!     }
  496. X!     
  497. X!     for (p = line; *p && *p != ' ' && *p != '\n'; p++) {
  498. X!         continue;
  499. X!     }
  500. X!     if (*p != ' ') {
  501. X!         error_message (txt_bad_active_file, line);
  502. X!         return FALSE;
  503. X!     }
  504. X!     *p++ = '\0';
  505. X! 
  506. X!     for (q = p; *q && *q != ' '; q++) {
  507. X!         continue;
  508. X!     }
  509. X!     if (*q != ' ') {
  510. X!         error_message (txt_bad_active_file, line);
  511. X!         return FALSE;;
  512. X!     }
  513. X!     *q++ = '\0';
  514. X! 
  515. X!     for (r = q; *r && *r != ' '; r++) {
  516. X!         continue;
  517. X!     }
  518. X!     if (*r != ' ') {
  519. X!         error_message (txt_bad_active_file, line);
  520. X!         return FALSE;;
  521. X!     }
  522. X!     *r++ = '\0';
  523. X! 
  524. X!     if (*r) {
  525. X!         strcpy (moderated, r);
  526. X!         if (r = (char *) strchr (moderated, '\n')) {
  527. X!             *r = '\0';
  528. X!         }
  529. X!     }
  530. X! 
  531. X!     *max = (long) atol (p);
  532. X!     *min = (long) atol (q);
  533. X! 
  534. X!     return TRUE;
  535. X! }
  536. X! 
  537. X! /*
  538. X!  *  Load the news active file into active[] and create copy 
  539. X!  *  of active ~/.tin/active
  540. X   */
  541. X  
  542. X! void read_news_active_file ()
  543. X  {
  544. X      FILE *fp;
  545. X      char buf[LEN];
  546. X!     char moderated[PATH_LEN];
  547. X      int i;
  548. X!     long h, min, max;
  549. X          
  550. X      if ((update && update_fork) || ! update) {
  551. X!         wait_message (txt_reading_news_active_file);
  552. X      }
  553. X  
  554. X!     if ((fp = open_news_active_fp ()) == NULL) {
  555. X          if (compiled_with_nntp) {
  556. X!             sprintf (msg, txt_cannot_open_active_file, news_active_file, progname);
  557. X              error_message (msg, "");
  558. X          } else {
  559. X              if (cmd_line) {
  560. X                  fputc ('\n', stderr);
  561. X              }
  562. X!             error_message (txt_cannot_open, news_active_file);
  563. X          }
  564. X!         tin_done (1);
  565. X      }
  566. X  
  567. X!     if (num_active == -1) {
  568. X!         num_active = 0;
  569. X!         for (i = 0; i < TABLE_SIZE; i++) {
  570. X!             group_hash[i] = -1;
  571. X!         }
  572. X      }
  573. X+     strcpy (moderated, "y");
  574. X  
  575. X      while (fgets (buf, sizeof (buf), fp) != NULL) {
  576. X!         if (! parse_active_line (buf, &max, &min, moderated)) {
  577. X              continue;
  578. X          }
  579. X  
  580. X!         /*
  581. X!          * Don't load group into active[] from active file if 
  582. X!          * 'x'  junked group
  583. X!          * '='  aliased group
  584. X!          */
  585. X!         if (moderated[0] != 'x' && moderated[0] != '=') {
  586. X!             /*
  587. X!              * Load group into group hash table
  588. X!              */
  589. X!             if (num_active >= max_active) {
  590. X!                 expand_active ();
  591. X              }
  592. X  
  593. X!             h = hash_groupname (buf);
  594. X  
  595. X!             if (group_hash[h] == -1) {
  596. X!                 group_hash[h] = num_active;
  597. X!             } else {    /* hash linked list chaining */
  598. X!                 for (i=group_hash[h]; active[i].next >= 0; i=active[i].next) {
  599. X!                     if (strcmp(active[i].name, buf) == 0) {
  600. X!                         goto read_news_active_continue;    /* kill dups */
  601. X!                     }
  602. X!                 }
  603. X!                 if (strcmp(active[i].name, buf) == 0)
  604. X!                     goto read_news_active_continue;
  605. X!                 active[i].next = num_active;
  606. X              }
  607. X  
  608. X              /*
  609. X!              * Load group info.
  610. X               */
  611. X+             active[num_active].type = GROUP_TYPE_NEWS;
  612. X              active[num_active].name = str_dup (buf);
  613. X+             active[num_active].spooldir = spooldir;
  614. X              active[num_active].description = (char *) 0;
  615. X!             active[num_active].max = max;
  616. X!             active[num_active].min = min;
  617. X!             active[num_active].moderated = moderated[0];
  618. X              active[num_active].next = -1;            /* hash chaining */
  619. X              active[num_active].my_group = UNSUBSCRIBED;    /* not in my_group[] yet */
  620. X              active[num_active].unread = 0;
  621. X***************
  622. X*** 177,185 ****
  623. X  #endif
  624. X              num_active++;
  625. X          }
  626. X! 
  627. X! read_active_continue:;
  628. X! 
  629. X      }
  630. X      fclose (fp);
  631. X  
  632. X--- 226,232 ----
  633. X  #endif
  634. X              num_active++;
  635. X          }
  636. X! read_news_active_continue:;
  637. X      }
  638. X      fclose (fp);
  639. X  
  640. X***************
  641. X*** 187,198 ****
  642. X       *  exit if active file is empty
  643. X       */
  644. X      if (! num_active) {
  645. X!         error_message (txt_active_file_is_empty, active_file);
  646. X!         exit (1);
  647. X      }
  648. X  
  649. X      if ((cmd_line && ! update && ! verbose) || (update && update_fork)) {
  650. X- /* || ! update && ! verbose) { */
  651. X          wait_message ("\n");
  652. X      }
  653. X  
  654. X--- 234,244 ----
  655. X       *  exit if active file is empty
  656. X       */
  657. X      if (! num_active) {
  658. X!         error_message (txt_active_file_is_empty, news_active_file);
  659. X!         tin_done (1);
  660. X      }
  661. X  
  662. X      if ((cmd_line && ! update && ! verbose) || (update && update_fork)) {
  663. X          wait_message ("\n");
  664. X      }
  665. X  
  666. X***************
  667. X*** 277,283 ****
  668. X          backup_active (TRUE);
  669. X          strcpy (new_active_file_server, "local");
  670. X          max_old_active = num_active;
  671. X!         if (stat (active_file, &sb) >= 0) {
  672. X              sprintf (new_active_file_attribute, "%d", sb.st_size);
  673. X          }
  674. X      }
  675. X--- 323,329 ----
  676. X          backup_active (TRUE);
  677. X          strcpy (new_active_file_server, "local");
  678. X          max_old_active = num_active;
  679. X!         if (stat (news_active_file, &sb) >= 0) {
  680. X              sprintf (new_active_file_attribute, "%d", sb.st_size);
  681. X          }
  682. X      }
  683. X***************
  684. X*** 321,327 ****
  685. X      if ((fp = open_newgroups_fp (active_index)) == (FILE *) 0) {
  686. X          goto notify_groups_done;
  687. X      }
  688. X- debug_nntp ("check_for_any_new_groups", "Opened newsgroups file");
  689. X  
  690. X      Raw (TRUE);
  691. X  
  692. X--- 367,372 ----
  693. X***************
  694. X*** 333,342 ****
  695. X      
  696. X      while (fgets (buf, sizeof (buf), fp) != NULL) {
  697. X          if (buf[0] == '.') {
  698. X- debug_nntp ("check_for_any_new_groups", "Breaking out of loop after reading '.'");
  699. X              break;
  700. X          }
  701. X- debug_nntp ("check_for_any_new_groups", buf);
  702. X          strncpy (old_active[num].name, buf, sizeof (old_active[num].name));        
  703. X          old_active[num].len = strlen (old_active[num].name)-1;
  704. X          old_active[num].name[old_active[num].len] = '\0';
  705. X--- 378,385 ----
  706. X***************
  707. X*** 356,363 ****
  708. X  
  709. X  
  710. X      if (read_news_via_nntp) {
  711. X!         for (i = 0 ; i < num ; i++) {    
  712. X              if (! prompt_subscribe_group (old_active[i].name)) {
  713. X                  goto notify_groups_done;
  714. X              }
  715. X          }
  716. X--- 399,413 ----
  717. X  
  718. X  
  719. X      if (read_news_via_nntp) {
  720. X!         for (i = 0 ; i < num ; i++) {
  721. X!             if (find_group_index (old_active[i].name) == -1) {
  722. X!                 continue;
  723. X!             }
  724. X              if (! prompt_subscribe_group (old_active[i].name)) {
  725. X+                 if (cmd_line) {
  726. X+                     printf ("\r\n");
  727. X+                     fflush (stdout);
  728. X+                 }
  729. X                  goto notify_groups_done;
  730. X              }
  731. X          }
  732. X***************
  733. X*** 380,385 ****
  734. X--- 430,439 ----
  735. X              update_old_active = TRUE;
  736. X      
  737. X              if (! prompt_subscribe_group (active[i].name)) {
  738. X+                 if (cmd_line) {
  739. X+                     printf ("\r\n");
  740. X+                     fflush (stdout);
  741. X+                 }
  742. X                  goto notify_groups_done;
  743. X              }
  744. X          }
  745. X***************
  746. X*** 409,415 ****
  747. X                  if (ch == CR) {
  748. X                      ch = ch_default;
  749. X                  }
  750. X!             } while (ch != 'y' && ch != 'n' && ch != 'q');
  751. X      
  752. X              switch (ch) {
  753. X                  case 'y':
  754. X--- 463,469 ----
  755. X                  if (ch == CR) {
  756. X                      ch = ch_default;
  757. X                  }
  758. X!             } while (! strchr ("nqy\033", ch));
  759. X      
  760. X              switch (ch) {
  761. X                  case 'y':
  762. X***************
  763. X*** 416,421 ****
  764. X--- 470,476 ----
  765. X                      delete_group (old_active[j].name);
  766. X                      break;       
  767. X                  case 'q':
  768. X+                 case ESC:
  769. X                      goto notify_groups_done;       
  770. X                  case 'n':
  771. X                  default:
  772. X***************
  773. X*** 422,427 ****
  774. X--- 477,483 ----
  775. X                      break;       
  776. X              }        
  777. X              printf ("\r\n");
  778. X+             fflush (stdout);
  779. X          }
  780. X      }
  781. X      
  782. X***************
  783. X*** 476,483 ****
  784. X      do {
  785. X          if (cmd_line) {
  786. X              fputc ('\r', stdout);
  787. X          }
  788. X-         CleartoEOLN ();
  789. X          printf (txt_subscribe_to_new_group, group, ch_default);
  790. X          fflush (stdout);
  791. X          ch = ReadCh ();
  792. X--- 532,541 ----
  793. X      do {
  794. X          if (cmd_line) {
  795. X              fputc ('\r', stdout);
  796. X+             CleartoEOLN ();
  797. X+         } else {
  798. X+             clear_message ();
  799. X          }
  800. X          printf (txt_subscribe_to_new_group, group, ch_default);
  801. X          fflush (stdout);
  802. X          ch = ReadCh ();
  803. X***************
  804. X*** 487,492 ****
  805. X--- 545,551 ----
  806. X      } while (! strchr ("nqy\033", ch));
  807. X          
  808. X      fputc (ch, stdout);
  809. X+     fflush (stdout);
  810. X      
  811. X      switch (ch) {
  812. X          case 'y':
  813. X***************
  814. X*** 529,535 ****
  815. X--- 588,597 ----
  816. X          active[i].attribute.maildir = default_maildir;
  817. X          active[i].attribute.savedir = default_savedir;
  818. X          active[i].attribute.sigfile = default_sigfile;
  819. X+         active[i].attribute.organization = 
  820. X+             (default_organization[0] ? default_organization : (char *) 0);
  821. X          active[i].attribute.followup_to = (char *) 0;
  822. X+         active[i].attribute.printer = default_printer;
  823. X          active[i].attribute.read_during_session = FALSE;
  824. X          active[i].attribute.show_only_unread = default_show_only_unread;
  825. X          active[i].attribute.thread_arts = default_thread_arts;
  826. X***************
  827. X*** 548,566 ****
  828. X   *
  829. X   *  attribute.maildir          = STRING
  830. X   *  attribute.savedir          = STRING
  831. X   *  attribute.sigfile          = STRING
  832. X   *  attribute.followup_to      = STRING
  833. X   *  attribute.auto_save        = ON/OFF
  834. X   *  attribute.batch_save       = ON/OFF
  835. X   *  attribute.delete_tmp_files = ON/OFF
  836. X   *  attribute.show_only_unread = ON/OFF
  837. X   *  attribute.thread_arts      = ON/OFF
  838. X-  *  attribute.sort_art_type    = NUM
  839. X-  *    0=??, 1=??, 2=??, 3=??, 4=??
  840. X   *  attribute.show_author      = NUM
  841. X!  *    
  842. X   *  attribute.post_proc_type   = NUM
  843. X!  *  
  844. X   */
  845. X  
  846. X  void read_attributes_file ()
  847. X--- 610,636 ----
  848. X   *
  849. X   *  attribute.maildir          = STRING
  850. X   *  attribute.savedir          = STRING
  851. X+  *  attribute.organization     = STRING
  852. X   *  attribute.sigfile          = STRING
  853. X   *  attribute.followup_to      = STRING
  854. X+  *  attribute.printer          = STRING
  855. X   *  attribute.auto_save        = ON/OFF
  856. X   *  attribute.batch_save       = ON/OFF
  857. X   *  attribute.delete_tmp_files = ON/OFF
  858. X   *  attribute.show_only_unread = ON/OFF
  859. X   *  attribute.thread_arts      = ON/OFF
  860. X   *  attribute.show_author      = NUM
  861. X!  *    0=none, 1=name, 2=addr, 3=both
  862. X!  *  attribute.sort_art_type    = NUM
  863. X!  *    0=none, 1=subj descend, 2=subj ascend
  864. X!  *    3=from descend, 4=from ascend
  865. X!  *    5=date descend, 6=date ascend
  866. X   *  attribute.post_proc_type   = NUM
  867. X!  *    0=none, 1=unshar, 2=uudecode
  868. X!  *    3=uudecode & list zoo (unix) / lha (AmigaDOS) archive 
  869. X!  *    4=uudecode & extract zoo (unix) / lha (AmigaDOS) archive
  870. X!  *    5=uudecode & list zip archive
  871. X!  *    6=uudecode & extract zip archive
  872. X   */
  873. X  
  874. X  void read_attributes_file ()
  875. X***************
  876. X*** 598,604 ****
  877. X              if (index >= 0) {
  878. X                  active[index].attribute.maildir = str_dup (buf);
  879. X  if (debug == 2) {
  880. X!     error_message("maildir=[%s]",active[index].attribute.maildir);
  881. X  }
  882. X              }
  883. X              continue;
  884. X--- 668,675 ----
  885. X              if (index >= 0) {
  886. X                  active[index].attribute.maildir = str_dup (buf);
  887. X  if (debug == 2) {
  888. X!     sprintf (msg, "maildir=[%s]", active[index].attribute.maildir);
  889. X!     error_message (msg, "");
  890. X  }
  891. X              }
  892. X              continue;
  893. X***************
  894. X*** 607,613 ****
  895. X              if (index >= 0) {
  896. X                  active[index].attribute.savedir = str_dup (buf);
  897. X  if (debug == 2) {
  898. X!     error_message("savedir=[%s]",active[index].attribute.savedir);
  899. X  }
  900. X              }
  901. X              continue;
  902. X--- 678,685 ----
  903. X              if (index >= 0) {
  904. X                  active[index].attribute.savedir = str_dup (buf);
  905. X  if (debug == 2) {
  906. X!     sprintf (msg, "savedir=[%s]", active[index].attribute.savedir);
  907. X!     error_message (msg, "");
  908. X  }
  909. X              }
  910. X              continue;
  911. X***************
  912. X*** 616,622 ****
  913. X              if (index >= 0) {
  914. X                  active[index].attribute.sigfile = str_dup (buf);
  915. X  if (debug == 2) {
  916. X!     error_message("sigfile=[%s]",active[index].attribute.sigfile);
  917. X  }
  918. X              }
  919. X              continue;
  920. X--- 688,704 ----
  921. X              if (index >= 0) {
  922. X                  active[index].attribute.sigfile = str_dup (buf);
  923. X  if (debug == 2) {
  924. X!     sprintf (msg, "sigfile=[%s]", active[index].attribute.sigfile);
  925. X!     error_message (msg, "");
  926. X! }
  927. X!             }
  928. X!             continue;
  929. X!         }
  930. X!         if (match_string (line, "organization=", buf, sizeof (buf))) {
  931. X!             if (index >= 0) {
  932. X!                 active[index].attribute.organization = str_dup (buf);
  933. X! if (debug == 2) {
  934. X!     error_message("organization=[%s]",active[index].attribute.organization);
  935. X  }
  936. X              }
  937. X              continue;
  938. X***************
  939. X*** 630,635 ****
  940. X--- 712,726 ----
  941. X              }
  942. X              continue;
  943. X          }
  944. X+         if (match_string (line, "printer=", buf, sizeof (buf))) {
  945. X+             if (index >= 0) {
  946. X+                 active[index].attribute.printer = str_dup (buf);
  947. X+ if (debug == 2) {
  948. X+     error_message("printer=[%s]",active[index].attribute.printer);
  949. X+ }
  950. X+             }
  951. X+             continue;
  952. X+         }
  953. X          if (match_boolean (line, "show_only_unread=", &num)) {
  954. X              if (index >= 0) {
  955. X                  active[index].attribute.show_only_unread = num;
  956. X***************
  957. X*** 707,738 ****
  958. X          wait_message (txt_writing_attributes_file);
  959. X      }
  960. X  
  961. X!     fprintf (fp, "# Group attributes file\n");
  962. X!     fprintf (fp, "#\n");
  963. X      fprintf (fp, "#  show_author=NUM\n");
  964. X!     fprintf (fp, "#    0=none, 1=name, 2=addr, 3=both\n");
  965. X!     fprintf (fp, "#\n");
  966. X      fprintf (fp, "#  sort_art_type=NUM\n");
  967. X      fprintf (fp, "#    0=none, 1=subj descend, 2=subj ascend,\n"); 
  968. X      fprintf (fp, "#    3=from descend, 4=from ascend,\n");
  969. X!     fprintf (fp, "#    5=date descend, 6=date ascend\n");
  970. X!     fprintf (fp, "#\n");
  971. X      fprintf (fp, "#  post_proc_type=NUM\n");
  972. X!     fprintf (fp, "#    0=none, 1=shar, 2=uudecode,\n"); 
  973. X!     fprintf (fp, "#    3=uudecode & list zoo,\n"); 
  974. X!     fprintf (fp, "#    4=uudecode & extract zoo\n\n");
  975. X  
  976. X      for (i = 0 ; i < num_active ; i++) {
  977. X          fprintf (fp, "newsgroup=%s\n", active[i].name);
  978. X          fprintf (fp, "maildir=%s\n", active[i].attribute.maildir);
  979. X          fprintf (fp, "savedir=%s\n", active[i].attribute.savedir);
  980. X          fprintf (fp, "sigfile=%s\n", active[i].attribute.sigfile);
  981. X          fprintf (fp, "followup_to=%s\n", active[i].attribute.followup_to);
  982. X!         fprintf (fp, "show_only_unread=%s\n", active[i].attribute.show_only_unread);
  983. X!         fprintf (fp, "thread_arts=%s\n", active[i].attribute.thread_arts);
  984. X!         fprintf (fp, "auto_save=%s\n", active[i].attribute.auto_save);
  985. X!         fprintf (fp, "batch_save=%s\n", active[i].attribute.batch_save);
  986. X!         fprintf (fp, "delete_tmp_files=%s\n", active[i].attribute.delete_tmp_files);
  987. X          fprintf (fp, "sort_art_type=%d\n", active[i].attribute.sort_art_type);
  988. X          fprintf (fp, "show_author=%d\n", active[i].attribute.show_author);
  989. X          fprintf (fp, "post_proc_type=%d\n", active[i].attribute.post_proc_type);
  990. X--- 798,851 ----
  991. X          wait_message (txt_writing_attributes_file);
  992. X      }
  993. X  
  994. X!     fprintf (fp, "# Group attributes file\n#\n");
  995. X!     fprintf (fp, "#  maildir=STRING\n");
  996. X!     fprintf (fp, "#  savedir=STRING\n");
  997. X!     fprintf (fp, "#  organization=STRING\n");
  998. X!     fprintf (fp, "#  sigfile=STRING\n");
  999. X!     fprintf (fp, "#  followup_to=STRING\n");
  1000. X!     fprintf (fp, "#  printer=STRING\n");
  1001. X!     fprintf (fp, "#  auto_save=ON/OFF\n");
  1002. X!     fprintf (fp, "#  batch_save=ON/OFF\n");
  1003. X!     fprintf (fp, "#  delete_tmp_files=ON/OFF\n");
  1004. X!     fprintf (fp, "#  show_only_unread=ON/OFF\n");
  1005. X!     fprintf (fp, "#  thread_arts=ON/OFF\n#\n");
  1006. X      fprintf (fp, "#  show_author=NUM\n");
  1007. X!     fprintf (fp, "#    0=none, 1=name, 2=addr, 3=both\n#\n");
  1008. X      fprintf (fp, "#  sort_art_type=NUM\n");
  1009. X      fprintf (fp, "#    0=none, 1=subj descend, 2=subj ascend,\n"); 
  1010. X      fprintf (fp, "#    3=from descend, 4=from ascend,\n");
  1011. X!     fprintf (fp, "#    5=date descend, 6=date ascend\n#\n");
  1012. X      fprintf (fp, "#  post_proc_type=NUM\n");
  1013. X!     fprintf (fp, "#    0=none, 1=unshar, 2=uudecode,\n"); 
  1014. X! #ifdef AMIGA
  1015. X!     fprintf (fp, "#    3=uudecode & list lha archive,\n"); 
  1016. X!     fprintf (fp, "#    4=uudecode & extract lha archive\n");
  1017. X! #else
  1018. X!     fprintf (fp, "#    3=uudecode & list zoo archive,\n"); 
  1019. X!     fprintf (fp, "#    4=uudecode & extract zoo archive\n");
  1020. X! #endif
  1021. X!     fprintf (fp, "#    5=uudecode & list zip archive,\n"); 
  1022. X!     fprintf (fp, "#    6=uudecode & extract zip archive\n\n");
  1023. X  
  1024. X      for (i = 0 ; i < num_active ; i++) {
  1025. X          fprintf (fp, "newsgroup=%s\n", active[i].name);
  1026. X          fprintf (fp, "maildir=%s\n", active[i].attribute.maildir);
  1027. X          fprintf (fp, "savedir=%s\n", active[i].attribute.savedir);
  1028. X+         fprintf (fp, "organization=%s\n", active[i].attribute.organization);
  1029. X          fprintf (fp, "sigfile=%s\n", active[i].attribute.sigfile);
  1030. X          fprintf (fp, "followup_to=%s\n", active[i].attribute.followup_to);
  1031. X!         fprintf (fp, "printer=%s\n", active[i].attribute.printer);
  1032. X!         fprintf (fp, "show_only_unread=%s\n", 
  1033. X!             (active[i].attribute.show_only_unread ? "ON" : "OFF"));
  1034. X!         fprintf (fp, "thread_arts=%s\n", 
  1035. X!             (active[i].attribute.thread_arts ? "ON" : "OFF"));
  1036. X!         fprintf (fp, "auto_save=%s\n", 
  1037. X!             (active[i].attribute.auto_save ? "ON" : "OFF"));
  1038. X!         fprintf (fp, "batch_save=%s\n", 
  1039. X!             (active[i].attribute.batch_save ? "ON" : "OFF"));
  1040. X!         fprintf (fp, "delete_tmp_files=%s\n", 
  1041. X!             (active[i].attribute.delete_tmp_files ? "ON" : "OFF"));
  1042. X          fprintf (fp, "sort_art_type=%d\n", active[i].attribute.sort_art_type);
  1043. X          fprintf (fp, "show_author=%d\n", active[i].attribute.show_author);
  1044. X          fprintf (fp, "post_proc_type=%d\n", active[i].attribute.post_proc_type);
  1045. X***************
  1046. X*** 744,817 ****
  1047. X  }
  1048. X  
  1049. X  /*
  1050. X-  *  Load the text description from LIBDIR/newsgroups for each group into the 
  1051. X-  *  active[] array. Save a copy locally if reading via NNTP to save bandwidth.
  1052. X-  */
  1053. X- 
  1054. X- void read_newsgroups_file ()
  1055. X- {
  1056. X- #ifndef INDEX_DAEMON
  1057. X- 
  1058. X-     FILE *fp;
  1059. X-     FILE *fp_save = (FILE *) 0;
  1060. X-     char *p, *q;
  1061. X-     char buf[LEN];
  1062. X-     char group[PATH_LEN];
  1063. X-     int i, save_ok = FALSE;
  1064. X-     
  1065. X-     if (show_description == FALSE || save_news || catchup) {
  1066. X-         return;
  1067. X-     }
  1068. X- 
  1069. X-     if ((fp = open_newsgroups_fp ()) == (FILE *) 0) {
  1070. X-         return;
  1071. X-     }
  1072. X- 
  1073. X-     if (read_news_via_nntp && ! read_local_newsgroups_file) {
  1074. X-         if ((fp_save = fopen (local_newsgroups_file, "w")) != (FILE *) 0) {
  1075. X-             save_ok = TRUE;
  1076. X-         }
  1077. X-     }
  1078. X-     
  1079. X-     wait_message (txt_reading_newsgroups_file);
  1080. X- 
  1081. X-     while (fgets (buf, sizeof (buf), fp) != NULL) {
  1082. X-         if (save_ok && read_news_via_nntp && ! read_local_newsgroups_file) {
  1083. X-             fputs (buf, fp_save);
  1084. X-         }
  1085. X- 
  1086. X-         buf[strlen (buf)-1] = '\0';
  1087. X- 
  1088. X-         for (p = buf, q = group ; *p && *p != ' ' && *p != '\t' ; p++, q++) {
  1089. X-             *q = *p;
  1090. X-         }
  1091. X-         *q = '\0';
  1092. X- 
  1093. X-         while (*p == '\t' || *p == ' ') {
  1094. X-             p++;
  1095. X-         }    
  1096. X- 
  1097. X-         i = find_group_index (group);
  1098. X-          
  1099. X-         if (i >= 0 && active[i].description == (char *) 0) {
  1100. X-             active[i].description = str_dup (p);
  1101. X-         }
  1102. X-     }
  1103. X-     fclose (fp);
  1104. X- 
  1105. X-     if (save_ok && read_news_via_nntp && ! read_local_newsgroups_file) {
  1106. X-         fclose (fp_save);
  1107. X-         read_local_newsgroups_file = TRUE;
  1108. X-     }
  1109. X- 
  1110. X-     if (cmd_line && ! update && ! verbose) {
  1111. X-         wait_message ("\n");
  1112. X-     }
  1113. X- #endif    /* INDEX_DAEMON */
  1114. X- }
  1115. X- 
  1116. X- 
  1117. X- /*
  1118. X   *  Load the last updated time for each group in the active file so that
  1119. X   *  tind is more efficient and only has to stat the group dir and compare
  1120. X   *  the last changed time with the time read from the ~/.tin/active.times
  1121. X--- 857,862 ----
  1122. X***************
  1123. X*** 957,959 ****
  1124. X--- 1002,1090 ----
  1125. X  
  1126. X      return (found ? i : -1);
  1127. X  }
  1128. X+ 
  1129. X+ /*
  1130. X+  *  check for message of the day (motd) file
  1131. X+  *
  1132. X+  * If reading news locally stat() the active file to get its
  1133. X+  * mtime otherwise do a XMOTD command to the NNTP server
  1134. X+  */
  1135. X+ 
  1136. X+ void read_motd_file ()
  1137. X+ {
  1138. X+ #ifndef INDEX_DAEMON
  1139. X+ 
  1140. X+     char buf[LEN];
  1141. X+     char motd_file_date[32];
  1142. X+     FILE *fp = (FILE *) 0;
  1143. X+     int lineno = 0;
  1144. X+     long new_motd_date = 0L;
  1145. X+     long old_motd_date = 0L;
  1146. X+     struct stat sb;
  1147. X+     struct tm *tm;
  1148. X+ 
  1149. X+     if (update && ! update_fork) {
  1150. X+         return;
  1151. X+     }
  1152. X+     
  1153. X+     old_motd_date = atol (motd_file_info);
  1154. X+ 
  1155. X+     /*
  1156. X+      * reading news locally (local) or via NNTP (server name)
  1157. X+      */    
  1158. X+     if (read_news_via_nntp) {
  1159. X+         time (&new_motd_date);
  1160. X+         tm = localtime (&new_motd_date);
  1161. X+         if (! old_motd_date) {
  1162. X+             strcpy (motd_file_date, "920101 000000");
  1163. X+         } else {
  1164. X+             sprintf (motd_file_date, "%02d%02d%02d %02d%02d%02d",
  1165. X+                 tm->tm_year, tm->tm_mon+1, tm->tm_mday, 
  1166. X+                 tm->tm_hour, tm->tm_min, tm->tm_sec);
  1167. X+         }
  1168. X+     } else {
  1169. X+         if (stat (motd_file, &sb) >=0) {
  1170. X+             new_motd_date = sb.st_mtime;
  1171. X+         }
  1172. X+     }
  1173. X+     
  1174. X+     if (old_motd_date && new_motd_date <= old_motd_date) {
  1175. X+         goto read_motd_done;
  1176. X+     }
  1177. X+ 
  1178. X+     /*
  1179. X+      * Only check if spooldir is active news feed
  1180. X+      */
  1181. X+     if (strcmp (spooldir_alias, "news") != 0) {
  1182. X+         goto read_motd_done;
  1183. X+     }
  1184. X+     
  1185. X+     if ((fp = open_motd_fp (motd_file_date)) != (FILE *) 0) {
  1186. X+         while (fgets (buf, sizeof (buf), fp) != NULL) {
  1187. X+             if (buf[0] == '.') {
  1188. X+                 break;
  1189. X+             }
  1190. X+             printf ("%s", buf);
  1191. X+             lineno++;
  1192. X+         }
  1193. X+         fclose (fp);
  1194. X+         
  1195. X+         if (lineno) {
  1196. X+             wait_message (txt_cmdline_hit_any_key);
  1197. X+             Raw (TRUE);
  1198. X+             ReadCh ();    
  1199. X+             Raw (FALSE);
  1200. X+             wait_message ("\n");
  1201. X+         }
  1202. X+     }
  1203. X+ 
  1204. X+ read_motd_done:
  1205. X+     
  1206. X+     /*
  1207. X+      * update motd tinrc entry with new date
  1208. X+      */
  1209. X+     sprintf (motd_file_info, "%ld", new_motd_date);
  1210. X+ 
  1211. X+ #endif    /* INDEX_DAEMON */
  1212. X+ }
  1213. X+ 
  1214. Xdiff -rcs ../1.16/actived.c ./actived.c
  1215. X*** ../1.16/actived.c    Sun Nov 15 18:41:35 1992
  1216. X--- ./actived.c    Sun Nov 15 16:02:48 1992
  1217. X***************
  1218. X*** 3,9 ****
  1219. X   *  Module    : actived.c
  1220. X   *  Author    : M.Tomlinson & I.Lea
  1221. X   *  Created   : 23-08-92
  1222. X!  *  Updated   : 23-08-92
  1223. X   *  Notes     : Creates an active file  by looking through all the 
  1224. X   *              .next files in  the news directories, and  writing 
  1225. X   *              this to UULIB:newactive. The UULIB:newsgroups file 
  1226. X--- 3,9 ----
  1227. X   *  Module    : actived.c
  1228. X   *  Author    : M.Tomlinson & I.Lea
  1229. X   *  Created   : 23-08-92
  1230. X!  *  Updated   : 17-09-92
  1231. X   *  Notes     : Creates an active file  by looking through all the 
  1232. X   *              .next files in  the news directories, and  writing 
  1233. X   *              this to UULIB:newactive. The UULIB:newsgroups file 
  1234. X***************
  1235. X*** 23,29 ****
  1236. X  main ()
  1237. X  {
  1238. X      char groupname[81];
  1239. X!     char next_path[90], 
  1240. X      char *p, last[21];
  1241. X      FILE *fp, *ng, *active;
  1242. X      long x;
  1243. X--- 23,29 ----
  1244. X  main ()
  1245. X  {
  1246. X      char groupname[81];
  1247. X!     char next_path[90];
  1248. X      char *p, last[21];
  1249. X      FILE *fp, *ng, *active;
  1250. X      long x;
  1251. Xdiff -rcs ../1.16/amiga.c ./amiga.c
  1252. X*** ../1.16/amiga.c    Sun Nov 15 18:41:45 1992
  1253. X--- ./amiga.c    Sun Nov 15 16:02:48 1992
  1254. X***************
  1255. X*** 3,9 ****
  1256. X   *  Module    : amiga.c
  1257. X   *  Author    : M.Tomlinson & I.Lea
  1258. X   *  Created   : 01-04-91
  1259. X!  *  Updated   : 12-08-92
  1260. X   *  Notes     : Extra functions for Amiga port
  1261. X   *  Copyright : (c) Copyright 1991-92 by Mark Tomlinson & Iain Lea
  1262. X   *              You may  freely  copy or  redistribute  this software,
  1263. X--- 3,9 ----
  1264. X   *  Module    : amiga.c
  1265. X   *  Author    : M.Tomlinson & I.Lea
  1266. X   *  Created   : 01-04-91
  1267. X!  *  Updated   : 04-10-92
  1268. X   *  Notes     : Extra functions for Amiga port
  1269. X   *  Copyright : (c) Copyright 1991-92 by Mark Tomlinson & Iain Lea
  1270. X   *              You may  freely  copy or  redistribute  this software,
  1271. X***************
  1272. X*** 21,27 ****
  1273. X  #include    <pragmas/dos_lib.h>
  1274. X  #include    <ctype.h>
  1275. X  #include    <fcntl.h>
  1276. X! #include    <amiga.h>
  1277. X  
  1278. X  extern struct DosLibrary *DOSBase;
  1279. X  
  1280. X--- 21,27 ----
  1281. X  #include    <pragmas/dos_lib.h>
  1282. X  #include    <ctype.h>
  1283. X  #include    <fcntl.h>
  1284. X! #include    "amiga.h"
  1285. X  
  1286. X  extern struct DosLibrary *DOSBase;
  1287. X  
  1288. X***************
  1289. X*** 57,64 ****
  1290. X   */
  1291. X  
  1292. X  joinpath (str,dir,file)
  1293. X!     char *str, 
  1294. X!     char *dir, 
  1295. X      char *file;
  1296. X  {    
  1297. X      char c;
  1298. X--- 57,64 ----
  1299. X   */
  1300. X  
  1301. X  joinpath (str,dir,file)
  1302. X!     char *str; 
  1303. X!     char *dir; 
  1304. X      char *file;
  1305. X  {    
  1306. X      char c;
  1307. X***************
  1308. X*** 186,192 ****
  1309. X      }
  1310. X  
  1311. X      /* get rid of funnies */
  1312. X!     if (c == ':' || c == '?') 
  1313. X          return '?'; 
  1314. X      }
  1315. X  
  1316. X--- 186,192 ----
  1317. X      }
  1318. X  
  1319. X      /* get rid of funnies */
  1320. X!     if (c == ':' || c == '?') { 
  1321. X          return '?'; 
  1322. X      }
  1323. X  
  1324. X***************
  1325. X*** 298,303 ****
  1326. X--- 298,308 ----
  1327. X      }
  1328. X  }
  1329. X  */
  1330. X+ 
  1331. X+ #else
  1332. X+ /* To satisfy a really picky Ansi compiler */
  1333. X+ 
  1334. X+ ;
  1335. X  
  1336. X  #endif    /* AMIGA */
  1337. X  
  1338. XOnly in .: amiga.h
  1339. Xdiff -rcs ../1.16/art.c ./art.c
  1340. X*** ../1.16/art.c    Sun Nov 15 18:41:45 1992
  1341. X--- ./art.c    Sun Nov 15 16:02:48 1992
  1342. X***************
  1343. X*** 3,9 ****
  1344. X   *  Module    : art.c
  1345. X   *  Author    : I.Lea & R.Skrenta
  1346. X   *  Created   : 01-04-91
  1347. X!  *  Updated   : 13-09-92
  1348. X   *  Notes     :
  1349. X   *  Copyright : (c) Copyright 1991-92 by Iain Lea & Rich Skrenta
  1350. X   *              You may  freely  copy or  redistribute  this software,
  1351. X--- 3,9 ----
  1352. X   *  Module    : art.c
  1353. X   *  Author    : I.Lea & R.Skrenta
  1354. X   *  Created   : 01-04-91
  1355. X!  *  Updated   : 07-11-92
  1356. X   *  Notes     :
  1357. X   *  Copyright : (c) Copyright 1991-92 by Iain Lea & Rich Skrenta
  1358. X   *              You may  freely  copy or  redistribute  this software,
  1359. X***************
  1360. X*** 96,104 ****
  1361. X  {
  1362. X      register int i;
  1363. X  
  1364. X!     for (i = 0; i < top; i++)
  1365. X!         if (arts[i].artnum == art)
  1366. X              return i;
  1367. X  
  1368. X      return -1;
  1369. X  }
  1370. X--- 96,106 ----
  1371. X  {
  1372. X      register int i;
  1373. X  
  1374. X!     for (i = 0; i < top; i++) {
  1375. X!         if (arts[i].artnum == art) {
  1376. X              return i;
  1377. X+         }
  1378. X+     }
  1379. X  
  1380. X      return -1;
  1381. X  }
  1382. X***************
  1383. X*** 105,122 ****
  1384. X  
  1385. X  /*
  1386. X   *  Return TRUE if arts[] contains any expired articles
  1387. X!  *  (articles we have an entry for which don't have a corresponding
  1388. X!  *   article file in the spool directory)
  1389. X   */
  1390. X  
  1391. X! int purge_needed ()
  1392. X  {
  1393. X      register int i;
  1394. X  
  1395. X!     for (i = 0; i < top; i++)
  1396. X!         if (arts[i].thread == ART_EXPIRED)
  1397. X              return TRUE;
  1398. X! 
  1399. X      return FALSE;
  1400. X  }
  1401. X  
  1402. X--- 107,127 ----
  1403. X  
  1404. X  /*
  1405. X   *  Return TRUE if arts[] contains any expired articles
  1406. X!  *  (articles we have an entry for which don't have a 
  1407. X!  *  corresponding article file in the spool directory)
  1408. X   */
  1409. X  
  1410. X! int purge_needed (group_path)
  1411. X!     char *group_path;
  1412. X  {
  1413. X      register int i;
  1414. X  
  1415. X!     for (i = 0; i < top; i++) {
  1416. X!         if (arts[i].thread == ART_EXPIRED) {
  1417. X              return TRUE;
  1418. X!         }
  1419. X!     }
  1420. X!     
  1421. X      return FALSE;
  1422. X  }
  1423. X  
  1424. X***************
  1425. X*** 130,148 ****
  1426. X   *  and attempt to write a new index if necessary.
  1427. X   */
  1428. X  
  1429. X! void index_group (group, group_path)
  1430. X      char *group;
  1431. X      char *group_path;
  1432. X  {
  1433. X      int index; 
  1434. X      int killed = FALSE;
  1435. X      int modified = FALSE;
  1436. X      glob_art_group = group;
  1437. X  
  1438. X-     set_alarm_clock_off ();
  1439. X- 
  1440. X-     set_signals_art ();
  1441. X-     
  1442. X      if (! update) {
  1443. X          sprintf (msg, txt_group, group);
  1444. X          wait_message (msg);
  1445. X--- 135,152 ----
  1446. X   *  and attempt to write a new index if necessary.
  1447. X   */
  1448. X  
  1449. X! int index_group (group, group_path)
  1450. X      char *group;
  1451. X      char *group_path;
  1452. X  {
  1453. X      int index; 
  1454. X      int killed = FALSE;
  1455. X+     int expired = FALSE;
  1456. X      int modified = FALSE;
  1457. X+     register int i;
  1458. X+     
  1459. X      glob_art_group = group;
  1460. X  
  1461. X      if (! update) {
  1462. X          sprintf (msg, txt_group, group);
  1463. X          wait_message (msg);
  1464. X***************
  1465. X*** 149,154 ****
  1466. X--- 153,162 ----
  1467. X      }
  1468. X  
  1469. X      if ((index = find_group_index (group)) >= 0) {
  1470. X+         set_alarm_clock_off ();
  1471. X+ 
  1472. X+         set_signals_art ();
  1473. X+ 
  1474. X          hash_reclaim ();
  1475. X          free_art_array ();
  1476. X  
  1477. X***************
  1478. X*** 162,168 ****
  1479. X           */
  1480. X          modified = read_group (group, group_path);
  1481. X  
  1482. X!         if (modified || purge_needed ()) {
  1483. X              write_index_file (group);
  1484. X          }
  1485. X      
  1486. X--- 170,210 ----
  1487. X           */
  1488. X          modified = read_group (group, group_path);
  1489. X  
  1490. X!         /*
  1491. X!          *  check that user did not abort indexing
  1492. X!          */
  1493. X!         if (modified == -1) {  
  1494. X!             set_alarm_clock_on ();
  1495. X!             return FALSE;
  1496. X!         }
  1497. X! 
  1498. X!         /*
  1499. X!          * Stat all articles to see if any have expired
  1500. X!          */
  1501. X!         if (purge_index_files) {
  1502. X!             if (! cmd_line) {
  1503. X!                 sprintf (msg, txt_purge, group);
  1504. X!                 wait_message (msg);
  1505. X!             }            
  1506. X!             for (i = 0 ; i < top ; i++) {
  1507. X!                 if (! stat_article (arts[i].artnum, group_path)) {
  1508. X!                     expired = TRUE;
  1509. X!                     if (cmd_line && verbose) {
  1510. X!                         fputc ('P', stdout);
  1511. X!                         fflush (stdout);
  1512. X!                     }
  1513. X!                 }
  1514. X!             }
  1515. X!             if (expired && cmd_line && verbose) {
  1516. X!                 fputc ('\n', stdout);
  1517. X!                 fflush (stdout);
  1518. X!             }
  1519. X!         }
  1520. X! 
  1521. X!         /*
  1522. X!          * If reading index file via XINDEX this is useless
  1523. X!          */
  1524. X!         if (expired || modified || purge_needed (group_path)) {
  1525. X              write_index_file (group);
  1526. X          }
  1527. X      
  1528. X***************
  1529. X*** 174,186 ****
  1530. X          if ((modified || killed) && ! update) {
  1531. X              clear_message ();
  1532. X          }
  1533. X      }
  1534. X!     set_alarm_clock_on ();
  1535. X  }
  1536. X  
  1537. X  /*
  1538. X   *  Index a group.  Assumes any existing index has already been
  1539. X!  *  loaded.
  1540. X   */
  1541. X  
  1542. X  int read_group (group, group_path)
  1543. X--- 216,232 ----
  1544. X          if ((modified || killed) && ! update) {
  1545. X              clear_message ();
  1546. X          }
  1547. X+         set_alarm_clock_on ();
  1548. X      }
  1549. X!     return TRUE;
  1550. X  }
  1551. X  
  1552. X  /*
  1553. X   *  Index a group.  Assumes any existing index has already been
  1554. X!  *  loaded. Return values are:
  1555. X!  *    TRUE   loaded index and modified it
  1556. X!  *    FALSE  loaded index but not modified
  1557. X!  *    -1     user aborted indexing operation
  1558. X   */
  1559. X  
  1560. X  int read_group (group, group_path)
  1561. X***************
  1562. X*** 187,209 ****
  1563. X      char *group;
  1564. X      char *group_path;
  1565. X  {
  1566. X      FILE *fp;
  1567. X      int count = 0;
  1568. X      int modified = FALSE;
  1569. X!     int respnum;
  1570. X      long art;
  1571. X      register int i;
  1572. X  
  1573. X!     setup_base (group, group_path);    /* load article numbers into base[] */
  1574. X  
  1575. X      for (i = 0; i < top_base; i++) {    /* for each article # */
  1576. X          art = base[i];
  1577. X  
  1578. X! /*
  1579. X!  *  Do we already have this article in our index?  Change thread from
  1580. X!  *  (ART_EXPIRED) to (ART_NORMAL) if so and skip the header eating.
  1581. X!  */
  1582. X! 
  1583. X          if ((respnum = valid_artnum (art)) >= 0 || art <= last_read_article) {
  1584. X              if (respnum >= 0) {
  1585. X                  arts[respnum].thread = ART_NORMAL;
  1586. X--- 233,279 ----
  1587. X      char *group;
  1588. X      char *group_path;
  1589. X  {
  1590. X+     char buf[PATH_LEN];
  1591. X+     char dir[PATH_LEN];
  1592. X      FILE *fp;
  1593. X      int count = 0;
  1594. X      int modified = FALSE;
  1595. X!     int respnum, total = 0;
  1596. X      long art;
  1597. X      register int i;
  1598. X  
  1599. X!     /*
  1600. X!      * change to groups spooldir to optimize fopen()'s on local articles
  1601. X!      */
  1602. X!     get_cwd (dir);
  1603. X!     joinpath (buf, active[my_group[cur_groupnum]].spooldir, group_path);
  1604. X!     chdir (buf);
  1605. X! 
  1606. X!     buf[0] = '\0';
  1607. X!      
  1608. X!     /* 
  1609. X!      * load article numbers into base[] 
  1610. X!      */
  1611. X!     setup_base (group, group_path);
  1612. X! 
  1613. X!     /*
  1614. X!      *  Count num of arts to index so the user has an idea of index time
  1615. X!      */
  1616. X!     for (i = 0; i < top_base; i++) {
  1617. X!         if (base[i] <= last_read_article || valid_artnum (base[i]) >= 0) {
  1618. X!             continue;
  1619. X!         }
  1620. X!         total++;
  1621. X!     }
  1622. X  
  1623. X      for (i = 0; i < top_base; i++) {    /* for each article # */
  1624. X          art = base[i];
  1625. X  
  1626. X!         /*
  1627. X!          *  Do we already have this article in our index?  Change 
  1628. X!          *  thread from (ART_EXPIRED) to (ART_NORMAL) if so and 
  1629. X!          *  skip the header eating.
  1630. X!          */
  1631. X          if ((respnum = valid_artnum (art)) >= 0 || art <= last_read_article) {
  1632. X              if (respnum >= 0) {
  1633. X                  arts[respnum].thread = ART_NORMAL;
  1634. X***************
  1635. X*** 212,231 ****
  1636. X              continue;
  1637. X          }
  1638. X  
  1639. X          if (! modified) {
  1640. X!             modified = TRUE;   /* we've modified the index */
  1641. X!                                /* it will need to be re-written */
  1642. X          }
  1643. X  
  1644. X!         if ((fp = open_header_fp (group_path, art)) == (FILE *) 0) {
  1645. X              continue;
  1646. X          }
  1647. X!         
  1648. X          /*
  1649. X           *  Add article to arts[]
  1650. X           */
  1651. X!         if (top >= max_art)
  1652. X              expand_art();
  1653. X  
  1654. X          arts[top].artnum = art;
  1655. X          arts[top].thread = ART_NORMAL;
  1656. X--- 282,304 ----
  1657. X              continue;
  1658. X          }
  1659. X  
  1660. X+         /* 
  1661. X+          * we've modified the index so it will need to be re-written 
  1662. X+          */
  1663. X          if (! modified) {
  1664. X!             modified = TRUE;
  1665. X          }
  1666. X  
  1667. X!         if ((fp = open_header_fp (art)) == (FILE *) 0) {
  1668. X              continue;
  1669. X          }
  1670. X! 
  1671. X          /*
  1672. X           *  Add article to arts[]
  1673. X           */
  1674. X!         if (top >= max_art) {
  1675. X              expand_art();
  1676. X+         }
  1677. X  
  1678. X          arts[top].artnum = art;
  1679. X          arts[top].thread = ART_NORMAL;
  1680. X***************
  1681. X*** 233,239 ****
  1682. X          set_article (&arts[top]);
  1683. X  
  1684. X          if (! parse_headers (fp, &arts[top])) {
  1685. X!             debug_nntp ("read_group", "FAILED parse_header()");
  1686. X              fclose (fp);
  1687. X              continue;
  1688. X          }
  1689. X--- 306,313 ----
  1690. X          set_article (&arts[top]);
  1691. X  
  1692. X          if (! parse_headers (fp, &arts[top])) {
  1693. X!             sprintf (buf, "FAILED parse_header(%ld)", art);
  1694. X!             debug_nntp ("read_group", buf);
  1695. X              fclose (fp);
  1696. X              continue;
  1697. X          }
  1698. X***************
  1699. X*** 243,253 ****
  1700. X          top++;
  1701. X  
  1702. X          if (++count % MODULO_COUNT_NUM == 0 && ! update) {
  1703. X! #ifndef SLOW_SCREEN_UPDATE
  1704. X!             sprintf (msg, txt_indexing_num, group, count);
  1705. X! #else
  1706. X!             sprintf (msg, txt_indexing, group);
  1707. X! #endif
  1708. X              wait_message (msg);
  1709. X          }
  1710. X          if (update && verbose) {
  1711. X--- 317,332 ----
  1712. X          top++;
  1713. X  
  1714. X          if (++count % MODULO_COUNT_NUM == 0 && ! update) {
  1715. X!             if (input_pending ()) {
  1716. X!                 if (read (STDIN_FILENO, buf, sizeof (buf)-1)) {
  1717. X!                     if (buf[0] == ESC || buf[0] == 'q' || buf[0] == 'Q') {
  1718. X!                         if (prompt_yn (LINES, txt_abort_indexing, 'y')) {
  1719. X!                             return -1;
  1720. X!                         }
  1721. X!                     }    
  1722. X!                 }
  1723. X!             }
  1724. X!             sprintf (msg, txt_indexing_num, group, count, total);
  1725. X              wait_message (msg);
  1726. X          }
  1727. X          if (update && verbose) {
  1728. X***************
  1729. X*** 261,266 ****
  1730. X--- 340,350 ----
  1731. X          fflush (stdout);
  1732. X      }
  1733. X  
  1734. X+     /*
  1735. X+      * change to previous dir before indexing started
  1736. X+      */
  1737. X+     chdir (dir);
  1738. X+ 
  1739. X      return modified;
  1740. X  }
  1741. X  
  1742. X***************
  1743. X*** 366,377 ****
  1744. X      char art_from_addr[LEN];
  1745. X      char art_full_name[LEN];
  1746. X      char *ptr, *ptrline, *s;
  1747. X!     int flag, n = 0;
  1748. X!     int len = 0, lineno = 0;
  1749. X!     int got_subject = FALSE;
  1750. X!     int got_from = FALSE;
  1751. X!     int got_date = FALSE;
  1752. X      int got_archive = FALSE;
  1753. X      extern int errno;
  1754. X  
  1755. X      while ((n = fread (buf, 1, sizeof (buf)-1, fp)) == 0) {
  1756. X--- 450,463 ----
  1757. X      char art_from_addr[LEN];
  1758. X      char art_full_name[LEN];
  1759. X      char *ptr, *ptrline, *s;
  1760. X!     int flag, n = 0, len = 0;
  1761. X!     int lineno = 0;
  1762. X!     int max_lineno = 25;
  1763. X      int got_archive = FALSE;
  1764. X+     int got_date = FALSE;
  1765. X+     int got_from = FALSE;
  1766. X+     int got_received = FALSE;
  1767. X+     int got_subject = FALSE;
  1768. X      extern int errno;
  1769. X  
  1770. X      while ((n = fread (buf, 1, sizeof (buf)-1, fp)) == 0) {
  1771. X***************
  1772. X*** 409,425 ****
  1773. X          lineno++;
  1774. X  
  1775. X          switch (*ptrline) {
  1776. X!             case 'F':
  1777. X                  if (! got_from) {
  1778. X!                     if (match_header (ptrline, "From", buf2, HEADER_LEN)) {
  1779. X!                         parse_from (buf2, art_from_addr, art_full_name); 
  1780. X                          h->from = hash_str (art_from_addr);
  1781. X!                         h->name = hash_str (art_full_name);
  1782. X                          got_from = TRUE;
  1783. X                      }
  1784. X                  }
  1785. X                  break;
  1786. X!             case 'S':
  1787. X                  if (! got_subject) {
  1788. X                      if (match_header (ptrline, "Subject", buf2, HEADER_LEN)) {
  1789. X                          s = eat_re (buf2);
  1790. X--- 495,523 ----
  1791. X          lineno++;
  1792. X  
  1793. X          switch (*ptrline) {
  1794. X!             case 'F':    /* From:  mandatory */
  1795. X!             case 'T':    /* To:    mandatory (mailbox) */
  1796. X                  if (! got_from) {
  1797. X!                     if (match_header (ptrline, "From", buf2, HEADER_LEN) ||
  1798. X!                         match_header (ptrline, "To", buf2, HEADER_LEN)) {
  1799. X!                         parse_from (buf2, art_from_addr, art_full_name);
  1800. X                          h->from = hash_str (art_from_addr);
  1801. X!                         if (art_full_name[0]) {
  1802. X!                             h->name = hash_str (art_full_name);
  1803. X!                         }
  1804. X                          got_from = TRUE;
  1805. X                      }
  1806. X                  }
  1807. X                  break;
  1808. X!             case 'R':    /* Received:  If found its probably a mail article */
  1809. X!                 if (! got_received) {
  1810. X!                     if (match_header (ptrline, "Received", buf2, HEADER_LEN)) {
  1811. X!                         max_lineno = 50;
  1812. X!                         got_received = TRUE;
  1813. X!                     }
  1814. X!                 }
  1815. X!                 break;
  1816. X!             case 'S':    /* Subject:  mandatory */    
  1817. X                  if (! got_subject) {
  1818. X                      if (match_header (ptrline, "Subject", buf2, HEADER_LEN)) {
  1819. X                          s = eat_re (buf2);
  1820. X***************
  1821. X*** 428,442 ****
  1822. X                      }
  1823. X                  }
  1824. X                  break;
  1825. X!             case 'D':
  1826. X                  if (! got_date) {
  1827. X                      if (match_header (ptrline, "Date", buf2, HEADER_LEN)) {
  1828. X!                         h->date = parsedate (buf2, (char *) 0);
  1829. X                          got_date = TRUE;
  1830. X                      }
  1831. X                  }
  1832. X                  break;
  1833. X!             case 'A':
  1834. X                  if (match_header (ptrline, "Archive-name", buf2, HEADER_LEN) ||
  1835. X                      match_header (ptrline, "Archive-Name", buf2, HEADER_LEN)) {
  1836. X                      if ((s = (char *) strchr (buf2, '/')) != (char *) 0) {
  1837. X--- 526,540 ----
  1838. X                      }
  1839. X                  }
  1840. X                  break;
  1841. X!             case 'D':    /* Date:  mandatory */
  1842. X                  if (! got_date) {
  1843. X                      if (match_header (ptrline, "Date", buf2, HEADER_LEN)) {
  1844. X!                         h->date = parsedate (buf2, (struct _TIMEINFO *) 0);
  1845. X                          got_date = TRUE;
  1846. X                      }
  1847. X                  }
  1848. X                  break;
  1849. X!             case 'A':    /* Archive-name:  optional */
  1850. X                  if (match_header (ptrline, "Archive-name", buf2, HEADER_LEN) ||
  1851. X                      match_header (ptrline, "Archive-Name", buf2, HEADER_LEN)) {
  1852. X                      if ((s = (char *) strchr (buf2, '/')) != (char *) 0) {
  1853. X***************
  1854. X*** 469,476 ****
  1855. X                  break;
  1856. X          }
  1857. X  
  1858. X!         if (! flag || lineno > 25 || got_archive) {
  1859. X!             if (got_subject && got_from && got_date) {
  1860. X                  debug_print_header (h);
  1861. X                  return TRUE;
  1862. X              } else {
  1863. X--- 567,577 ----
  1864. X                  break;
  1865. X          }
  1866. X  
  1867. X!         if (! flag || lineno > max_lineno || got_archive) {
  1868. X!             if (got_from && got_date) {
  1869. X!                 if (! got_subject) {
  1870. X!                     h->subject = hash_str ("<No subject>");
  1871. X!                 }
  1872. X                  debug_print_header (h);
  1873. X                  return TRUE;
  1874. X              } else {
  1875. X***************
  1876. X*** 493,499 ****
  1877. X--- 594,603 ----
  1878. X      char nam[LEN];
  1879. X      FILE *fp;
  1880. X      int *iptr;
  1881. X+     int index;
  1882. X      int realnum;
  1883. X+     long min_artnum = 0L;
  1884. X+     long max_artnum = 0L;
  1885. X      register int i;
  1886. X  
  1887. X      set_tin_uid_gid();
  1888. X***************
  1889. X*** 508,514 ****
  1890. X      /*
  1891. X       *  dump group header info.
  1892. X       */
  1893. X!     if (active[my_group[cur_groupnum]].attribute.sort_art_type != SORT_BY_NOTHING) {
  1894. X          qsort ((char *) arts, top, sizeof (struct article_t), artnum_comp);
  1895. X      }
  1896. X      fprintf (fp, "%s\n", group);
  1897. X--- 612,619 ----
  1898. X      /*
  1899. X       *  dump group header info.
  1900. X       */
  1901. X!     index = my_group[cur_groupnum];
  1902. X!     if (active[index].attribute.sort_art_type != SORT_BY_NOTHING) {
  1903. X          qsort ((char *) arts, top, sizeof (struct article_t), artnum_comp);
  1904. X      }
  1905. X      fprintf (fp, "%s\n", group);
  1906. X***************
  1907. X*** 516,528 ****
  1908. X      if (top <= 0) {
  1909. X          fprintf (fp, "0\n");
  1910. X      } else {
  1911. X!         if (last_read_article > arts[top-1].artnum) {
  1912. X              fprintf (fp, "%ld\n", last_read_article);
  1913. X          } else {
  1914. X!             fprintf (fp, "%ld\n", arts[top-1].artnum);
  1915. X          }
  1916. X      }
  1917. X! 
  1918. X      /*
  1919. X       *  dump articles
  1920. X       */
  1921. X--- 621,650 ----
  1922. X      if (top <= 0) {
  1923. X          fprintf (fp, "0\n");
  1924. X      } else {
  1925. X!         min_artnum = arts[0].artnum;
  1926. X!         max_artnum = arts[top-1].artnum;
  1927. X!         if (last_read_article > max_artnum) {
  1928. X!             max_artnum = last_read_article;
  1929. X              fprintf (fp, "%ld\n", last_read_article);
  1930. X          } else {
  1931. X!             fprintf (fp, "%ld\n", max_artnum);
  1932. X!         }
  1933. X!         if (active[index].type == GROUP_TYPE_MAIL) {
  1934. X!             i = FALSE;
  1935. X!             if (min_artnum > active[index].min) {
  1936. X!                 active[index].min = min_artnum;
  1937. X!                 i = TRUE;
  1938. X!             }
  1939. X!             if (max_artnum > active[index].max) {
  1940. X!                 active[index].max = max_artnum;
  1941. X!                 i = TRUE;
  1942. X!             }
  1943. X!             if (i) {
  1944. X!                 write_mail_active_file ();
  1945. X!             }
  1946. X          }
  1947. X      }
  1948. X!     
  1949. X      /*
  1950. X       *  dump articles
  1951. X       */
  1952. X***************
  1953. X*** 623,629 ****
  1954. X  }
  1955. X  
  1956. X  /*
  1957. X!  *  Read in an index file.
  1958. X   *
  1959. X   *  index file header 
  1960. X   *    1.  newsgroup name (ie. alt.sources)
  1961. X--- 745,751 ----
  1962. X  }
  1963. X  
  1964. X  /*
  1965. X!  *  Read in an index file. 
  1966. X   *
  1967. X   *  index file header 
  1968. X   *    1.  newsgroup name (ie. alt.sources)
  1969. X***************
  1970. X*** 642,653 ****
  1971. X   *    8.  Patch number of Archive: name (ie. 01)    [optional]
  1972. X   */
  1973. X  
  1974. X! int read_index_file (group_name)
  1975. X      char *group_name;
  1976. X  {
  1977. X      int error = 0;
  1978. X      int i, n;
  1979. X-     char buf[LEN], *p;
  1980. X      FILE *fp = NULL;
  1981. X  
  1982. X      top = 0;
  1983. X--- 764,775 ----
  1984. X   *    8.  Patch number of Archive: name (ie. 01)    [optional]
  1985. X   */
  1986. X  
  1987. X! void read_index_file (group_name)
  1988. X      char *group_name;
  1989. X  {
  1990. X+     char buf[LEN], *p;
  1991. X      int error = 0;
  1992. X      int i, n;
  1993. X      FILE *fp = NULL;
  1994. X  
  1995. X      top = 0;
  1996. X***************
  1997. X*** 654,660 ****
  1998. X      last_read_article = 0L;
  1999. X  
  2000. X      if ((fp = open_index_fp (group_name)) == NULL) {
  2001. X!         return FALSE;
  2002. X      }
  2003. X  
  2004. X      /*
  2005. X--- 776,782 ----
  2006. X      last_read_article = 0L;
  2007. X  
  2008. X      if ((fp = open_index_fp (group_name)) == NULL) {
  2009. X!         return;
  2010. X      }
  2011. X  
  2012. X      /*
  2013. X***************
  2014. X*** 679,685 ****
  2015. X      /*
  2016. X       *  load articles
  2017. X       */
  2018. X!     for (; top < i ; top++) {
  2019. X          if (top >= max_art) {
  2020. X              expand_art ();
  2021. X          }
  2022. X--- 801,807 ----
  2023. X      /*
  2024. X       *  load articles
  2025. X       */
  2026. X!     while (top < i) {
  2027. X          if (top >= max_art) {
  2028. X              expand_art ();
  2029. X          }
  2030. X***************
  2031. X*** 688,694 ****
  2032. X          set_article (&arts[top]);
  2033. X  
  2034. X          /*
  2035. X!          * Article no.
  2036. X           */
  2037. X          if (fgets (buf, sizeof buf, fp) == NULL) {
  2038. X              error = 2;
  2039. X--- 810,816 ----
  2040. X          set_article (&arts[top]);
  2041. X  
  2042. X          /*
  2043. X!          * 0.  Article no.
  2044. X           */
  2045. X          if (fgets (buf, sizeof buf, fp) == NULL) {
  2046. X              error = 2;
  2047. X***************
  2048. X*** 697,703 ****
  2049. X          arts[top].artnum = (long) atol (buf);
  2050. X  
  2051. X          /*
  2052. X!          * Subject:
  2053. X           */
  2054. X          if (fgets (buf, sizeof buf, fp) == NULL) {
  2055. X              error = 3;
  2056. X--- 819,825 ----
  2057. X          arts[top].artnum = (long) atol (buf);
  2058. X  
  2059. X          /*
  2060. X!          * 1.  Subject:
  2061. X           */
  2062. X          if (fgets (buf, sizeof buf, fp) == NULL) {
  2063. X              error = 3;
  2064. X***************
  2065. X*** 722,728 ****
  2066. X          }
  2067. X              
  2068. X          /*
  2069. X!          * From: (addr part)
  2070. X           */
  2071. X          if (fgets (buf, sizeof buf, fp) == NULL) {
  2072. X              error = 6;
  2073. X--- 844,850 ----
  2074. X          }
  2075. X              
  2076. X          /*
  2077. X!          * 2.  From: (addr part)
  2078. X           */
  2079. X          if (fgets (buf, sizeof buf, fp) == NULL) {
  2080. X              error = 6;
  2081. X***************
  2082. X*** 747,753 ****
  2083. X          }
  2084. X  
  2085. X          /*
  2086. X!          * From: (full name)
  2087. X           */
  2088. X          if (fgets (buf, sizeof buf, fp) == NULL) {
  2089. X              error = 9;
  2090. X--- 869,875 ----
  2091. X          }
  2092. X  
  2093. X          /*
  2094. X!          * 3.  From: (name part)
  2095. X           */
  2096. X          if (fgets (buf, sizeof buf, fp) == NULL) {
  2097. X              error = 9;
  2098. X***************
  2099. X*** 769,775 ****
  2100. X              for (p = &buf[1];  *p && *p != '\n'; p++)
  2101. X                  continue;
  2102. X              *p = '\0';
  2103. X!             arts[top].name = hash_str (&buf[1]);
  2104. X          } else {
  2105. X              error = 11;
  2106. X              goto corrupt_index;
  2107. X--- 891,899 ----
  2108. X              for (p = &buf[1];  *p && *p != '\n'; p++)
  2109. X                  continue;
  2110. X              *p = '\0';
  2111. X!             if (buf[1]) {
  2112. X!                 arts[top].name = hash_str (&buf[1]);
  2113. X!             }
  2114. X          } else {
  2115. X              error = 11;
  2116. X              goto corrupt_index;
  2117. X***************
  2118. X*** 776,782 ****
  2119. X          }
  2120. X  
  2121. X          /*
  2122. X!          * Date:
  2123. X           */
  2124. X          if (fgets(buf, sizeof buf, fp) == NULL) {
  2125. X              error = 12;
  2126. X--- 900,906 ----
  2127. X          }
  2128. X  
  2129. X          /*
  2130. X!          * 4.  Date:
  2131. X           */
  2132. X          if (fgets(buf, sizeof buf, fp) == NULL) {
  2133. X              error = 12;
  2134. X***************
  2135. X*** 787,793 ****
  2136. X          arts[top].date = atol (buf);
  2137. X  
  2138. X          /*
  2139. X!          * Archive-name:
  2140. X           */
  2141. X          if (fgets(buf, sizeof buf, fp) == NULL) {
  2142. X              error = 13;
  2143. X--- 911,917 ----
  2144. X          arts[top].date = atol (buf);
  2145. X  
  2146. X          /*
  2147. X!          * 5.  Archive-name:
  2148. X           */
  2149. X          if (fgets(buf, sizeof buf, fp) == NULL) {
  2150. X              error = 13;
  2151. X***************
  2152. X*** 814,820 ****
  2153. X          }
  2154. X  
  2155. X          /*
  2156. X!          * part no.
  2157. X           */
  2158. X          if (fgets(buf, sizeof buf, fp) == NULL) {
  2159. X              error = 16;
  2160. X--- 938,944 ----
  2161. X          }
  2162. X  
  2163. X          /*
  2164. X!          * 6.  Part no.
  2165. X           */
  2166. X          if (fgets(buf, sizeof buf, fp) == NULL) {
  2167. X              error = 16;
  2168. X***************
  2169. X*** 827,833 ****
  2170. X          }
  2171. X  
  2172. X          /*
  2173. X!          * patch no.
  2174. X           */
  2175. X          if (fgets(buf, sizeof buf, fp) == NULL) {
  2176. X              error = 17;
  2177. X--- 951,957 ----
  2178. X          }
  2179. X  
  2180. X          /*
  2181. X!          * 7.  Patch no.
  2182. X           */
  2183. X          if (fgets(buf, sizeof buf, fp) == NULL) {
  2184. X              error = 17;
  2185. X***************
  2186. X*** 840,849 ****
  2187. X          }
  2188. X  
  2189. X          debug_print_header (&arts[top]);
  2190. X-     }
  2191. X  
  2192. X      fclose(fp);
  2193. X!     return TRUE;
  2194. X  
  2195. X  corrupt_index:
  2196. X      if (! update) {
  2197. X--- 964,995 ----
  2198. X          }
  2199. X  
  2200. X          debug_print_header (&arts[top]);
  2201. X  
  2202. X+         top++;
  2203. X+     }
  2204. X      fclose(fp);
  2205. X!     
  2206. X!     /*
  2207. X!      * If reading in a mail group index check if min & max numbers are
  2208. X!      * consistant with what has been read from index file.
  2209. X!      */
  2210. X!     i = my_group[cur_groupnum]; 
  2211. X!     if (active[i].type == GROUP_TYPE_MAIL) {
  2212. X!         n = FALSE;
  2213. X!         if (top && top > active[i].max) {
  2214. X!             active[i].max = top;
  2215. X!             n = TRUE;
  2216. X!         }
  2217. X!         if (top && arts[0].artnum > active[i].min) {
  2218. X!             active[i].min = arts[0].artnum;
  2219. X!             n = TRUE;
  2220. X!         }
  2221. X!         if (n) {
  2222. X!             write_mail_active_file ();
  2223. X!         }
  2224. X!     }
  2225. X!      
  2226. X!     return;
  2227. X  
  2228. X  corrupt_index:
  2229. X      if (! update) {
  2230. X***************
  2231. X*** 860,914 ****
  2232. X      if (fp) {
  2233. X          fclose(fp);
  2234. X      }    
  2235. X!     set_tin_uid_gid();
  2236. X      unlink (index_file);
  2237. X!     set_real_uid_gid();
  2238. X      top = 0;
  2239. X-     return FALSE;
  2240. X  }
  2241. X  
  2242. X  
  2243. X  /*
  2244. X!  *  Look in the local $HOME/RCDIR/INDEXDIR (or wherever) directory for the
  2245. X!  *  index file for the given group.  Hashing the group name gets
  2246. X!  *  a number.  See if that #.1 file exists; if so, read first line.
  2247. SHAR_EOF
  2248. true || echo 'restore of tin-1.17.patch failed'
  2249. fi
  2250. echo 'End of tin-1.17 part 2'
  2251. echo 'File tin-1.17.patch is continued in part 3'
  2252. echo 3 > _shar_seq_.tmp
  2253. exit 0
  2254.  
  2255. --
  2256. NAMES  Iain Lea    Iain.Lea%anl433.uucp@Germany.EU.net
  2257. SNAIL  Siemens AG, ANL A433SZ, Gruendlacher Str. 248, 8510 Fuerth, Germany.
  2258. PHONE  +49-911-3089-407 (work) +49-911-331963 (home) +49-911-3089-290 (FAX)  
  2259.