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

  1. Path: sparky!uunet!ferkel.ucsb.edu!taco!rock!concert!rutgers!jvnc.net!darwin.sura.net!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 05/10)
  5. Message-ID: <1992Nov15.155156.20227@anl433.uucp>
  6. Date: 15 Nov 92 15:51:56 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: 2574
  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/part05
  16.  
  17. #!/bin/sh
  18. # this is tin.shar.05 (part 5 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" != 5; 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  #endif
  40. X          switch (ch) {
  41. X              case 'c':
  42. X***************
  43. X*** 202,208 ****
  44. X  
  45. X              case 'f':    /* active (tind) / newsrc (tin) file */
  46. X  #ifdef INDEX_DAEMON
  47. X!                 my_strncpy (active_file, optarg, sizeof (active_file));
  48. X  #else
  49. X                  my_strncpy (newsrc, optarg, sizeof (newsrc));
  50. X  #endif
  51. X--- 203,209 ----
  52. X  
  53. X              case 'f':    /* active (tind) / newsrc (tin) file */
  54. X  #ifdef INDEX_DAEMON
  55. X!                 my_strncpy (news_active_file, optarg, sizeof (news_active_file));
  56. X  #else
  57. X                  my_strncpy (newsrc, optarg, sizeof (newsrc));
  58. X  #endif
  59. X***************
  60. X*** 215,222 ****
  61. X  
  62. X  #if !defined(NNTP_ONLY) || !defined(NNTP_XINDEX)
  63. X              case 'I':
  64. X!                 my_strncpy (indexdir, optarg, sizeof (indexdir));
  65. X!                 mkdir (indexdir, 0777);
  66. X                  break;
  67. X  #endif
  68. X              case 'm':
  69. X--- 216,223 ----
  70. X  
  71. X  #if !defined(NNTP_ONLY) || !defined(NNTP_XINDEX)
  72. X              case 'I':
  73. X!                 my_strncpy (index_newsdir, optarg, sizeof (index_newsdir));
  74. X!                 mkdir (index_newsdir, 0777);
  75. X                  break;
  76. X  #endif
  77. X              case 'm':
  78. X***************
  79. X*** 229,238 ****
  80. X--- 230,244 ----
  81. X                  update = TRUE;
  82. X                  catchup = TRUE;
  83. X                  break;
  84. X+ 
  85. X              case 'p':
  86. X                  my_strncpy (cmd_line_printer, optarg, sizeof (cmd_line_printer));
  87. X                  break;
  88. X  
  89. X+             case 'P':    /* stat every art for a through purge */
  90. X+                 purge_index_files = TRUE;
  91. X+                 break;
  92. X+ 
  93. X              case 'q':
  94. X                  check_for_new_newsgroups = FALSE;
  95. X                  break;
  96. X***************
  97. X*** 307,312 ****
  98. X--- 313,321 ----
  99. X                  exit (1);
  100. X          }
  101. X      }
  102. X+     cmdargs = argv;
  103. X+     num_cmdargs = optind;
  104. X+     max_cmdargs = argc;
  105. X  }
  106. X  
  107. X  /*
  108. X***************
  109. X*** 332,342 ****
  110. X  #ifndef INDEX_DAEMON
  111. X      error_message ("  -H       help information about %s", progname);
  112. X  #endif
  113. X!     error_message ("  -I dir   index file directory [default=%s]", indexdir);
  114. X  #ifndef INDEX_DAEMON
  115. X      error_message ("  -m dir   mailbox directory [default=%s]", default_maildir);
  116. X      error_message ("  -M user  mail new news to specified user (batch mode)", "");
  117. X      error_message ("  -p file  print program with options [default=%s]", DEFAULT_PRINTER);
  118. X      error_message ("  -q       quick start by not checking for new newsgroups", "");
  119. X  #  if defined(NNTP_ABLE) && !defined(NNTP_ONLY)
  120. X      if (! read_news_via_nntp) {
  121. X--- 341,352 ----
  122. X  #ifndef INDEX_DAEMON
  123. X      error_message ("  -H       help information about %s", progname);
  124. X  #endif
  125. X!     error_message ("  -I dir   news index file directory [default=%s]", index_newsdir);
  126. X  #ifndef INDEX_DAEMON
  127. X      error_message ("  -m dir   mailbox directory [default=%s]", default_maildir);
  128. X      error_message ("  -M user  mail new news to specified user (batch mode)", "");
  129. X      error_message ("  -p file  print program with options [default=%s]", DEFAULT_PRINTER);
  130. X+     error_message ("  -P       purge any expired articles from index files", "");
  131. X      error_message ("  -q       quick start by not checking for new newsgroups", "");
  132. X  #  if defined(NNTP_ABLE) && !defined(NNTP_ONLY)
  133. X      if (! read_news_via_nntp) {
  134. X***************
  135. X*** 343,349 ****
  136. X          error_message ("  -r       read news remotely from default NNTP server", "");
  137. X      }
  138. X  #  endif /* NNTP_ABLE */    
  139. X!     error_message ("  -R       read news saved by -S option (not yet implemented)", "");
  140. X      error_message ("  -s dir   save news directory [default=%s]", default_savedir);
  141. X      error_message ("  -S       save new news for later reading (batch mode)", "");
  142. X  #  if !defined(NNTP_ONLY) || !defined(NNTP_XINDEX)
  143. X--- 353,359 ----
  144. X          error_message ("  -r       read news remotely from default NNTP server", "");
  145. X      }
  146. X  #  endif /* NNTP_ABLE */    
  147. X!     error_message ("  -R       read news saved by -S option", "");
  148. X      error_message ("  -s dir   save news directory [default=%s]", default_savedir);
  149. X      error_message ("  -S       save new news for later reading (batch mode)", "");
  150. X  #  if !defined(NNTP_ONLY) || !defined(NNTP_XINDEX)
  151. X***************
  152. X*** 350,355 ****
  153. X--- 360,367 ----
  154. X      error_message ("  -u       update index files (batch mode)", "");
  155. X      error_message ("  -U       update index files in the background while reading news", "");
  156. X  #  endif /* NNTP_XINDEX */
  157. X+ #else
  158. X+     error_message ("  -P       purge any expired articles from index files", "");
  159. X  #endif /* INDEX_DAEMON */
  160. X      error_message ("  -v       verbose output for batch mode options", "");
  161. X  #ifndef INDEX_DAEMON
  162. X***************
  163. X*** 517,519 ****
  164. X--- 529,560 ----
  165. X      }
  166. X  }
  167. X  
  168. X+ 
  169. X+ int read_cmd_line_groups ()
  170. X+ {
  171. X+     char buf[PATH_LEN];
  172. X+     int matched = FALSE;
  173. X+     int num = num_cmdargs;
  174. X+     register int i;
  175. X+         
  176. X+     if  (num < max_cmdargs) {
  177. X+         group_top = 0;    
  178. X+     
  179. X+         while (num < max_cmdargs) {
  180. X+             sprintf (buf, "Matching %s groups...", cmdargs[num]);
  181. X+             wait_message (buf);
  182. X+             
  183. X+             for (i = 0 ; i < num_active ; i++) {
  184. X+                 if (wildmat (active[i].name, cmdargs[num])) {        
  185. X+                     if (add_group (active[i].name, TRUE) < 0) {
  186. X+                         error_message (txt_not_in_active_file, active[i].name);
  187. X+                     }
  188. X+                 }    
  189. X+             }    
  190. X+             num++;
  191. X+         }
  192. X+         matched = TRUE;
  193. X+     }
  194. X+     
  195. X+     return (matched);
  196. X+ }
  197. Xdiff -rcs ../1.16/memory.c ./memory.c
  198. X*** ../1.16/memory.c    Sun Nov 15 18:41:55 1992
  199. X--- ./memory.c    Sun Nov 15 16:02:48 1992
  200. X***************
  201. X*** 3,9 ****
  202. X   *  Module    : memory.c
  203. X   *  Author    : I.Lea & R.Skrenta
  204. X   *  Created   : 01-04-91
  205. X!  *  Updated   : 31-07-92
  206. X   *  Notes     :
  207. X   *  Copyright : (c) Copyright 1991-92 by Iain Lea & Rich Skrenta
  208. X   *              You may  freely  copy or  redistribute  this software,
  209. X--- 3,9 ----
  210. X   *  Module    : memory.c
  211. X   *  Author    : I.Lea & R.Skrenta
  212. X   *  Created   : 01-04-91
  213. X!  *  Updated   : 25-10-92
  214. X   *  Notes     :
  215. X   *  Copyright : (c) Copyright 1991-92 by Iain Lea & Rich Skrenta
  216. X   *              You may  freely  copy or  redistribute  this software,
  217. X***************
  218. X*** 20,26 ****
  219. X   * num_* values are one past top of used part of array
  220. X   */
  221. X  int max_active = 0;
  222. X! int num_active = 0;
  223. X  int max_active_size = 0;
  224. X  int num_active_size = 0;
  225. X  int max_art = 0;
  226. X--- 20,26 ----
  227. X   * num_* values are one past top of used part of array
  228. X   */
  229. X  int max_active = 0;
  230. X! int num_active = -1;
  231. X  int max_active_size = 0;
  232. X  int num_active_size = 0;
  233. X  int max_art = 0;
  234. X***************
  235. X*** 282,292 ****
  236. X--- 282,302 ----
  237. X              free ((char *) active[i].attribute.savedir);
  238. X              active[i].attribute.savedir = (char *) 0;
  239. X          }
  240. X+         if (active[i].attribute.organization != (char *) 0 &&
  241. X+             active[i].attribute.organization != default_organization) {
  242. X+             free ((char *) active[i].attribute.organization);
  243. X+             active[i].attribute.organization = (char *) 0;
  244. X+         }
  245. X          if (active[i].attribute.sigfile != (char *) 0 &&
  246. X              active[i].attribute.sigfile != default_sigfile) {
  247. X              free ((char *) active[i].attribute.sigfile);
  248. X              active[i].attribute.sigfile = (char *) 0;
  249. X          }
  250. X+         if (active[i].attribute.printer != (char *) 0 &&
  251. X+             active[i].attribute.printer != default_printer) {
  252. X+             free ((char *) active[i].attribute.printer);
  253. X+             active[i].attribute.printer = (char *) 0;
  254. X+         }
  255. X          if (active[i].attribute.followup_to != (char *) 0) {
  256. X              free ((char *) active[i].attribute.followup_to);
  257. X              active[i].attribute.followup_to = (char *) 0;
  258. X***************
  259. X*** 314,319 ****
  260. X--- 324,334 ----
  261. X                  free ((char *) active[i].description);
  262. X                  active[i].description = (char *) 0;
  263. X              }
  264. X+             if (active[i].type == GROUP_TYPE_MAIL &&
  265. X+                 active[i].spooldir != (char *) 0) {
  266. X+                 free ((char *) active[i].spooldir);
  267. X+                 active[i].spooldir = (char *) 0;
  268. X+             }
  269. X          }
  270. X          
  271. X          free_attributes_array ();
  272. X***************
  273. X*** 323,330 ****
  274. X              active = (struct group_t *) 0;
  275. X          }
  276. X      }
  277. X!     
  278. X!     num_active = 0;
  279. X  }
  280. X  
  281. X  
  282. X--- 338,344 ----
  283. X              active = (struct group_t *) 0;
  284. X          }
  285. X      }
  286. X!     num_active = -1;
  287. X  }
  288. X  
  289. X  
  290. Xdiff -rcs ../1.16/misc.c ./misc.c
  291. X*** ../1.16/misc.c    Sun Nov 15 18:41:56 1992
  292. X--- ./misc.c    Sun Nov 15 16:02:48 1992
  293. X***************
  294. X*** 3,9 ****
  295. X   *  Module    : misc.c
  296. X   *  Author    : I.Lea & R.Skrenta
  297. X   *  Created   : 01-04-91
  298. X!  *  Updated   : 06-09-92
  299. X   *  Notes     :
  300. X   *  Copyright : (c) Copyright 1991-92 by Iain Lea & Rich Skrenta
  301. X   *              You may  freely  copy or  redistribute  this software,
  302. X--- 3,9 ----
  303. X   *  Module    : misc.c
  304. X   *  Author    : I.Lea & R.Skrenta
  305. X   *  Created   : 01-04-91
  306. X!  *  Updated   : 07-11-92
  307. X   *  Notes     :
  308. X   *  Copyright : (c) Copyright 1991-92 by Iain Lea & Rich Skrenta
  309. X   *              You may  freely  copy or  redistribute  this software,
  310. X***************
  311. X*** 61,73 ****
  312. X  
  313. X      while (fgets (buf, sizeof (buf), fp_ip) != NULL) {
  314. X          if (fprintf (fp_op, "%s%s", prefix, buf) == EOF) {
  315. X  #ifdef EPIPE
  316. X              if (errno == EPIPE) {
  317. X                  return;
  318. X              }
  319. X  #endif
  320. X!             sprintf (msg, "Error: fprintf() failed in copy_fp(). errno=%d", errno);
  321. X!             perror_message (msg, "");
  322. X          }
  323. X      }
  324. X  }
  325. X--- 61,78 ----
  326. X  
  327. X      while (fgets (buf, sizeof (buf), fp_ip) != NULL) {
  328. X          if (fprintf (fp_op, "%s%s", prefix, buf) == EOF) {
  329. X+             sprintf (msg, "Failed copy_fp(). errno=%d", errno);
  330. X+             perror_message (msg, "");
  331. X  #ifdef EPIPE
  332. X              if (errno == EPIPE) {
  333. X                  return;
  334. X              }
  335. X  #endif
  336. X! #ifdef ENOSPC
  337. X!             if (errno == ENOSPC) {
  338. X!                 return;
  339. X!             }
  340. X! #endif
  341. X          }
  342. X      }
  343. X  }
  344. X***************
  345. X*** 116,122 ****
  346. X  int invoke_ispell (nam)
  347. X      char *nam;
  348. X  {
  349. X! #ifdef USE_ISPELL
  350. X      char buf[PATH_LEN];
  351. X      char *my_ispell;
  352. X      static char ispell[PATH_LEN];
  353. X--- 121,127 ----
  354. X  int invoke_ispell (nam)
  355. X      char *nam;
  356. X  {
  357. X! #ifdef HAVE_ISPELL
  358. X      char buf[PATH_LEN];
  359. X      char *my_ispell;
  360. X      static char ispell[PATH_LEN];
  361. X***************
  362. X*** 174,179 ****
  363. X--- 179,186 ----
  364. X      sprintf (msg, "Shell Command (%s)", p);
  365. X      center_line (0, TRUE, msg);
  366. X      MoveCursor (INDEX_TOP, 0);
  367. X+ 
  368. X+     set_alarm_clock_off ();
  369. X      
  370. X      EndWin ();
  371. X      Raw (FALSE);
  372. X***************
  373. X*** 193,198 ****
  374. X--- 200,207 ----
  375. X      Raw (TRUE);
  376. X      InitWin ();
  377. X  
  378. X+     set_alarm_clock_on ();
  379. X+ 
  380. X      mail_setup ();
  381. X  
  382. X      continue_prompt ();
  383. X***************
  384. X*** 207,213 ****
  385. X      int ret;
  386. X  {
  387. X      extern char index_file[PATH_LEN];
  388. X!     char group_path[PATH_LEN], *p;
  389. X      int ask = TRUE;
  390. X      register int i, j;
  391. X      
  392. X--- 216,222 ----
  393. X      int ret;
  394. X  {
  395. X      extern char index_file[PATH_LEN];
  396. X!     char group_path[PATH_LEN];
  397. X      int ask = TRUE;
  398. X      register int i, j;
  399. X      
  400. X***************
  401. X*** 227,246 ****
  402. X                  }
  403. X                  sprintf (msg, "Catchup %s...", active[my_group[i]].name);
  404. X                  wait_message (msg);
  405. X!                 my_strncpy (group_path, active[my_group[i]].name, sizeof (group_path));
  406. X!                 for (p = group_path ; *p ; p++) {
  407. X!                     if (*p == '.') {
  408. X!                         *p = '/';
  409. X                      }
  410. X!                 }
  411. X!                 index_group (active[my_group[i]].name, group_path);
  412. X!                 for (j = 0; j < top; j++) {
  413. X!                     arts[j].unread = ART_READ;
  414. X                  }
  415. X-                 update_newsrc (active[my_group[i]].name, my_group[i], FALSE);
  416. X              }
  417. X          }
  418. X      }
  419. X      nntp_close ();            /* disconnect from NNTP server */
  420. X      free_all_arrays ();        /* deallocate all arrays */
  421. X      ClearScreen ();
  422. X--- 236,252 ----
  423. X                  }
  424. X                  sprintf (msg, "Catchup %s...", active[my_group[i]].name);
  425. X                  wait_message (msg);
  426. X!                 make_group_path (active[my_group[i]].name, group_path);
  427. X!                 if (index_group (active[my_group[i]].name, group_path)) {
  428. X!                     for (j = 0; j < top; j++) {
  429. X!                         arts[j].unread = ART_READ;
  430. X                      }
  431. X!                     update_newsrc (active[my_group[i]].name, my_group[i], FALSE);
  432. X                  }
  433. X              }
  434. X          }
  435. X      }
  436. X+     write_mail_active_file ();
  437. X      nntp_close ();            /* disconnect from NNTP server */
  438. X      free_all_arrays ();        /* deallocate all arrays */
  439. X      ClearScreen ();
  440. X***************
  441. X*** 590,682 ****
  442. X  }
  443. X  
  444. X  /*
  445. X!  *  Parse various From: lines into the component mail addresses and
  446. X!  *  real names
  447. X   */
  448. X  
  449. X! void parse_from (str, addr, name)
  450. X!     char *str;
  451. X!     char *addr;
  452. X!     char *name;
  453. X! {
  454. X!     register int c;
  455. X!     register char *cp, *ncp;
  456. X!     int gotlt, lastsp, level;
  457. X! 
  458. X!     gotlt = 0;
  459. X!     lastsp = 0;
  460. X!     cp = addr;
  461. X!     ncp = name;
  462. X!     while (*str == ' ')
  463. X!         ++str;
  464. X!     while (c = *str++)
  465. X!         switch (c) {
  466. X!         case '(':
  467. X!             ncp = name;
  468. X!             level = 1;
  469. X!             while (*str != '\0' && level) {
  470. X!                 switch (c = *str++) {
  471. X!                     case '(':
  472. X!                         *ncp++ = c;
  473. X!                         level++;
  474. X!                         break;
  475. X!                     case ')':
  476. X!                         level--;
  477. X!                         if (level > 0)
  478. X!                             *ncp++ = c;
  479. X!                         break;
  480. X!                     default:
  481. X!                         if (c != '"') {    /* IL */
  482. X!                             *ncp++ = c;
  483. X!                         }    
  484. X!                         break;
  485. X!                 }
  486. X!             }
  487. X!             if (*str)
  488. X!                 str++;
  489. X!             lastsp = 0;
  490. X!             break;
  491. X!         case ' ':
  492. X!             if (str[0] == 'a' && str[1] == 't' && str[2] == ' ')
  493. X!                 str += 3, *cp++ = '@';
  494. X!             else if (str[0] == '@' && str[1] == ' ')
  495. X!                 str += 2, *cp++ = '@';
  496. X!             else
  497. X!                 lastsp = 1;
  498. X!             if (ncp > name)
  499. X!                 *ncp++ = ' ';
  500. X!             break;
  501. X!         case '<':
  502. X!             cp = addr;
  503. X!             gotlt++;
  504. X!             lastsp = 0;
  505. X!             break;
  506. X!         case '>':
  507. X!             if (gotlt)
  508. X!                 goto done;
  509. X!             /* FALL THROUGH CASE */
  510. X!         default:
  511. X!             if (lastsp) {
  512. X!                 lastsp = 0;
  513. X!                 *cp++ = ' ';
  514. X!             }
  515. X!             *cp++ = c;
  516. X!             if (! gotlt)
  517. X!                 *ncp++ = c;
  518. X!             break;
  519. X!         }
  520. X! done:
  521. X!     *cp = 0;
  522. X!     while (ncp>name && ncp[-1]==' ')
  523. X!         --ncp;
  524. X!     *ncp = 0;
  525. X!     if (*addr == '@') {
  526. X!         char buf [512];
  527. X! 
  528. X!         strcpy (buf, addr);
  529. X!         strcpy (addr, "root");
  530. X!         strcat (addr, buf);
  531. X!     }
  532. X  }
  533. X  
  534. X  /*
  535. X--- 596,756 ----
  536. X  }
  537. X  
  538. X  /*
  539. X!  * Returns the user name and E-mail address of the user
  540. X!  *
  541. X!  * Written by ahd 15 July 1989
  542. X!  * Borrowed from UUPC/extended with some mods by nms
  543. X   */
  544. X  
  545. X! void parse_from (from_line, eaddr, fname)
  546. X!     char*    from_line;
  547. X!     char*    eaddr;
  548. X!     char*    fname;
  549. X! {
  550. X!     char    *nonblank = NULL;
  551. X!     char    name[LEN];        /* User full name */
  552. X!     char    *nameptr = name;
  553. X!     char    addr[LEN];        /* User e-mail address */
  554. X!      char    *addrptr  = addr;
  555. X!       char    state = 'A';        /* State = skip whitespace */
  556. X!      char    newstate = 'A';        /* Next state to process */
  557. X!      int    bananas = 0;        /* No () being processed now */
  558. X!  
  559. X!      /*
  560. X!       *   Begin loop to copy the input field into the address and the
  561. X!       *   user name.  We will begin by copying both (ignoring whitespace
  562. X!       *   for addresses) because we won't know if the input field is an
  563. X!       *   address or a name until we hit either a special character of
  564. X!       *   some sort.
  565. X!       */
  566. X!  
  567. X!      while ((*from_line != '\0') && (state != ',')) {
  568. X!  
  569. X!          switch (state) {
  570. X!  
  571. X!          case 'A':
  572. X!              if (isspace(*from_line)) /* Found first non-blank? */
  573. X!                  break;           /* No --> keep looking */
  574. X!  
  575. X!              nonblank = from_line;
  576. X!              state = 'B';
  577. X!              /* ... and fall through */
  578. X!  
  579. X!          case 'B':
  580. X!          case ')':
  581. X!              newstate = *from_line;
  582. X!              switch (*from_line) {
  583. X!  
  584. X!              case '(':
  585. X!                  bananas++;
  586. X!                  break;
  587. X!  
  588. X!              case '"':
  589. X!                  break;
  590. X!  
  591. X!              case '<':
  592. X!                  addrptr = addr;   /* Start address over */
  593. X!                  nameptr = name;   /* Start name over again */
  594. X!                  from_line  = nonblank - 1;
  595. X!  
  596. X!                  /* Re-scan in new state */
  597. X!  
  598. X!                  newstate = '>';   /* Proc all-non <> as name */
  599. X!                  break;            /* Begin addr over again */
  600. X!  
  601. X!              case ',':
  602. X!                  break;            /* Terminates address */
  603. X!  
  604. X!              case '>':
  605. X!              case ')':
  606. X!                  strcpy(eaddr, "error@hell");
  607. X!                  *fname = '\0';
  608. X!                  return;
  609. X!  
  610. X!              default:
  611. X!                  newstate = state; /* stay in this state */
  612. X!                  if (!isspace(*from_line))
  613. X!                      *addrptr++ = *from_line;
  614. X!              }  /* switch(*from_line) */
  615. X!              break;
  616. X!  
  617. X!          case '<':   
  618. X!              if (*from_line == '>')
  619. X!                  newstate = '>';
  620. X!              else if (isspace(*from_line))
  621. X!                  *nameptr++ = *from_line;
  622. X!              else
  623. X!                  *addrptr++ = *from_line;
  624. X!              break;
  625. X!  
  626. X!          case '>':   
  627. X!              if (*from_line == '<')
  628. X!                  newstate = '<';
  629. X!              else
  630. X!                  *nameptr++ = *from_line;
  631. X!              break;
  632. X!  
  633. X!          case '(':   
  634. X!              if (*from_line == '(')
  635. X!                  ++bananas;
  636. X!              else if (*from_line == ')')
  637. X!                  if (--bananas == 0) {
  638. X!                      newstate = ')';
  639. X!                      break;
  640. X!                  }
  641. X!              *nameptr++ = *from_line;
  642. X!              break;
  643. X!  
  644. X!          case '"':   
  645. X!              if (*from_line == '"')
  646. X!                  newstate = ')';
  647. X!              else
  648. X!                  *nameptr++ = *from_line;
  649. X!              break;
  650. X!  
  651. X!          default:    
  652. X!  
  653. X!              /* Logic error, bad state */
  654. X!  
  655. X!              strcpy(eaddr, "error@nowhere");
  656. X!              *fname = '\0';
  657. X!              return;
  658. X!          }  /* switch (state) */
  659. X!          state = newstate;
  660. X!          from_line++;
  661. X!      } /* while */
  662. X!  
  663. X!      *addrptr = '\0';
  664. X!      *nameptr = '\0';
  665. X!  
  666. X!      if (state == 'A') {
  667. X!          strcpy(eaddr, "nobody@nowhere");
  668. X!          *fname = '\0';
  669. X!          return;
  670. X!       }
  671. X!   
  672. X!      strcpy(eaddr, addr);         /* Return the full address */
  673. X!      if (state == 'B')
  674. X!          strcpy(fname, "");
  675. X!      else {
  676. X!          while (--nameptr >= name) {
  677. X!              if (isspace(*nameptr) || (*nameptr == '"'))
  678. X!                  *nameptr = '\0';
  679. X!              else
  680. X!                  break;
  681. X!           }
  682. X!   
  683. X!          /* Strip leading blanks from the address */
  684. X!  
  685. X!          nameptr = name;
  686. X!          while ( *(nameptr) != '\0') {
  687. X!              if (!(isspace(*nameptr) || (*nameptr == '"')))
  688. X!                  break;
  689. X!              else
  690. X!                  nameptr++;
  691. X!          }
  692. X!          strcpy(fname, nameptr);
  693. X!      }
  694. X  }
  695. X  
  696. X  /*
  697. X***************
  698. X*** 881,890 ****
  699. X              strcpy (str, arts[respnum].from);
  700. X              break;
  701. X          case SHOW_FROM_NAME:
  702. X!             strcpy (str, arts[respnum].name);
  703. X              break;
  704. X          case SHOW_FROM_BOTH:
  705. X!             if (arts[respnum].name != arts[respnum].from) { 
  706. X                  sprintf (str, "%s (%s)", arts[respnum].name, arts[respnum].from);
  707. X              } else { 
  708. X                  strcpy (str, arts[respnum].from);
  709. X--- 955,968 ----
  710. X              strcpy (str, arts[respnum].from);
  711. X              break;
  712. X          case SHOW_FROM_NAME:
  713. X!             if (arts[respnum].name) {
  714. X!                 strcpy (str, arts[respnum].name);
  715. X!             } else {
  716. X!                 strcpy (str, arts[respnum].from);
  717. X!             }
  718. X              break;
  719. X          case SHOW_FROM_BOTH:
  720. X!             if (arts[respnum].name) { 
  721. X                  sprintf (str, "%s (%s)", arts[respnum].name, arts[respnum].from);
  722. X              } else { 
  723. X                  strcpy (str, arts[respnum].from);
  724. X***************
  725. X*** 973,979 ****
  726. X  void create_index_lock_file (lock_file)
  727. X      char *lock_file;
  728. X  {
  729. X!     char buf[32];
  730. X      FILE *fp;
  731. X      long epoch;
  732. X      struct stat sb;
  733. X--- 1051,1057 ----
  734. X  void create_index_lock_file (lock_file)
  735. X      char *lock_file;
  736. X  {
  737. X!     char buf[64];
  738. X      FILE *fp;
  739. X      long epoch;
  740. X      struct stat sb;
  741. X***************
  742. X*** 1000,1002 ****
  743. X--- 1078,1404 ----
  744. X      }
  745. X  }
  746. X  
  747. X+ /* 
  748. X+  * strfquote - produce formatted quote 
  749. X+  */
  750. X+ 
  751. X+ int strfquote (group, respnum, s, maxsize, format)
  752. X+     char *group;
  753. X+     int respnum;
  754. X+     char *s;
  755. X+     int maxsize;
  756. X+     char *format;
  757. X+ {
  758. X+     extern char note_h_date[PATH_LEN];
  759. X+     extern char note_h_messageid[PATH_LEN];
  760. X+     char *endp = s + maxsize;
  761. X+     char *start = s;
  762. X+     char tbuf[PATH_LEN];
  763. X+     int i;
  764. X+ 
  765. X+     if (s == (char *) 0 || format == (char *) 0 || maxsize == 0) {
  766. X+         return 0;
  767. X+     }
  768. X+ 
  769. X+     if (strchr (format, '%') == (char *) 0 && strlen (format) + 1 >= maxsize) {
  770. X+         return 0;
  771. X+     }
  772. X+ 
  773. X+     for (; *format && s < endp - 1; format++) {
  774. X+         tbuf[0] = '\0';
  775. X+ 
  776. X+         if (*format != '\\' && *format != '%') {
  777. X+             *s++ = *format;
  778. X+             continue;
  779. X+         }
  780. X+ 
  781. X+         if (*format == '\\') {
  782. X+             switch (*++format) {
  783. X+                 case '\0':
  784. X+                     *s++ = '\\';
  785. X+                     goto out;
  786. X+                 case 'n':    /* linefeed */
  787. X+                     strcpy (tbuf, "\n");
  788. X+                     break;
  789. X+                 default:
  790. X+                     tbuf[0] = '%';
  791. X+                     tbuf[1] = *format;
  792. X+                     tbuf[2] = '\0';
  793. X+                     break;
  794. X+             }
  795. X+             i = strlen(tbuf);
  796. X+             if (i) {
  797. X+                 if (s + i < endp - 1) {
  798. X+                     strcpy (s, tbuf);
  799. X+                     s += i;
  800. X+                 } else {
  801. X+                     return 0;
  802. X+                 }
  803. X+             }
  804. X+         }
  805. X+         if (*format == '%') {
  806. X+             switch (*++format) {
  807. X+                 case '\0':
  808. X+                     *s++ = '%';
  809. X+                     goto out;
  810. X+                 case '%':
  811. X+                     *s++ = '%';
  812. X+                     continue;
  813. X+                 case 'A':    /* Articles Email address */
  814. X+                     strcpy (tbuf, arts[respnum].from);
  815. X+                     break;
  816. X+                 case 'D':    /* Articles Date */
  817. X+                     strcpy(tbuf, note_h_date);
  818. X+                     break;
  819. X+                 case 'F':    /* Articles Address+Name */
  820. X+                     if (arts[respnum].name) {
  821. X+                         sprintf (tbuf, "%s (%s)",
  822. X+                             arts[respnum].name,
  823. X+                             arts[respnum].from);
  824. X+                     } else {
  825. X+                         strcpy (tbuf, arts[respnum].from);
  826. X+                     }
  827. X+                     break;
  828. X+                 case 'G':    /* Groupname of Article */
  829. X+                     strcpy (tbuf, group);
  830. X+                     break;
  831. X+                 case 'M':    /* Articles MessageId */
  832. X+                     strcpy (tbuf, note_h_messageid);
  833. X+                     break;
  834. X+                 case 'N':    /* Articles Name of author */
  835. X+                     strcpy (tbuf, arts[respnum].name);
  836. X+                     break;
  837. X+                 default:
  838. X+                     tbuf[0] = '%';
  839. X+                     tbuf[1] = *format;
  840. X+                     tbuf[2] = '\0';
  841. X+                     break;
  842. X+             }
  843. X+             i = strlen(tbuf);
  844. X+             if (i) {
  845. X+                 if (s + i < endp - 1) {
  846. X+                     strcpy (s, tbuf);
  847. X+                     s += i;
  848. X+                 } else {
  849. X+                     return 0;
  850. X+                 }
  851. X+             }
  852. X+         }
  853. X+     }    
  854. X+ out:
  855. X+     if (s < endp && *format == '\0') {
  856. X+         *s = '\0';
  857. X+         return (s - start);
  858. X+     } else
  859. X+         return 0;
  860. X+ }
  861. X+ 
  862. X+ /*
  863. X+  * strfpath - produce formatted pathname expansion. Handles following forms:
  864. X+  *   ~/News    -> /usr/iain/News
  865. X+  *   ~abc/News -> /usr/abc/News
  866. X+  *   $var/News -> /env/var/News
  867. X+  *   =file     -> /usr/iain/Mail/file
  868. X+  *   +file     -> /usr/iain/News/group.name/file
  869. X+  *   ~/News/%G -> /usr/iain/News/group.name
  870. X+  */
  871. X+ 
  872. X+ int strfpath (format, str, maxsize, homedir, maildir, savedir, group)
  873. X+     char *format;
  874. X+     char *str;
  875. X+     int maxsize;
  876. X+     char *homedir;
  877. X+     char *maildir;
  878. X+     char *savedir;
  879. X+     char *group;
  880. X+ {
  881. X+     char *endp = str + maxsize;
  882. X+     char *start = str;
  883. X+     char *envptr;
  884. X+     char *startp = format;
  885. X+     char buf[PATH_LEN];
  886. X+     char tbuf[PATH_LEN];
  887. X+     int i;
  888. X+     struct passwd *pwd;
  889. X+ 
  890. X+     if (str == (char *) 0 || format == (char *) 0 || maxsize == 0) {
  891. X+         return 0;
  892. X+     }
  893. X+ 
  894. X+     if (strlen (format) + 1 >= maxsize) {
  895. X+         return 0;
  896. X+     }
  897. X+ 
  898. X+     for (; *format && str < endp - 1; format++) {
  899. X+         tbuf[0] = '\0';
  900. X+ 
  901. X+         /*
  902. X+          * If just a normal part of the pathname copy it
  903. X+          */
  904. X+         if (! strchr ("~$=+", *format)) {
  905. X+             *str++ = *format;
  906. X+             continue;
  907. X+         }
  908. X+ 
  909. X+         switch (*format) {
  910. X+             case '~':    /* Users or another users homedir */
  911. X+                 switch (*++format) {
  912. X+                     case '/':    /* users homedir */
  913. X+                         sprintf (tbuf, "%s/", homedir);
  914. X+                         break;
  915. X+                     default:    /* some other users homedir */
  916. X+                         i = 0;
  917. X+                         while (*format && *format != '/') {
  918. X+                             tbuf[i++] = *format++;
  919. X+                         }
  920. X+                         tbuf[i] = '\0';
  921. X+                         /*
  922. X+                          * OK lookup the username in/etc/passwd 
  923. X+                          */
  924. X+                         pwd = getpwnam (tbuf);
  925. X+                         if (pwd == (struct passwd *) 0) {
  926. X+                             str[0] = '\0';
  927. X+                             return 0;
  928. X+                         } else {
  929. X+                             sprintf (tbuf, "%s/", pwd->pw_dir);
  930. X+                         }
  931. X+                         break;
  932. X+                 }
  933. X+                 i = strlen (tbuf);
  934. X+                 if (i) {
  935. X+                     if (str + i < endp - 1) {
  936. X+                         strcpy (str, tbuf);
  937. X+                         str += i;
  938. X+                     } else {
  939. X+                         str[0] = '\0';
  940. X+                         return 0;
  941. X+                     }
  942. X+                 }
  943. X+                 break;
  944. X+             case '$':    /* Read the envvar and use its value */
  945. X+                 i = 0;
  946. X+                 format++;
  947. X+                 while (*format && *format != '/') {
  948. X+                     tbuf[i++] = *format++;
  949. X+                 }
  950. X+                 tbuf[i] = '\0';
  951. X+                 /*
  952. X+                  * OK lookup the variable in the shells environment
  953. X+                  */
  954. X+                 envptr = (char *) getenv (tbuf);
  955. X+                 if (envptr == (char *) 0) {
  956. X+                     str[0] = '\0';
  957. X+                     return 0;
  958. X+                 } else {
  959. X+                     sprintf (tbuf, "%s/", envptr);
  960. X+                 }
  961. X+                 i = strlen (tbuf);
  962. X+                 if (i) {
  963. X+                     if (str + i < endp - 1) {
  964. X+                         strcpy (str, tbuf);
  965. X+                         str += i;
  966. X+                     } else {
  967. X+                         str[0] = '\0';
  968. X+                         return 0;
  969. X+                     }
  970. X+                 }
  971. X+                 break;
  972. X+             case '=':    
  973. X+                 /* 
  974. X+                  * Shorthand for group maildir 
  975. X+                  * Only convert if 1st char in format
  976. X+                  */
  977. X+                 if (startp == format && maildir != (char *) 0) {
  978. X+                     sprintf (tbuf, "%s/", maildir);                    
  979. X+                     i = strlen (tbuf);
  980. X+                     if (i) {
  981. X+                         if (str + i < endp - 1) {
  982. X+                             strcpy (str, tbuf);
  983. X+                             str += i;
  984. X+                         } else {
  985. X+                             str[0] = '\0';
  986. X+                             return 0;
  987. X+                         }
  988. X+                     }
  989. X+                 } else {
  990. X+                     *str++ = *format;
  991. X+                 }
  992. X+                 break;
  993. X+             case '+':
  994. X+                 /* 
  995. X+                  * Shorthand for saving to savedir/groupname/file
  996. X+                  * Only convert if 1st char in format
  997. X+                  */
  998. X+                 if (startp == format && savedir != (char *) 0) {
  999. X+                     if (strfpath (savedir, buf, sizeof (buf), homedir,
  1000. X+                         (char *) 0, (char *) 0, (char *) 0)) {
  1001. X+                         sprintf (tbuf, "%s/%s/", buf, group);
  1002. X+                         i = strlen (tbuf);
  1003. X+                         if (i) {
  1004. X+                             if (str + i < endp - 1) {
  1005. X+                                 strcpy (str, tbuf);
  1006. X+                                 str += i;
  1007. X+                             } else {
  1008. X+                                 str[0] = '\0';
  1009. X+                                 return 0;
  1010. X+                             }
  1011. X+                         }
  1012. X+                     } else {
  1013. X+                         str[0] = '\0';
  1014. X+                         return 0;
  1015. X+                     }
  1016. X+                 } else {
  1017. X+                     *str++ = *format;
  1018. X+                 }
  1019. X+                 break;
  1020. X+             case '%':    /* Different forms of parsing cmds */
  1021. X+                 break;
  1022. X+             default:
  1023. X+                 break;
  1024. X+         }
  1025. X+     }    
  1026. X+ 
  1027. X+     if (str < endp && *format == '\0') {
  1028. X+         *str = '\0';
  1029. X+ /*
  1030. X+ clear_message ();
  1031. X+ printf ("!!! format=[%s]  path=[%s]", startp, start);
  1032. X+ fflush (stdout);
  1033. X+ sleep (2);
  1034. X+ */
  1035. X+         return (str - start);
  1036. X+     } else {
  1037. X+         str[0] = '\0';
  1038. X+         return 0;
  1039. X+     }
  1040. X+ }
  1041. X+ 
  1042. X+ 
  1043. X+ void get_cwd (buf)
  1044. X+     char *buf;
  1045. X+ {
  1046. X+ #ifdef DONT_HAVE_GETCWD
  1047. X+     getwd (buf);
  1048. X+ #else
  1049. X+     getcwd (buf, PATH_LEN);
  1050. X+ #endif
  1051. X+ }
  1052. X+ 
  1053. X+ 
  1054. X+ void make_group_path (name, path)
  1055. X+     char *name;
  1056. X+     char *path;
  1057. X+ {
  1058. X+     char *ptr;
  1059. X+     
  1060. X+     strcpy (path, name);
  1061. X+     
  1062. X+     ptr = path;
  1063. X+     
  1064. X+     while (*ptr) {
  1065. X+         if (*ptr == '.') {
  1066. X+             *ptr = '/';
  1067. X+         }
  1068. X+         ptr++;
  1069. X+     }
  1070. X+ }
  1071. Xdiff -rcs ../1.16/newsrc.c ./newsrc.c
  1072. X*** ../1.16/newsrc.c    Sun Nov 15 18:41:57 1992
  1073. X--- ./newsrc.c    Sun Nov 15 16:02:48 1992
  1074. X***************
  1075. X*** 3,9 ****
  1076. X   *  Module    : newsrc.c
  1077. X   *  Author    : I.Lea & R.Skrenta
  1078. X   *  Created   : 01-04-91
  1079. X!  *  Updated   : 23-08-92
  1080. X   *  Notes     :
  1081. X   *  Copyright : (c) Copyright 1991-92 by Iain Lea & Rich Skrenta
  1082. X   *              You may  freely  copy or  redistribute  this software,
  1083. X--- 3,9 ----
  1084. X   *  Module    : newsrc.c
  1085. X   *  Author    : I.Lea & R.Skrenta
  1086. X   *  Created   : 01-04-91
  1087. X!  *  Updated   : 02-11-92
  1088. X   *  Notes     :
  1089. X   *  Copyright : (c) Copyright 1991-92 by Iain Lea & Rich Skrenta
  1090. X   *              You may  freely  copy or  redistribute  this software,
  1091. X***************
  1092. X*** 14,20 ****
  1093. X  
  1094. X  #include    "tin.h"
  1095. X  
  1096. X- 
  1097. X  /*
  1098. X   * Automatically subscribe user to newsgroups specified in
  1099. X   * /usr/lib/news/subscribe (locally) or same file but from
  1100. X--- 14,19 ----
  1101. X***************
  1102. X*** 55,61 ****
  1103. X  
  1104. X  void backup_newsrc ()
  1105. X  {
  1106. X!     char buf[8192];
  1107. X      FILE *fp_newsrc, *fp_backup;
  1108. X      
  1109. X      if ((fp_newsrc = fopen (newsrc, "r")) != NULL) {
  1110. X--- 54,60 ----
  1111. X  
  1112. X  void backup_newsrc ()
  1113. X  {
  1114. X!     char buf[NEWSRC_LINE];
  1115. X      FILE *fp_newsrc, *fp_backup;
  1116. X      
  1117. X      if ((fp_newsrc = fopen (newsrc, "r")) != NULL) {
  1118. X***************
  1119. X*** 80,87 ****
  1120. X  void read_newsrc (sub_only)
  1121. X      int sub_only;        /* TRUE=subscribed groups only, FALSE=all groups */
  1122. X  {
  1123. X!     char c, *p, buf[8192];
  1124. X!     char old_groups[LEN];
  1125. X      FILE *fp = (FILE *) 0;
  1126. X      FILE *fp_old = (FILE *) 0;
  1127. X      int i;
  1128. X--- 79,86 ----
  1129. X  void read_newsrc (sub_only)
  1130. X      int sub_only;        /* TRUE=subscribed groups only, FALSE=all groups */
  1131. X  {
  1132. X!     char c, *p, buf[NEWSRC_LINE];
  1133. X!     char old_groups[PATH_LEN];
  1134. X      FILE *fp = (FILE *) 0;
  1135. X      FILE *fp_old = (FILE *) 0;
  1136. X      int i;
  1137. X***************
  1138. X*** 92,98 ****
  1139. X  reread_newsrc:
  1140. X  
  1141. X      /* 
  1142. X!      * make a .newsrc if one does not exist & auto subscribe to set groups
  1143. X       */
  1144. X      if ((fp = fopen (newsrc, "r")) == NULL) {
  1145. X          if (auto_subscribe_groups ()) {
  1146. X--- 91,97 ----
  1147. X  reread_newsrc:
  1148. X  
  1149. X      /* 
  1150. X!      * make a .newsrc if one does'nt exist & auto subscribe to set groups
  1151. X       */
  1152. X      if ((fp = fopen (newsrc, "r")) == NULL) {
  1153. X          if (auto_subscribe_groups ()) {
  1154. X***************
  1155. X*** 131,142 ****
  1156. X              if (! remove_old_groups) {
  1157. X                  if ((fp_old = fopen (old_groups, "w")) == NULL) {
  1158. X                      perror_message (txt_cannot_open, old_groups);
  1159. X!                     continue;
  1160. X                  }
  1161. X                  remove_old_groups = TRUE;
  1162. X              }
  1163. X!             fprintf (fp_old, "%s\n", buf);
  1164. X!             continue;
  1165. X          }
  1166. X  
  1167. X          if (c != '!') {        /* if we're subscribed to it */
  1168. X--- 130,141 ----
  1169. X              if (! remove_old_groups) {
  1170. X                  if ((fp_old = fopen (old_groups, "w")) == NULL) {
  1171. X                      perror_message (txt_cannot_open, old_groups);
  1172. X!                     continue;
  1173. X                  }
  1174. X                  remove_old_groups = TRUE;
  1175. X              }
  1176. X!             fprintf (fp_old, "%s\n", buf);
  1177. X!             continue;
  1178. X          }
  1179. X  
  1180. X          if (c != '!') {        /* if we're subscribed to it */
  1181. X***************
  1182. X*** 153,158 ****
  1183. X--- 152,158 ----
  1184. X      if (remove_old_groups) {
  1185. X          fclose (fp_old);
  1186. X          rewrite_newsrc ();
  1187. X+         unlink (old_groups);
  1188. X      }
  1189. X  }
  1190. X  
  1191. X***************
  1192. X*** 168,174 ****
  1193. X      FILE *fp;
  1194. X      int i;
  1195. X  
  1196. X!     if ((fp = fopen (newsrc, "w")) == NULL) {
  1197. X          return;
  1198. X      }
  1199. X  
  1200. X--- 168,174 ----
  1201. X      FILE *fp;
  1202. X      int i;
  1203. X  
  1204. X!     if ((fp = fopen (newsrc, "w")) == (FILE *) 0) {
  1205. X          return;
  1206. X      }
  1207. X  
  1208. X***************
  1209. X*** 175,181 ****
  1210. X      wait_message (txt_creating_newsrc);
  1211. X  
  1212. X      for (i=0 ; i < num_active ; i++) {
  1213. X!         fprintf (fp, "%s! \n", active[i].name);
  1214. X      }
  1215. X  
  1216. X      fclose (fp);
  1217. X--- 175,181 ----
  1218. X      wait_message (txt_creating_newsrc);
  1219. X  
  1220. X      for (i=0 ; i < num_active ; i++) {
  1221. X!         fprintf (fp, "%s:\n", active[i].name);
  1222. X      }
  1223. X  
  1224. X      fclose (fp);
  1225. X***************
  1226. X*** 187,194 ****
  1227. X  
  1228. X  void rewrite_newsrc ()
  1229. X  {
  1230. X!     char buf[8192], old[LEN];
  1231. X!     char old_groups[LEN];
  1232. X      FILE *fp, *fp_old, *fp_new;
  1233. X      int found_old_group, len;    
  1234. X  
  1235. X--- 187,195 ----
  1236. X  
  1237. X  void rewrite_newsrc ()
  1238. X  {
  1239. X!     char buf[NEWSRC_LINE];
  1240. X!     char old[NEWSRC_LINE];
  1241. X!     char old_groups[PATH_LEN];
  1242. X      FILE *fp, *fp_old, *fp_new;
  1243. X      int found_old_group, len;    
  1244. X  
  1245. X***************
  1246. X*** 244,254 ****
  1247. X      char *group;
  1248. X  {
  1249. X      FILE *fp;
  1250. X!     char buf[8192];
  1251. X      char *p;
  1252. X  
  1253. X!     if ((fp = fopen (newsrc, "r")) == NULL)
  1254. X          return;
  1255. X  
  1256. X      while (fgets (buf, sizeof buf, fp) != NULL) {
  1257. X          p = buf;
  1258. X--- 245,256 ----
  1259. X      char *group;
  1260. X  {
  1261. X      FILE *fp;
  1262. X!     char buf[NEWSRC_LINE];
  1263. X      char *p;
  1264. X  
  1265. X!     if ((fp = fopen (newsrc, "r")) == NULL) {
  1266. X          return;
  1267. X+     }
  1268. X  
  1269. X      while (fgets (buf, sizeof buf, fp) != NULL) {
  1270. X          p = buf;
  1271. X***************
  1272. X*** 273,283 ****
  1273. X      int groupnum;            /* index into active[] for this group */
  1274. X      int mark_unread;
  1275. X  {
  1276. X      FILE *fp;
  1277. X      FILE *newfp;
  1278. X-     char buf[8192];
  1279. X-     char *p;
  1280. X-     char c;
  1281. X  
  1282. X      if ((newfp = fopen (newnewsrc, "w")) == NULL) {
  1283. X          goto update_done;
  1284. X--- 275,284 ----
  1285. X      int groupnum;            /* index into active[] for this group */
  1286. X      int mark_unread;
  1287. X  {
  1288. X+     char buf[NEWSRC_LINE];
  1289. X+     char c, *p;
  1290. X      FILE *fp;
  1291. X      FILE *newfp;
  1292. X  
  1293. X      if ((newfp = fopen (newnewsrc, "w")) == NULL) {
  1294. X          goto update_done;
  1295. X***************
  1296. X*** 334,344 ****
  1297. X      int num;
  1298. X      int out_seq;                /* output sequencer info? */
  1299. X  {
  1300. X      FILE *fp;
  1301. X      FILE *newfp;
  1302. X-     char buf[8192];
  1303. X-     char *p;
  1304. X-     char c;
  1305. X      int gotit = FALSE;
  1306. X  
  1307. X      if (ch == '!') {
  1308. X--- 335,344 ----
  1309. X      int num;
  1310. X      int out_seq;                /* output sequencer info? */
  1311. X  {
  1312. X+     char buf[NEWSRC_LINE];
  1313. X+     char c, *p;
  1314. X      FILE *fp;
  1315. X      FILE *newfp;
  1316. X      int gotit = FALSE;
  1317. X  
  1318. X      if (ch == '!') {
  1319. X***************
  1320. X*** 402,412 ****
  1321. X  
  1322. X  void reset_newsrc ()
  1323. X  {
  1324. X      FILE *fp;
  1325. X      FILE *newfp;
  1326. X-     char buf[8192];
  1327. X-     char *p;
  1328. X-     char c;
  1329. X      int i;
  1330. X  
  1331. X      if ((newfp = fopen (newnewsrc, "w")) == NULL)
  1332. X--- 402,411 ----
  1333. X  
  1334. X  void reset_newsrc ()
  1335. X  {
  1336. X+     char buf[NEWSRC_LINE];
  1337. X+     char c, *p;
  1338. X      FILE *fp;
  1339. X      FILE *newfp;
  1340. X      int i;
  1341. X  
  1342. X      if ((newfp = fopen (newnewsrc, "w")) == NULL)
  1343. X***************
  1344. X*** 454,464 ****
  1345. X      int gotit = FALSE;
  1346. X      FILE *del;
  1347. X  
  1348. X!     if ((newfp = fopen (newnewsrc, "w")) == NULL)
  1349. X          goto del_done;
  1350. X  
  1351. X!     if ((del = fopen (delgroups, "a+")) == NULL)
  1352. X          goto del_done;
  1353. X  
  1354. X      if ((fp = fopen (newsrc, "r")) != NULL) {
  1355. X          while (fgets (buf, sizeof (buf), fp) != NULL) {
  1356. X--- 453,466 ----
  1357. X      int gotit = FALSE;
  1358. X      FILE *del;
  1359. X  
  1360. X!     if ((newfp = fopen (newnewsrc, "w")) == NULL) {
  1361. X          goto del_done;
  1362. X+     }
  1363. X  
  1364. X!     if ((del = fopen (delgroups, "a+")) == NULL) {
  1365. X!         fclose (newfp);
  1366. X          goto del_done;
  1367. X+     }
  1368. X  
  1369. X      if ((fp = fopen (newsrc, "r")) != NULL) {
  1370. X          while (fgets (buf, sizeof (buf), fp) != NULL) {
  1371. X***************
  1372. X*** 483,494 ****
  1373. X                  fprintf (newfp, "%s%c%s\n", buf, c, p);
  1374. X          }
  1375. X          fclose (fp);
  1376. X      }
  1377. X  
  1378. X-     fclose (newfp);
  1379. X- 
  1380. X      if (! gotit)
  1381. X!         fprintf (del, "%s! \n", group);
  1382. X  
  1383. X      fclose (del);
  1384. X      rename_file (newnewsrc, newsrc);
  1385. X--- 485,495 ----
  1386. X                  fprintf (newfp, "%s%c%s\n", buf, c, p);
  1387. X          }
  1388. X          fclose (fp);
  1389. X+         fclose (newfp);
  1390. X      }
  1391. X  
  1392. X      if (! gotit)
  1393. X!         fprintf (del, "%s!\n", group);
  1394. X  
  1395. X      fclose (del);
  1396. X      rename_file (newnewsrc, newsrc);
  1397. X***************
  1398. X*** 500,514 ****
  1399. X  
  1400. X  int undel_group ()
  1401. X  {
  1402. X      FILE *del;
  1403. X      FILE *newfp;
  1404. X      FILE *fp;
  1405. X!     char buf[2][8192];
  1406. X!     char *p;
  1407. X      int which = 0;
  1408. X      long h;
  1409. X-     int i, j;
  1410. X-     char c;
  1411. X  
  1412. X      if ((del = fopen (delgroups, "r")) == NULL) {
  1413. X          return FALSE;
  1414. X--- 501,514 ----
  1415. X  
  1416. X  int undel_group ()
  1417. X  {
  1418. X+     char buf[2][NEWSRC_LINE];
  1419. X+     char c, *p;
  1420. X      FILE *del;
  1421. X      FILE *newfp;
  1422. X      FILE *fp;
  1423. X!     int i, j;
  1424. X      int which = 0;
  1425. X      long h;
  1426. X  
  1427. X      if ((del = fopen (delgroups, "r")) == NULL) {
  1428. X          return FALSE;
  1429. X***************
  1430. X*** 630,640 ****
  1431. X      char *group;
  1432. X      int groupnum;            /* index into active[] for this group */
  1433. X  {
  1434. X      FILE *fp;
  1435. X      FILE *newfp;
  1436. X-     char buf[8192];
  1437. X-     char *p;
  1438. X-     char c;
  1439. X  
  1440. X      if (active[groupnum].max < 2)
  1441. X          return;
  1442. X--- 630,639 ----
  1443. X      char *group;
  1444. X      int groupnum;            /* index into active[] for this group */
  1445. X  {
  1446. X+     char buf[NEWSRC_LINE];
  1447. X+     char c, *p;
  1448. X      FILE *fp;
  1449. X      FILE *newfp;
  1450. X  
  1451. X      if (active[groupnum].max < 2)
  1452. X          return;
  1453. X***************
  1454. X*** 715,725 ****
  1455. X      char *s;
  1456. X      int groupnum;            /* index for group in active[] */
  1457. X  {
  1458. X      long low, high;
  1459. X      long last_high;
  1460. X-     int sum = 0;
  1461. X-     int gotone = FALSE;
  1462. X-     int n;
  1463. X  
  1464. X      high = 0;
  1465. X  
  1466. X--- 714,723 ----
  1467. X      char *s;
  1468. X      int groupnum;            /* index for group in active[] */
  1469. X  {
  1470. X+     int n, sum = 0;
  1471. X+     int gotone = FALSE;
  1472. X      long low, high;
  1473. X      long last_high;
  1474. X  
  1475. X      high = 0;
  1476. X  
  1477. X***************
  1478. X*** 727,735 ****
  1479. X          while (*s && (*s < '0' || *s > '9')) {
  1480. X              s++;
  1481. X          }    
  1482. X! 
  1483. X          if (*s && *s >= '0' && *s <= '9') {
  1484. X              low = (long) atol (s);
  1485. X              while (*s && *s >= '0' && *s <= '9')
  1486. X                  s++;
  1487. X              if (*s == '-') {
  1488. X--- 725,736 ----
  1489. X          while (*s && (*s < '0' || *s > '9')) {
  1490. X              s++;
  1491. X          }    
  1492. X! #if 0
  1493. X          if (*s && *s >= '0' && *s <= '9') {
  1494. X              low = (long) atol (s);
  1495. X+ #endif
  1496. X+         if (!*s || *s >= '0' && *s <= '9') {
  1497. X+             low = *s ? (long) atol (s) : 0L;
  1498. X              while (*s && *s >= '0' && *s <= '9')
  1499. X                  s++;
  1500. X              if (*s == '-') {
  1501. X***************
  1502. X*** 790,802 ****
  1503. X  }
  1504. X  
  1505. X  
  1506. X! int get_line_unread(group, groupnum)
  1507. X      char *group;
  1508. X      int groupnum;                /* index for group in active[] */
  1509. X  {
  1510. X      FILE *fp;
  1511. X-     char buf[8192];
  1512. X-     char *p;
  1513. X      int ret = -1;
  1514. X  
  1515. X      if ((fp = fopen(newsrc, "r")) == NULL)
  1516. X--- 791,802 ----
  1517. X  }
  1518. X  
  1519. X  
  1520. X! int get_line_unread (group, groupnum)
  1521. X      char *group;
  1522. X      int groupnum;                /* index for group in active[] */
  1523. X  {
  1524. X+     char *p, buf[NEWSRC_LINE];
  1525. X      FILE *fp;
  1526. X      int ret = -1;
  1527. X  
  1528. X      if ((fp = fopen(newsrc, "r")) == NULL)
  1529. X***************
  1530. X*** 825,832 ****
  1531. X      int groupnum;            /* index into active[] for this group */
  1532. X  {
  1533. X      long int artnum, last_read, artmax;
  1534. X!     int i;
  1535. X!     int flag = FALSE;
  1536. X      
  1537. X      assert(top >= 0);
  1538. X  
  1539. X--- 825,831 ----
  1540. X      int groupnum;            /* index into active[] for this group */
  1541. X  {
  1542. X      long int artnum, last_read, artmax;
  1543. X!     int i, flag = FALSE;
  1544. X      
  1545. X      assert(top >= 0);
  1546. X  
  1547. X***************
  1548. X*** 903,912 ****
  1549. X      char *group;
  1550. X      int pos;
  1551. X  {
  1552. X!     char sub[1024];
  1553. X!     char unsub[1024];
  1554. X!     char buf[1024];
  1555. X!     char newsgroup[1024];
  1556. X      FILE *fp_in, *fp_out;
  1557. X      FILE *fp_sub, *fp_unsub;
  1558. X      int repositioned = FALSE;
  1559. X--- 902,911 ----
  1560. X      char *group;
  1561. X      int pos;
  1562. X  {
  1563. X!     char buf[NEWSRC_LINE];
  1564. X!     char newsgroup[NEWSRC_LINE];
  1565. X!     char sub[PATH_LEN];
  1566. X!     char unsub[PATH_LEN];
  1567. X      FILE *fp_in, *fp_out;
  1568. X      FILE *fp_sub, *fp_unsub;
  1569. X      int repositioned = FALSE;
  1570. X***************
  1571. X*** 922,929 ****
  1572. X          goto rewrite_group_done;
  1573. X      }
  1574. X  
  1575. X!     sprintf (sub, "/tmp/.subrc.%d", process_id);
  1576. X!     sprintf (unsub, "/tmp/.unsubrc.%d", process_id);
  1577. X  
  1578. X      if ((fp_sub = fopen (sub, "w")) == NULL) {
  1579. X          goto rewrite_group_done;
  1580. X--- 921,931 ----
  1581. X          goto rewrite_group_done;
  1582. X      }
  1583. X  
  1584. X!     joinpath (buf, TMPDIR, ".subrc");
  1585. X!     sprintf (sub, "%s.%d", buf, process_id);
  1586. X! 
  1587. X!     joinpath (buf, TMPDIR, ".unsubrc");
  1588. X!     sprintf (unsub, "%s.%d", buf, process_id);
  1589. X  
  1590. X      if ((fp_sub = fopen (sub, "w")) == NULL) {
  1591. X          goto rewrite_group_done;
  1592. Xdiff -rcs ../1.16/nntplib.c ./nntplib.c
  1593. X*** ../1.16/nntplib.c    Sun Nov 15 18:41:58 1992
  1594. X--- ./nntplib.c    Sun Nov 15 16:02:48 1992
  1595. X***************
  1596. X*** 3,11 ****
  1597. X   *  Module    : nntplib.c
  1598. X   *  Author    : S.Barber & I.Lea
  1599. X   *  Created   : 12-01-91
  1600. X!  *  Updated   : 01-07-92
  1601. X!  *  Notes     : NNTP client routines taken from clientlib.c v1.6
  1602. X!  *              1.5.11 (10 February 1991)
  1603. X   *  Copyright : (c) Copyright 1991-92 by Stan Barber & Iain Lea
  1604. X   *              Permission is hereby granted to copy, reproduce, redistribute
  1605. X   *              or otherwise use this software  as long as: there is no
  1606. X--- 3,10 ----
  1607. X   *  Module    : nntplib.c
  1608. X   *  Author    : S.Barber & I.Lea
  1609. X   *  Created   : 12-01-91
  1610. X!  *  Updated   : 07-11-92
  1611. X!  *  Notes     : NNTP client routines taken from clientlib.c 1.5.11 (10-02-91)
  1612. X   *  Copyright : (c) Copyright 1991-92 by Stan Barber & Iain Lea
  1613. X   *              Permission is hereby granted to copy, reproduce, redistribute
  1614. X   *              or otherwise use this software  as long as: there is no
  1615. X***************
  1616. X*** 25,32 ****
  1617. X  
  1618. X  #ifndef CDROM_ABLE
  1619. X  
  1620. X! FILE    *ser_rd_fp = NULL;
  1621. X! FILE    *ser_wr_fp = NULL;
  1622. X  
  1623. X  extern    int errno;
  1624. X  
  1625. X--- 24,31 ----
  1626. X  
  1627. X  #ifndef CDROM_ABLE
  1628. X  
  1629. X! FILE    *nntp_rd_fp = NULL;
  1630. X! FILE    *nntp_wr_fp = NULL;
  1631. X  
  1632. X  extern    int errno;
  1633. X  
  1634. X***************
  1635. X*** 64,70 ****
  1636. X  #    endif
  1637. X  
  1638. X  #    ifdef EXCELAN
  1639. X- #        define    IPPORT_NNTP    ((unsigned short) 119)
  1640. X  #        if __STDC__
  1641. X              int connect (int, struct sockaddr *);
  1642. X              unsigned short htons (unsigned short);
  1643. X--- 63,68 ----
  1644. X***************
  1645. X*** 99,105 ****
  1646. X      char    *file;
  1647. X  {
  1648. X  #ifdef NNTP_ABLE
  1649. X-     extern int debug;
  1650. X      register FILE    *fp;
  1651. X      register char    *cp;
  1652. X      static char    buf[256];
  1653. X--- 97,102 ----
  1654. X***************
  1655. X*** 133,152 ****
  1656. X  }
  1657. X  
  1658. X  /*
  1659. X!  * server_init  Get a connection to the remote news server.
  1660. X   *
  1661. X   *    Parameters:    "machine" is the machine to connect to.
  1662. X   *
  1663. X   *    Returns:    -1 on error
  1664. X   *            server's initial response code on success.
  1665. X   *
  1666. X   *    Side effects:    Connects to server.
  1667. X!  *            "ser_rd_fp" and "ser_wr_fp" are fp's
  1668. X   *            for reading and writing to server.
  1669. X   */
  1670. X  
  1671. X! int server_init (machine)
  1672. X      char    *machine;
  1673. X  {
  1674. X  #ifdef NNTP_ABLE
  1675. X      int    sockt_rd, sockt_wr;
  1676. X--- 130,153 ----
  1677. X  }
  1678. X  
  1679. X  /*
  1680. X!  * server_init  Get a connection to the remote server.
  1681. X   *
  1682. X   *    Parameters:    "machine" is the machine to connect to.
  1683. X+  *            "service" is the service to connect to on the machine.
  1684. X+  *            "port" is the servive port to connect to.
  1685. X   *
  1686. X   *    Returns:    -1 on error
  1687. X   *            server's initial response code on success.
  1688. X   *
  1689. X   *    Side effects:    Connects to server.
  1690. X!  *            "nntp_rd_fp" and "nntp_wr_fp" are fp's
  1691. X   *            for reading and writing to server.
  1692. X   */
  1693. X  
  1694. X! int server_init (machine, service, port)
  1695. X      char    *machine;
  1696. X+     char    *service;
  1697. X+     unsigned short port;
  1698. X  {
  1699. X  #ifdef NNTP_ABLE
  1700. X      int    sockt_rd, sockt_wr;
  1701. X***************
  1702. X*** 158,169 ****
  1703. X  
  1704. X      if (cp && cp[1] == ':') {
  1705. X          *cp = '\0';
  1706. X!         sockt_rd = get_dnet_socket (machine);
  1707. X      } else {
  1708. X!         sockt_rd = get_tcp_socket (machine);
  1709. X      }
  1710. X  #else
  1711. X!     sockt_rd = get_tcp_socket (machine);
  1712. X  #endif
  1713. X  
  1714. X      if (sockt_rd < 0)
  1715. X--- 159,170 ----
  1716. X  
  1717. X      if (cp && cp[1] == ':') {
  1718. X          *cp = '\0';
  1719. X!         sockt_rd = get_dnet_socket (machine, service);
  1720. X      } else {
  1721. X!         sockt_rd = get_tcp_socket (machine, service, port);
  1722. X      }
  1723. X  #else
  1724. X!     sockt_rd = get_tcp_socket (machine, service, port);
  1725. X  #endif
  1726. X  
  1727. X      if (sockt_rd < 0)
  1728. X***************
  1729. X*** 176,182 ****
  1730. X       * up two separate fp's, one for reading, one for writing.
  1731. X       */
  1732. X  
  1733. X!     if ((ser_rd_fp = (FILE *) fdopen (sockt_rd, "r")) == NULL) {
  1734. X          perror ("server_init: fdopen #1");
  1735. X          return (-1);
  1736. X      }
  1737. X--- 177,183 ----
  1738. X       * up two separate fp's, one for reading, one for writing.
  1739. X       */
  1740. X  
  1741. X!     if ((nntp_rd_fp = (FILE *) fdopen (sockt_rd, "r")) == NULL) {
  1742. X          perror ("server_init: fdopen #1");
  1743. X          return (-1);
  1744. X      }
  1745. X***************
  1746. X*** 185,197 ****
  1747. X  #ifdef TLI
  1748. X      if (t_sync (sockt_rd) < 0) {    /* Sync up new fd with TLI */
  1749. X              t_error ("server_init: t_sync");
  1750. X!         ser_rd_fp = NULL;        /* from above */
  1751. X          return (-1);
  1752. X      }
  1753. X  #endif
  1754. X!     if ((ser_wr_fp = (FILE *) fdopen (sockt_wr, "w")) == NULL) {
  1755. X          perror ("server_init: fdopen #2");
  1756. X!         ser_rd_fp = NULL;        /* from above */
  1757. X          return (-1);
  1758. X      }
  1759. X  
  1760. X--- 186,198 ----
  1761. X  #ifdef TLI
  1762. X      if (t_sync (sockt_rd) < 0) {    /* Sync up new fd with TLI */
  1763. X              t_error ("server_init: t_sync");
  1764. X!         nntp_rd_fp = NULL;        /* from above */
  1765. X          return (-1);
  1766. X      }
  1767. X  #endif
  1768. X!     if ((nntp_wr_fp = (FILE *) fdopen (sockt_wr, "w")) == NULL) {
  1769. X          perror ("server_init: fdopen #2");
  1770. X!         nntp_rd_fp = NULL;        /* from above */
  1771. X          return (-1);
  1772. X      }
  1773. X  
  1774. X***************
  1775. X*** 207,217 ****
  1776. X  }
  1777. X  
  1778. X  /*
  1779. X!  * get_tcp_socket -- get us a socket connected to the news server.
  1780. X   *
  1781. X   *    Parameters:    "machine" is the machine the server is running on.
  1782. X   *
  1783. X!  *    Returns:    Socket connected to the news server if
  1784. X   *            all is ok, else -1 on error.
  1785. X   *
  1786. X   *    Side effects:    Connects to server.
  1787. X--- 208,220 ----
  1788. X  }
  1789. X  
  1790. X  /*
  1791. X!  * get_tcp_socket -- get us a socket connected to the specified server.
  1792. X   *
  1793. X   *    Parameters:    "machine" is the machine the server is running on.
  1794. X+  *            "service" is the service to connect to on the server.
  1795. X+  *            "port" is the port to connect to on the server.
  1796. X   *
  1797. X!  *    Returns:    Socket connected to the server if
  1798. X   *            all is ok, else -1 on error.
  1799. X   *
  1800. X   *    Side effects:    Connects to server.
  1801. X***************
  1802. X*** 219,226 ****
  1803. X   *    Errors:        Printed via perror.
  1804. X   */
  1805. X  
  1806. X! int get_tcp_socket (machine)
  1807. X      char    *machine;    /* remote host */
  1808. X  {
  1809. X  #ifdef NNTP_ABLE
  1810. X      int    s = -1;
  1811. X--- 222,231 ----
  1812. X   *    Errors:        Printed via perror.
  1813. X   */
  1814. X  
  1815. X! int get_tcp_socket (machine, service, port)
  1816. X      char    *machine;    /* remote host */
  1817. X+     char    *service;    /* nttp/smtp etc. */
  1818. X+     unsigned short port;    /* tcp port number */
  1819. X  {
  1820. X  #ifdef NNTP_ABLE
  1821. X      int    s = -1;
  1822. X***************
  1823. X*** 243,249 ****
  1824. X      }
  1825. X      bzero((char *) &sin, sizeof (sin));    
  1826. X      sin.sin_family = AF_INET;
  1827. X!     sin.sin_port = htons (IPPORT_NNTP);
  1828. X      if (!isdigit(*machine) ||
  1829. X          (long)(sin.sin_addr.s_addr = inet_addr (machine)) == -1) {
  1830. X          if((hp = gethostbyname (machine)) == NULL) {
  1831. X--- 248,254 ----
  1832. X      }
  1833. X      bzero((char *) &sin, sizeof (sin));    
  1834. X      sin.sin_family = AF_INET;
  1835. X!     sin.sin_port = htons (port);
  1836. X      if (!isdigit(*machine) ||
  1837. X          (long)(sin.sin_addr.s_addr = inet_addr (machine)) == -1) {
  1838. X          if((hp = gethostbyname (machine)) == NULL) {
  1839. X***************
  1840. X*** 311,318 ****
  1841. X      static struct in_addr defaddr;
  1842. X      static char namebuf[256];
  1843. X  
  1844. X!     if ((sp = getservbyname ("nntp", "tcp")) ==  NULL) {
  1845. X!         fprintf (stderr, "nntp/tcp: Unknown service.\n");
  1846. X          return (-1);
  1847. X      }
  1848. X      /* If not a raw ip address, try nameserver */
  1849. X--- 316,323 ----
  1850. X      static struct in_addr defaddr;
  1851. X      static char namebuf[256];
  1852. X  
  1853. X!     if ((sp = getservbyname (service, "tcp")) ==  NULL) {
  1854. X!         fprintf (stderr, "%s/tcp: Unknown service.\n", service);
  1855. X          return (-1);
  1856. X      }
  1857. X      /* If not a raw ip address, try nameserver */
  1858. X***************
  1859. X*** 432,440 ****
  1860. X  
  1861. X  #ifdef DECNET
  1862. X  /*
  1863. X!  * get_dnet_socket -- get us a socket connected to the news server.
  1864. X   *
  1865. X   *    Parameters:    "machine" is the machine the server is running on.
  1866. X   *
  1867. X   *    Returns:    Socket connected to the news server if
  1868. X   *            all is ok, else -1 on error.
  1869. X--- 437,446 ----
  1870. X  
  1871. X  #ifdef DECNET
  1872. X  /*
  1873. X!  * get_dnet_socket -- get us a socket connected to the server.
  1874. X   *
  1875. X   *    Parameters:    "machine" is the machine the server is running on.
  1876. X+  *            "service" is the name of the service to connect to.
  1877. X   *
  1878. X   *    Returns:    Socket connected to the news server if
  1879. X   *            all is ok, else -1 on error.
  1880. X***************
  1881. X*** 444,451 ****
  1882. X   *    Errors:        Printed via nerror.
  1883. X   */
  1884. X  
  1885. X! int get_dnet_socket (machine)
  1886. X      char    *machine;
  1887. X  {
  1888. X  #ifdef NNTP_ABLE
  1889. X      int    s, area, node;
  1890. X--- 450,458 ----
  1891. X   *    Errors:        Printed via nerror.
  1892. X   */
  1893. X  
  1894. X! int get_dnet_socket (machine, service)
  1895. X      char    *machine;
  1896. X+     char    *service;
  1897. X  {
  1898. X  #ifdef NNTP_ABLE
  1899. X      int    s, area, node;
  1900. X***************
  1901. X*** 573,580 ****
  1902. X      char *string;
  1903. X  {
  1904. X  #ifdef NNTP_ABLE
  1905. X!     fprintf (ser_wr_fp, "%s\r\n", string);
  1906. X!     (void) fflush (ser_wr_fp);
  1907. X  #endif /* NNTP_ABLE */
  1908. X  }
  1909. X  
  1910. X--- 580,587 ----
  1911. X      char *string;
  1912. X  {
  1913. X  #ifdef NNTP_ABLE
  1914. X!     fprintf (nntp_wr_fp, "%s\r\n", string);
  1915. X!     (void) fflush (nntp_wr_fp);
  1916. X  #endif /* NNTP_ABLE */
  1917. X  }
  1918. X  
  1919. X***************
  1920. X*** 598,604 ****
  1921. X  #ifdef NNTP_ABLE
  1922. X      register char *cp;
  1923. X  
  1924. X!     while (fgets (string, size, ser_rd_fp) == NULL) {
  1925. X          if (errno != EINTR) {
  1926. X              return (-1);
  1927. X          }    
  1928. X--- 605,611 ----
  1929. X  #ifdef NNTP_ABLE
  1930. X      register char *cp;
  1931. X  
  1932. X!     while (fgets (string, size, nntp_rd_fp) == NULL) {
  1933. X          if (errno != EINTR) {
  1934. X              return (-1);
  1935. X          }    
  1936. X***************
  1937. X*** 634,647 ****
  1938. X  #ifdef NNTP_ABLE
  1939. X      char    ser_line[256];
  1940. X  
  1941. X!     if (ser_wr_fp == NULL || ser_rd_fp == NULL)
  1942. X          return;
  1943. X  
  1944. X      put_server ("QUIT");
  1945. X      (void) get_server (ser_line, sizeof (ser_line));
  1946. X  
  1947. X!     (void) fclose (ser_wr_fp);
  1948. X!     (void) fclose (ser_rd_fp);
  1949. X  #endif /* NNTP_ABLE */
  1950. X  }
  1951. X  
  1952. X--- 641,654 ----
  1953. X  #ifdef NNTP_ABLE
  1954. X      char    ser_line[256];
  1955. X  
  1956. X!     if (nntp_wr_fp == NULL || nntp_rd_fp == NULL)
  1957. X          return;
  1958. X  
  1959. X      put_server ("QUIT");
  1960. X      (void) get_server (ser_line, sizeof (ser_line));
  1961. X  
  1962. X!     (void) fclose (nntp_wr_fp);
  1963. X!     (void) fclose (nntp_rd_fp);
  1964. X  #endif /* NNTP_ABLE */
  1965. X  }
  1966. X  
  1967. Xdiff -rcs ../1.16/nntplib.h ./nntplib.h
  1968. X*** ../1.16/nntplib.h    Sun Nov 15 18:41:41 1992
  1969. X--- ./nntplib.h    Sun Nov 15 16:02:48 1992
  1970. X***************
  1971. X*** 3,9 ****
  1972. X   *  Module    : nntplib.h
  1973. X   *  Author    : I.Lea
  1974. X   *  Created   : 01-04-91
  1975. X!  *  Updated   : 03-06-92
  1976. X   *  Notes     : nntp.h 1.5.11/1.6 with extensions for tin & CD-ROM
  1977. X   *  Copyright : You may  freely  copy or  redistribute  this software,
  1978. X   *              so  long as there is no profit made from its use, sale
  1979. X--- 3,9 ----
  1980. X   *  Module    : nntplib.h
  1981. X   *  Author    : I.Lea
  1982. X   *  Created   : 01-04-91
  1983. X!  *  Updated   : 25-09-92
  1984. X   *  Notes     : nntp.h 1.5.11/1.6 with extensions for tin & CD-ROM
  1985. X   *  Copyright : You may  freely  copy or  redistribute  this software,
  1986. X   *              so  long as there is no profit made from its use, sale
  1987. X***************
  1988. X*** 15,26 ****
  1989. X  #    define    NNTP_SERVER_FILE    "/etc/nntpserver"
  1990. X  #endif
  1991. X  
  1992. X  /*
  1993. X   *  External routine declarations
  1994. X   */
  1995. X  
  1996. X  extern char *getserverbyfile();
  1997. X! extern int server_init();
  1998. X  extern int get_tcp_socket();
  1999. X  extern int handle_server_response();
  2000. X  extern void put_server();
  2001. X--- 15,36 ----
  2002. X  #    define    NNTP_SERVER_FILE    "/etc/nntpserver"
  2003. X  #endif
  2004. X  
  2005. X+ #define    NNTP_TCP_NAME    "nntp"
  2006. X+ #define    NNTP_TCP_PORT    ((unsigned short) 119)
  2007. X+ 
  2008. X+ #ifndef    SMTP_SERVER_FILE
  2009. X+ #    define    SMTP_SERVER_FILE    "/etc/smtpserver"
  2010. X+ #endif
  2011. X+ 
  2012. X+ #define    SMTP_TCP_NAME    "smtp"
  2013. X+ #define    SMTP_TCP_PORT    ((unsigned short) 25)
  2014. X+ 
  2015. X  /*
  2016. X   *  External routine declarations
  2017. X   */
  2018. X  
  2019. X  extern char *getserverbyfile();
  2020. X! /* extern int server_init(); */
  2021. X  extern int get_tcp_socket();
  2022. X  extern int handle_server_response();
  2023. X  extern void put_server();
  2024. X***************
  2025. X*** 31,37 ****
  2026. X   *  External file descriptors for the server connection
  2027. X   */
  2028. X  
  2029. X! extern FILE *ser_wr_fp;
  2030. X  
  2031. X  /*
  2032. X   * Response codes for NNTP server
  2033. X--- 41,47 ----
  2034. X   *  External file descriptors for the server connection
  2035. X   */
  2036. X  
  2037. X! extern FILE *nntp_wr_fp;
  2038. X  
  2039. X  /*
  2040. X   * Response codes for NNTP server
  2041. X***************
  2042. X*** 74,79 ****
  2043. X--- 84,90 ----
  2044. X  #define    OK_GROUP        211    /* Group selected */
  2045. X  #define    OK_GROUPS        215    /* Newsgroups follow */
  2046. X  
  2047. X+ #define OK_XMOTD        217    /* News motd follows */
  2048. X  #define OK_XINDEX        218    /* Tin index follows */
  2049. X  
  2050. X  #define    OK_ARTICLE        220    /* Article (head & body) follows */
  2051. X***************
  2052. X*** 103,108 ****
  2053. X--- 114,120 ----
  2054. X  #define    ERR_NOGROUP        411    /* No such newsgroup */
  2055. X  #define    ERR_NCING        412    /* Not currently in newsgroup */
  2056. X  
  2057. X+ #define ERR_XMOTD        417    /* No news motd file */
  2058. X  #define ERR_XINDEX        418    /* No tin index for this group */
  2059. X  
  2060. X  #define    ERR_NOCRNT        420    /* No current article selected */
  2061. X***************
  2062. X*** 132,135 ****
  2063. X   */
  2064. X  
  2065. X  #define    NNTP_STRLEN        512
  2066. X- 
  2067. X--- 144,146 ----
  2068. Xdiff -rcs ../1.16/open.c ./open.c
  2069. X*** ../1.16/open.c    Sun Nov 15 18:41:59 1992
  2070. X--- ./open.c    Sun Nov 15 16:02:48 1992
  2071. X***************
  2072. X*** 3,10 ****
  2073. X   *  Module    : open.c
  2074. X   *  Author    : I.Lea & R.Skrenta
  2075. X   *  Created   : 01-04-91
  2076. X!  *  Updated   : 27-08-92
  2077. X!  *  Notes     : reads news locally (ie. /usr/spool/news) or via NNTP
  2078. X   *  Copyright : (c) Copyright 1991-92 by Iain Lea & Rich Skrenta
  2079. X   *              You may  freely  copy or  redistribute  this software,
  2080. X   *              so  long as there is no profit made from its use, sale
  2081. X--- 3,11 ----
  2082. X   *  Module    : open.c
  2083. X   *  Author    : I.Lea & R.Skrenta
  2084. X   *  Created   : 01-04-91
  2085. X!  *  Updated   : 14-11-92
  2086. X!  *  Notes     : Routines to make reading news locally (ie. /usr/spool/news) 
  2087. X!  *              or via NNTP transparent
  2088. X   *  Copyright : (c) Copyright 1991-92 by Iain Lea & Rich Skrenta
  2089. X   *              You may  freely  copy or  redistribute  this software,
  2090. X   *              so  long as there is no profit made from its use, sale
  2091. X***************
  2092. X*** 14,54 ****
  2093. X  
  2094. X  #include    "tin.h"
  2095. X  
  2096. X- /*
  2097. X-  * Directory handling code - Hopefully one of these is right for you. 
  2098. X-  */
  2099. X- #ifdef BSD
  2100. X- #    ifdef sinix
  2101. X- #        include <dir.h>
  2102. X- #    else
  2103. X- #        ifdef __arm
  2104. X- #            include <dirent.h>
  2105. X- #            define    DIR_BUF    struct dirent
  2106. X- #        else
  2107. X- #            include <sys/dir.h>
  2108. X- #        endif
  2109. X- #    endif
  2110. X- #    ifndef DIR_BUF
  2111. X- #        define    DIR_BUF        struct direct
  2112. X- #    endif
  2113. X- #    define        D_LENGTH    d_namlen
  2114. X- #endif
  2115. X- #ifdef M_XENIX
  2116. X- #    include <sys/ndir.h>
  2117. X- #    define        DIR_BUF        struct direct
  2118. X- #    define        D_LENGTH    d_namlen
  2119. X- #endif
  2120. X- #ifdef AMIGA
  2121. X- #    include    <amiga.h>
  2122. X- #    define        DIR_BUF        struct dirent
  2123. X- #    define        D_LENGTH    d_reclen
  2124. X- #endif
  2125. X- #ifndef DIR_BUF
  2126. X- #    include    <dirent.h>
  2127. X- #    define        DIR_BUF        struct dirent
  2128. X- #    define        D_LENGTH    d_reclen
  2129. X- #endif
  2130. X- 
  2131. X  int nntp_codeno = 0;
  2132. X  
  2133. X  #ifdef NNTP_ABLE
  2134. X--- 15,20 ----
  2135. X***************
  2136. X*** 88,94 ****
  2137. X          
  2138. X          debug_nntp ("nntp_open", nntp_server);
  2139. X  
  2140. X!         ret = server_init (nntp_server);
  2141. X          if (update == FALSE && ret != -1) {
  2142. X              fputc ('\n', stdout);
  2143. X          }
  2144. X--- 54,60 ----
  2145. X          
  2146. X          debug_nntp ("nntp_open", nntp_server);
  2147. X  
  2148. X!         ret = server_init (nntp_server, NNTP_TCP_NAME, NNTP_TCP_PORT);
  2149. X          if (update == FALSE && ret != -1) {
  2150. X              fputc ('\n', stdout);
  2151. X          }
  2152. X***************
  2153. X*** 117,125 ****
  2154. X          }
  2155. X  
  2156. X          /*
  2157. X!          * Find out if NNTP supports my XINDEX & XUSER commands
  2158. X           */
  2159. X! #ifndef NO_NNTP_EXTS     
  2160. X          debug_nntp ("nntp_open", "xindex");
  2161. X          put_server ("xindex");    
  2162. X          if (get_respcode () != ERR_COMMAND) {
  2163. X--- 83,91 ----
  2164. X          }
  2165. X  
  2166. X          /*
  2167. X!          * Check if NNTP supports my XINDEX & XUSER commands
  2168. X           */
  2169. X! #ifndef DONT_HAVE_NNTP_EXTS     
  2170. X          debug_nntp ("nntp_open", "xindex");
  2171. X          put_server ("xindex");    
  2172. X          if (get_respcode () != ERR_COMMAND) {
  2173. X***************
  2174. X*** 130,138 ****
  2175. X          if (get_respcode () != ERR_COMMAND) {
  2176. X              xuser_supported = TRUE;
  2177. X          }
  2178. X! #endif    /* NO_NNTP_EXTS */        
  2179. X          
  2180. X          /*
  2181. X           * If INN NNTP & XINDEX not supported switch to mode reader
  2182. X           */
  2183. X          if (! xindex_supported) {
  2184. X--- 96,109 ----
  2185. X          if (get_respcode () != ERR_COMMAND) {
  2186. X              xuser_supported = TRUE;
  2187. X          }
  2188. X! #endif    /* DONT_HAVE_NNTP_EXTS */        
  2189. X          
  2190. X          /*
  2191. X+          * Check if NNTP server expects user authorization
  2192. X+          */
  2193. X+         authorization (nntp_server, userid);
  2194. X+          
  2195. X+         /*
  2196. X           * If INN NNTP & XINDEX not supported switch to mode reader
  2197. X           */
  2198. X          if (! xindex_supported) {
  2199. X***************
  2200. X*** 143,154 ****
  2201. X              }
  2202. X          }
  2203. X      }
  2204. X! #ifndef NO_NNTP_EXTS
  2205. X      /*
  2206. X       * Find out if NNTP supports SPOOLDIR command
  2207. X       */
  2208. X      get_spooldir ();
  2209. X! #endif    /* NO_NNTP_EXTS */        
  2210. X  
  2211. X  #endif    
  2212. X  }
  2213. X--- 114,125 ----
  2214. X              }
  2215. X          }
  2216. X      }
  2217. X! #ifndef DONT_HAVE_NNTP_EXTS
  2218. X      /*
  2219. X       * Find out if NNTP supports SPOOLDIR command
  2220. X       */
  2221. X      get_spooldir ();
  2222. X! #endif    /* DONT_HAVE_NNTP_EXTS */        
  2223. X  
  2224. X  #endif    
  2225. X  }
  2226. X***************
  2227. X*** 164,171 ****
  2228. X  #endif    
  2229. X  }
  2230. X  
  2231. X  
  2232. X! FILE *open_active_fp ()
  2233. X  {
  2234. X      int respcode;
  2235. X      
  2236. X--- 135,155 ----
  2237. X  #endif    
  2238. X  }
  2239. X  
  2240. X+ /*
  2241. X+  * Open the mail active file locally
  2242. X+  */
  2243. X+ 
  2244. X+ FILE *open_mail_active_fp (mode)
  2245. X+     char *mode;
  2246. X+ {
  2247. X+     return fopen (mail_active_file, mode);
  2248. X+ }
  2249. X+ 
  2250. X+ /*
  2251. X+  * Open the news active file locally or send the LIST command via NNTP
  2252. X+  */
  2253. X  
  2254. X! FILE *open_news_active_fp ()
  2255. X  {
  2256. X      int respcode;
  2257. X      
  2258. X***************
  2259. X*** 173,192 ****
  2260. X  #ifdef NNTP_ABLE
  2261. X          put_server ("list");
  2262. X          if ((respcode = get_respcode ()) != OK_GROUPS) {
  2263. X!             debug_nntp ("open_active_fp", "NOT_OK");
  2264. X              error_message ("%s", nntp_respcode (respcode));
  2265. X              return (FILE *) 0;
  2266. X          }
  2267. X!         debug_nntp ("open_active_fp", "OK");
  2268. X          return nntp_to_fp ();
  2269. X  #else
  2270. X          return (FILE *) 0;
  2271. X  #endif        
  2272. X      } else {
  2273. X!         return fopen (active_file, "r");
  2274. X      }
  2275. X  }
  2276. X  
  2277. X  
  2278. X  FILE *open_newgroups_fp (index)
  2279. X      int index;
  2280. X--- 157,181 ----
  2281. X  #ifdef NNTP_ABLE
  2282. X          put_server ("list");
  2283. X          if ((respcode = get_respcode ()) != OK_GROUPS) {
  2284. X!             debug_nntp ("open_news_active_fp", "NOT_OK");
  2285. X              error_message ("%s", nntp_respcode (respcode));
  2286. X              return (FILE *) 0;
  2287. X          }
  2288. X!         debug_nntp ("open_news_active_fp", "OK");
  2289. X          return nntp_to_fp ();
  2290. X  #else
  2291. X          return (FILE *) 0;
  2292. X  #endif        
  2293. X      } else {
  2294. X!         return fopen (news_active_file, "r");
  2295. X      }
  2296. X  }
  2297. X  
  2298. X+ /*
  2299. X+  * Open the ~/.tin/active file locally or send the NEWGROUPS command via NNTP
  2300. X+  *
  2301. X+  * NEWGROUPS 311299 235959
  2302. X+  */
  2303. X  
  2304. X  FILE *open_newgroups_fp (index)
  2305. X      int index;
  2306. X***************
  2307. X*** 211,221 ****
  2308. X          return (FILE *) 0;
  2309. X  #endif        
  2310. X      } else {
  2311. X!         sprintf (line, "%s/%s", rcdir, ACTIVE);
  2312. X          return fopen (line, "r");
  2313. X      }
  2314. X  }
  2315. X  
  2316. X  
  2317. X  FILE *open_subscription_fp ()
  2318. X  {
  2319. X--- 200,240 ----
  2320. X          return (FILE *) 0;
  2321. X  #endif        
  2322. X      } else {
  2323. X!         joinpath (line, rcdir, ACTIVE);
  2324. X          return fopen (line, "r");
  2325. X      }
  2326. X  }
  2327. X  
  2328. X+ /*
  2329. X+  * Open the news motd file locally or on the NNTP server
  2330. X+  *
  2331. X+  * XMOTD 311299 235959 [GMT]
  2332. X+  */
  2333. X+  
  2334. X+ FILE *open_motd_fp (motd_file_date)
  2335. X+     char *motd_file_date; 
  2336. X+ {
  2337. X+     char line[NNTP_STRLEN];
  2338. X+     
  2339. X+     if (read_news_via_nntp) {
  2340. X+ #if defined(NNTP_ABLE) && !defined(DONT_HAVE_NNTP_EXTS)
  2341. X+         sprintf (line, "xmotd %s", motd_file_date);
  2342. X+         debug_nntp ("open_motd_fp", line);
  2343. X+         put_server (line);
  2344. X+         if (get_respcode () != OK_XMOTD) {
  2345. X+             debug_nntp ("open_motd_fp", "NOT_OK");
  2346. X+             return (FILE *) 0;
  2347. X+         }
  2348. X+         debug_nntp ("open_motd_fp", "OK");
  2349. X+         return nntp_to_fp ();
  2350. X+ #else
  2351. X+         return (FILE *) 0;
  2352. X+ #endif        
  2353. X+     } else {
  2354. X+         return fopen (motd_file, "r");
  2355. X+     }
  2356. X+ }
  2357. X+ 
  2358. X  
  2359. X  FILE *open_subscription_fp ()
  2360. X  {
  2361. X***************
  2362. X*** 237,242 ****
  2363. X--- 256,271 ----
  2364. X  }
  2365. X  
  2366. X  /*
  2367. X+  *  Open mail groups description file.
  2368. X+  */
  2369. X+  
  2370. X+ FILE *open_mailgroups_fp ()
  2371. X+ {
  2372. X+     return fopen (mailgroups_file, "r");
  2373. X+ }
  2374. X+ 
  2375. X+ 
  2376. X+ /*
  2377. X   * If reading via NNTP the newsgroups file will be saved to ~/.tin/newsgroups
  2378. X   * so that any subsequent rereads on the active file will not have to waste
  2379. X   * net bandwidth and the local copy of the newsgroups file can be accessed.
  2380. X***************
  2381. X*** 266,281 ****
  2382. X      }
  2383. X  }
  2384. X  
  2385. X! 
  2386. X  FILE *open_index_fp (group_name)
  2387. X      char *group_name;
  2388. X  {
  2389. X-     char line[NNTP_STRLEN];
  2390. X      extern char index_file[PATH_LEN];
  2391. X  
  2392. X!     find_index_file (group_name);
  2393. X      
  2394. X!     if (read_news_via_nntp && xindex_supported) {
  2395. X          sprintf (line, "xindex %s", group_name);
  2396. X          debug_nntp ("open_index_fp", line);
  2397. X          put_server (line);
  2398. X--- 295,323 ----
  2399. X      }
  2400. X  }
  2401. X  
  2402. X! /*
  2403. X!  * Open a group index file
  2404. X!  */
  2405. X!  
  2406. X  FILE *open_index_fp (group_name)
  2407. X      char *group_name;
  2408. X  {
  2409. X      extern char index_file[PATH_LEN];
  2410. X+     char line[NNTP_STRLEN];
  2411. X+     int group_type;
  2412. X+     
  2413. X+     group_type = find_index_file (group_name);
  2414. X+     if (group_type == -1) {
  2415. X+         return (FILE *) 0;
  2416. X+     }
  2417. X  
  2418. X!     if (debug == 2) {
  2419. X!         error_message ("INDEX file=[%s]", index_file);
  2420. X!     }
  2421. X      
  2422. X!     if (read_news_via_nntp && xindex_supported && 
  2423. X!         group_type == GROUP_TYPE_NEWS) {
  2424. X! #ifdef NNTP_ABLE
  2425. X          sprintf (line, "xindex %s", group_name);
  2426. X          debug_nntp ("open_index_fp", line);
  2427. X          put_server (line);
  2428. X***************
  2429. X*** 285,313 ****
  2430. X          }
  2431. X          debug_nntp ("open_index_fp", "OK");
  2432. X          return nntp_to_fp ();
  2433. X      } else {
  2434. X          return fopen (index_file, "r");
  2435. X      }
  2436. X  }
  2437. X  
  2438. X  
  2439. X  FILE *open_art_fp (group_path, art)
  2440. X      char *group_path;
  2441. X      long art;
  2442. X  {
  2443. X      char buf[NNTP_STRLEN];
  2444. X!     int respcode;
  2445. X      struct stat sb;
  2446. X      extern long note_size;
  2447. X  
  2448. X!     if (read_news_via_nntp) {
  2449. X  #ifdef NNTP_ABLE
  2450. X          sprintf (buf, "article %ld", art);
  2451. X          debug_nntp ("open_art_fp", buf);
  2452. X          put_server (buf);
  2453. X          if ((respcode = get_respcode ()) != OK_ARTICLE) {
  2454. X!             error_message ("%s", nntp_respcode (respcode));
  2455. X!             debug_nntp ("open_art_fp", buf);
  2456. X              return (FILE *) 0;
  2457. X          }
  2458. X  
  2459. X--- 327,401 ----
  2460. X          }
  2461. X          debug_nntp ("open_index_fp", "OK");
  2462. X          return nntp_to_fp ();
  2463. X+ #else
  2464. X+         return (FILE *) 0;
  2465. X+ #endif
  2466. X      } else {
  2467. X          return fopen (index_file, "r");
  2468. X      }
  2469. X  }
  2470. X  
  2471. X+ /*
  2472. X+  * Stat a mail/news article to see if it still exists
  2473. X+  */
  2474. X+  
  2475. X+ int stat_article (art, group_path)
  2476. X+     long art;
  2477. X+     char *group_path;
  2478. X+ {
  2479. X+     char buf[NNTP_STRLEN];
  2480. X+     int i, respcode;
  2481. X+     int art_exists = TRUE;
  2482. X+     struct stat sb;
  2483. X+ 
  2484. X+     i = my_group[cur_groupnum];
  2485. X+     
  2486. X+     if (read_news_via_nntp && active[i].type == GROUP_TYPE_NEWS) {
  2487. X+ #ifdef NNTP_ABLE
  2488. X+         sprintf (buf, "stat %ld", art);
  2489. X+         debug_nntp ("stat_article", buf);
  2490. X+         put_server (buf);
  2491. X+         if ((respcode = get_respcode ()) != OK_NOTEXT) {
  2492. X+             art_exists = FALSE;
  2493. X+         }
  2494. X+ #endif
  2495. X+     } else {
  2496. X+         joinpath (buf, active[i].spooldir, group_path);
  2497. X+         sprintf (&buf[strlen (buf)], "/%ld", art);
  2498. X+ 
  2499. X+         if (stat (buf, &sb) == -1) {
  2500. X+             art_exists = FALSE;
  2501. X+         }
  2502. X+     }
  2503. X+ 
  2504. X+     return art_exists;
  2505. X+ }
  2506. X  
  2507. X+ /*
  2508. X+  * Open a mail/news article
  2509. X+  */
  2510. X+  
  2511. X  FILE *open_art_fp (group_path, art)
  2512. X      char *group_path;
  2513. X      long art;
  2514. X  {
  2515. X      char buf[NNTP_STRLEN];
  2516. X!     int i, respcode;
  2517. X      struct stat sb;
  2518. X      extern long note_size;
  2519. X  
  2520. X!     i = my_group[cur_groupnum];
  2521. X!     
  2522. X!     if (read_news_via_nntp && active[i].type == GROUP_TYPE_NEWS) {
  2523. X  #ifdef NNTP_ABLE
  2524. X          sprintf (buf, "article %ld", art);
  2525. X          debug_nntp ("open_art_fp", buf);
  2526. X          put_server (buf);
  2527. X          if ((respcode = get_respcode ()) != OK_ARTICLE) {
  2528. X!             if (debug == 2) {
  2529. X!                 error_message ("%s", nntp_respcode (respcode));
  2530. X!             }
  2531. X!             debug_nntp ("open_art_fp", "NOT OK");
  2532. X              return (FILE *) 0;
  2533. X          }
  2534. X  
  2535. X***************
  2536. X*** 318,327 ****
  2537. X          return (FILE *) 0;
  2538. X  #endif
  2539. X      } else {
  2540. X!         joinpath (buf, spooldir, group_path);
  2541. X!         sprintf (&buf[strlen(buf)], "/%ld", art);
  2542. X  
  2543. X!         if (stat (buf, &sb) < 0) {
  2544. X              note_size = 0;
  2545. X          } else {
  2546. X              note_size = sb.st_size;
  2547. X--- 406,419 ----
  2548. X          return (FILE *) 0;
  2549. X  #endif
  2550. X      } else {
  2551. X!         joinpath (buf, active[i].spooldir, group_path);
  2552. X!         sprintf (&buf[strlen (buf)], "/%ld", art);
  2553. X! 
  2554. X!         if (debug == 2) {
  2555. X!             error_message ("ART=[%s]", buf);
  2556. X!         }
  2557. X  
  2558. X!         if (stat (buf, &sb) == -1) {
  2559. X              note_size = 0;
  2560. X          } else {
  2561. X              note_size = sb.st_size;
  2562. X***************
  2563. X*** 331,343 ****
  2564. X  }
  2565. X  
  2566. X  
  2567. X! FILE *open_header_fp (group_path, art)
  2568. X!     char *group_path;
  2569. X      long art;
  2570. X  {
  2571. X      char buf[NNTP_STRLEN];
  2572. X!     
  2573. X!     if (read_news_via_nntp) {
  2574. X  #ifdef NNTP_ABLE    
  2575. X          sprintf(buf, "head %ld", art);
  2576. SHAR_EOF
  2577. true || echo 'restore of tin-1.17.patch failed'
  2578. fi
  2579. echo 'End of tin-1.17 part 5'
  2580. echo 'File tin-1.17.patch is continued in part 6'
  2581. echo 6 > _shar_seq_.tmp
  2582. exit 0
  2583.  
  2584. --
  2585. NAMES  Iain Lea    Iain.Lea%anl433.uucp@Germany.EU.net
  2586. SNAIL  Siemens AG, ANL A433SZ, Gruendlacher Str. 248, 8510 Fuerth, Germany.
  2587. PHONE  +49-911-3089-407 (work) +49-911-331963 (home) +49-911-3089-290 (FAX)  
  2588.