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

  1. Newsgroups: comp.sources.misc
  2. From: iain%anl433.uucp@germany.eu.net (Iain J. Lea)
  3. Subject:  v30i009:  tin - threaded full screen newsreader, Part09/14
  4. Message-ID: <1992May20.172734.29722@sparky.imd.sterling.com>
  5. X-Md4-Signature: 34b0a330415b8e1bbfc7670a2d6e7725
  6. Date: Wed, 20 May 1992 17:27:34 GMT
  7. Approved: kent@sparky.imd.sterling.com
  8.  
  9. Submitted-by: iain%anl433.uucp@germany.eu.net (Iain J. Lea)
  10. Posting-number: Volume 30, Issue 9
  11. Archive-name: tin/part09
  12. Environment: BSD, SCO, ISC, SUNOS, SYSVR3, SYSVR4, ULTRIX, XENIX
  13. Supersedes: tin: Volume 29, Issue 19-30
  14.  
  15. #! /bin/sh
  16. # This is a shell archive.  Remove anything before this line, then feed it
  17. # into a shell via "sh file" or similar.  To overwrite existing files,
  18. # type "sh file -c".
  19. # The tool that generated this appeared in the comp.sources.unix newsgroup;
  20. # send mail to comp-sources-unix@uunet.uu.net if you want that tool.
  21. # Contents:  extern.h newsrc.c tin.h
  22. # Wrapped by kent@sparky on Tue May 19 13:38:04 1992
  23. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  24. echo If this archive is complete, you will see the following message:
  25. echo '          "shar: End of archive 9 (of 14)."'
  26. if test -f 'extern.h' -a "${1}" != "-c" ; then 
  27.   echo shar: Will not clobber existing file \"'extern.h'\"
  28. else
  29.   echo shar: Extracting \"'extern.h'\" \(17525 characters\)
  30.   sed "s/^X//" >'extern.h' <<'END_OF_FILE'
  31. X/*
  32. X *  Project   : tin - a threaded Netnews reader
  33. X *  Module    : extern.h
  34. X *  Author    : I.Lea
  35. X *  Created   : 01-04-91
  36. X *  Updated   : 12-05-92
  37. X *  Notes     :
  38. X *  Copyright : (c) Copyright 1991-92 by Iain Lea
  39. X *              You may  freely  copy or  redistribute  this software,
  40. X *              so  long as there is no profit made from its use, sale
  41. X *              trade or  reproduction.  You may not change this copy-
  42. X *              right notice, and it must be included in any copy made
  43. X */
  44. X
  45. X/*
  46. X * Library prototypes
  47. X */
  48. X
  49. X#if defined(__GNUC__) && defined(DEBUG)
  50. X
  51. Xextern unsigned int alarm (unsigned int seconds);
  52. Xextern int close (int fildes);
  53. Xextern int fork (void);
  54. Xextern int getpid (void);
  55. Xextern char *getcwd (char *buf, int size);
  56. X#ifndef DGUX
  57. Xextern unsigned short getuid (void);
  58. Xextern unsigned short getegid (void);
  59. Xextern unsigned short geteuid (void);
  60. X#endif /* DGUX */
  61. Xextern int getopt (int argc, char **argv, char *optstring);
  62. Xextern int kill (int pid, int sig);
  63. Xextern int link (char *path1, char *path2);
  64. Xextern int open (char *path, int oflag);
  65. Xextern FILE *popen (char *command, char *type);
  66. Xextern int pclose (FILE *stream);
  67. Xextern int read (int fildes, char *buf, unsigned int nbyte);
  68. Xextern int setgid (int gid);
  69. Xextern int setuid (int uid);
  70. Xextern int tgetent (char *bp, char *name);
  71. Xextern int tputs (register char *cp, int count, int (*outc)());
  72. Xextern int unlink (char *path);
  73. X
  74. X#ifndef sony
  75. X#    ifndef DGUX
  76. Xextern unsigned short getgid (void);
  77. X#    endif /* DGUX */
  78. Xextern void setpgrp (void);
  79. Xextern unsigned int sleep (unsigned int seconds);
  80. X#endif
  81. X
  82. X#endif
  83. X
  84. X#if !defined(__STDC__)
  85. Xextern char *getenv ();
  86. X#endif
  87. X
  88. Xextern int optind;
  89. Xextern char *optarg;
  90. X
  91. X/*
  92. X * Local variables
  93. X */
  94. Xextern char *help_group[];
  95. Xextern char *help_page[];
  96. Xextern char *help_select[];
  97. Xextern char *help_spooldir[];
  98. Xextern char *help_thread[];
  99. Xextern char active_file[PATH_LEN];
  100. Xextern char add_addr[LEN];
  101. Xextern char default_art_search[LEN];
  102. Xextern char article[PATH_LEN];
  103. Xextern char default_author_search[LEN];
  104. Xextern char bug_addr[LEN];
  105. Xextern char cvers[LEN];
  106. Xextern char dead_article[PATH_LEN];
  107. Xextern char default_crosspost_group[LEN];
  108. Xextern char default_mail_address[LEN];
  109. Xextern char default_pipe_command[LEN];
  110. Xextern char default_post_subject[LEN];
  111. Xextern char default_regex_pattern[LEN];
  112. Xextern char default_save_file[PATH_LEN];
  113. Xextern char default_shell_command[LEN];
  114. Xextern char delgroups[LEN];
  115. Xextern char default_goto_group[LEN];
  116. Xextern char default_group_search[LEN];
  117. Xextern char default_maildir[PATH_LEN];
  118. Xextern char homedir[PATH_LEN];
  119. Xextern char indexdir[PATH_LEN];
  120. Xextern char killfile[PATH_LEN];
  121. Xextern char killfrom[LEN];
  122. Xextern char killsubj[LEN];
  123. Xextern char mail_news_user[LEN];
  124. Xextern char mailbox[PATH_LEN];
  125. Xextern char mailer[PATH_LEN];
  126. Xextern char msg[LEN];
  127. Xextern char my_distribution[LEN];
  128. Xextern char my_org[LEN];
  129. Xextern char newnewsrc[PATH_LEN];
  130. Xextern char newsrc[PATH_LEN];
  131. Xextern char nntp_server[LEN];
  132. Xextern char page_header[LEN];
  133. Xextern char postfile[PATH_LEN];
  134. Xextern char printer[LEN];
  135. Xextern char cmd_line_printer[LEN];
  136. Xextern char proc_ch_default;                /* set in change_rcfile () */
  137. Xextern char progname[PATH_LEN];
  138. Xextern char rcdir[PATH_LEN];
  139. Xextern char rcfile[PATH_LEN];
  140. Xextern char redirect_output[LEN];
  141. Xextern char reply_to[LEN];
  142. Xextern char default_savedir[PATH_LEN];
  143. Xextern char default_sigfile[PATH_LEN];
  144. Xextern char default_signature[PATH_LEN];
  145. Xextern char spooldir[PATH_LEN];
  146. Xextern char spooldir_alias[PATH_LEN];
  147. Xextern char default_subject_search[LEN];
  148. Xextern char subscriptions_file[PATH_LEN];
  149. Xextern char txt_help_bug_report[LEN];
  150. Xextern char unthreadfile[PATH_LEN];
  151. Xextern char userid[LEN];
  152. X
  153. Xextern char txt_1_resp[];
  154. Xextern char txt_active_file_is_empty[];
  155. Xextern char txt_added_groups[];
  156. Xextern char txt_append_to_file[];
  157. Xextern char txt_art[];
  158. Xextern char txt_art_cancelled[];
  159. Xextern char txt_art_cannot_cancel[];
  160. Xextern char txt_art_marked_as_unread[];
  161. Xextern char txt_art_not_saved[];
  162. Xextern char txt_art_pager_com[];
  163. Xextern char txt_art_posted[];
  164. Xextern char txt_art_rejected[];
  165. Xextern char txt_art_saved_to[];
  166. Xextern char txt_art_thread_regex_tag[];
  167. Xextern char txt_art_unavailable[];
  168. Xextern char txt_author_search_backwards[];
  169. Xextern char txt_author_search_forwards[];
  170. Xextern char txt_bad_active_file[];
  171. Xextern char txt_bad_command[];
  172. Xextern char txt_begin_of_art[];
  173. Xextern char txt_cancelling[];
  174. Xextern char txt_cannot_find_base_art[];
  175. Xextern char txt_cannot_get_nntp_server_name[];
  176. Xextern char txt_cannot_open[];
  177. Xextern char txt_cannot_open_active_file[];
  178. Xextern char txt_cannot_open_art[];
  179. Xextern char txt_cannot_post[];
  180. Xextern char txt_checking[];
  181. Xextern char txt_checking_active_file[];
  182. Xextern char txt_checking_for_news[];
  183. Xextern char txt_checksum_of_file[];
  184. Xextern char txt_command_failed[];
  185. Xextern char txt_command_failed_s[];
  186. Xextern char txt_connecting[];
  187. Xextern char txt_connection_to_server_broken[];
  188. Xextern char txt_continue[];
  189. Xextern char txt_corrupt_index[];
  190. Xextern char txt_corrupt_kill_file[];
  191. Xextern char txt_creating_newsrc[];
  192. Xextern char txt_crosspost_an_article[];
  193. Xextern char txt_crosspost_group[];
  194. Xextern char txt_del_group_in_newsrc[];
  195. Xextern char txt_delete_bogus_group[];
  196. Xextern char txt_deleting[];
  197. Xextern char txt_deleting_from_newsrc[];
  198. Xextern char txt_delete_processed_files[];
  199. Xextern char txt_end_of_arts[];
  200. Xextern char txt_end_of_groups[];
  201. Xextern char txt_end_of_thread[];
  202. Xextern char txt_extracting_archive[];
  203. Xextern char txt_extracting_shar[];
  204. Xextern char txt_failed_to_connect_to_server[];
  205. Xextern char txt_feed_pattern[];
  206. Xextern char txt_group[];
  207. Xextern char txt_group_deleted[];
  208. Xextern char txt_group_select_com[];
  209. Xextern char txt_spooldir_com[];
  210. Xextern char txt_group_selection[];
  211. Xextern char txt_group_undeleted[];
  212. Xextern char txt_help_4[];
  213. Xextern char txt_help_C[];
  214. Xextern char txt_help_I[];
  215. Xextern char txt_help_K[];
  216. Xextern char txt_help_M[];
  217. Xextern char txt_help_S[];
  218. Xextern char txt_help_T[];
  219. Xextern char txt_help_U[];
  220. Xextern char txt_help_W[];
  221. Xextern char txt_help_a[];
  222. Xextern char txt_help_autosave[];
  223. Xextern char txt_help_b[];
  224. Xextern char txt_help_bug[];
  225. Xextern char txt_help_c[];
  226. Xextern char txt_help_ck[];
  227. Xextern char txt_help_cr[];
  228. Xextern char txt_help_catchup_groups[];
  229. Xextern char txt_help_confirm_action[];
  230. Xextern char txt_help_ctrl_d[];
  231. Xextern char txt_help_ctrl_h[];
  232. Xextern char txt_help_ctrl_k[];
  233. Xextern char txt_help_ctrl_l[];
  234. Xextern char txt_help_d[];
  235. Xextern char txt_help_dash[];
  236. Xextern char txt_help_draw_arrow[];
  237. Xextern char txt_help_g[];
  238. Xextern char txt_help_g_4[];
  239. Xextern char txt_help_g_c[];
  240. Xextern char txt_help_g_cr[];
  241. Xextern char txt_help_cr[];
  242. Xextern char txt_help_g_ctrl_k[];
  243. Xextern char txt_help_g_ctrl_r[];
  244. Xextern char txt_help_g_l[];
  245. Xextern char txt_help_g_q[];
  246. Xextern char txt_help_g_search[];
  247. Xextern char txt_help_g_tab[];
  248. Xextern char txt_help_g_y[];
  249. Xextern char txt_help_g_z[];
  250. Xextern char txt_help_h[];
  251. Xextern char txt_help_i[];
  252. Xextern char txt_help_i_4[];
  253. Xextern char txt_help_i_cr[];
  254. Xextern char txt_help_i_n[];
  255. Xextern char txt_help_i_p[];
  256. Xextern char txt_help_i_search[];
  257. Xextern char txt_help_i_tab[];
  258. Xextern char txt_help_j[];
  259. Xextern char txt_help_kill_from[];
  260. Xextern char txt_help_kill_group[];
  261. Xextern char txt_help_kill_how[];
  262. Xextern char txt_help_kill_subject[];
  263. Xextern char txt_help_kill_text[];
  264. Xextern char txt_help_kill_text_type[];
  265. Xextern char txt_help_l[];
  266. Xextern char txt_help_m[];
  267. Xextern char txt_help_maildir[];
  268. Xextern char txt_help_mark_saved_read[];
  269. Xextern char txt_help_n[];
  270. Xextern char txt_help_o[];
  271. Xextern char txt_help_p_0[];
  272. Xextern char txt_help_p_4[];
  273. Xextern char txt_help_p_cr[];
  274. Xextern char txt_help_p_ctrl_r[];
  275. Xextern char txt_help_p_d[];
  276. Xextern char txt_help_p_f[];
  277. Xextern char txt_help_p_g[];
  278. Xextern char txt_help_p_k[];
  279. Xextern char txt_help_p_m[];
  280. Xextern char txt_help_p_n[];
  281. Xextern char txt_help_p_p[];
  282. Xextern char txt_help_p_r[];
  283. Xextern char txt_help_p_s[];
  284. Xextern char txt_help_p_search[];
  285. Xextern char txt_help_p_tab[];
  286. Xextern char txt_help_p_z[];
  287. Xextern char txt_help_page_scroll[];
  288. Xextern char txt_help_pipe[];
  289. Xextern char txt_help_pos_first_unread[];
  290. Xextern char txt_help_post_proc_type[];
  291. Xextern char txt_help_print_header[];
  292. Xextern char txt_help_printer[];
  293. Xextern char txt_help_q[];
  294. Xextern char txt_help_r[];
  295. Xextern char txt_help_s[];
  296. Xextern char txt_help_savedir[];
  297. Xextern char txt_help_sel_c[];
  298. X#ifndef NO_SHELL_ESCAPE
  299. Xextern char txt_help_shell[];
  300. X#endif
  301. Xextern char txt_help_show_author[];
  302. Xextern char txt_help_show_only_unread[];
  303. Xextern char txt_help_sort_type[];
  304. Xextern char txt_help_start_editor_offset[];
  305. Xextern char txt_help_t[];
  306. Xextern char txt_help_t_0[];
  307. Xextern char txt_help_t_4[];
  308. Xextern char txt_help_t_K[];
  309. Xextern char txt_help_t_cr[];
  310. Xextern char txt_help_t_tab[];
  311. Xextern char txt_help_thread[];
  312. Xextern char txt_help_thread_arts[];
  313. Xextern char txt_help_u[];
  314. Xextern char txt_help_v[];
  315. Xextern char txt_help_w[];
  316. Xextern char txt_help_x[];
  317. Xextern char txt_help_y[];
  318. Xextern char txt_hit_any_key[];
  319. Xextern char txt_hit_space_for_more[];
  320. Xextern char txt_in_art_you_write[];
  321. Xextern char txt_index_page_com[];
  322. Xextern char txt_indexing[];
  323. Xextern char txt_indexing_num[];
  324. Xextern char txt_inverse_off[];
  325. Xextern char txt_inverse_on[];
  326. Xextern char txt_kill_from[];
  327. Xextern char txt_kill_group[];
  328. Xextern char txt_kill_how[];
  329. Xextern char txt_kill_menu[];
  330. Xextern char txt_kill_subject[];
  331. Xextern char txt_kill_text[];
  332. Xextern char txt_kill_text_type[];
  333. Xextern char txt_killing_arts[];
  334. Xextern char txt_last_resp[];
  335. Xextern char txt_listing_archive[];
  336. Xextern char txt_mail_art_to[];
  337. Xextern char txt_mail_bug_report[];
  338. Xextern char txt_mail_bug_report_confirm[];
  339. Xextern char txt_mailed[];
  340. Xextern char txt_mailing_to[];
  341. Xextern char txt_mark_all_read[];
  342. Xextern char txt_mark_thread_read[];
  343. Xextern char txt_mark_group_read[];
  344. Xextern char txt_more[];
  345. Xextern char txt_more_percent[];
  346. Xextern char txt_moving[];
  347. Xextern char txt_newsgroup[];
  348. Xextern char txt_newsgroup_position[];
  349. Xextern char txt_next_resp[];
  350. Xextern char txt_nntp_to_fd_cannot_reopen[];
  351. Xextern char txt_nntp_to_fp_cannot_reopen[];
  352. Xextern char txt_no_arts[];
  353. Xextern char txt_no_arts_posted[];
  354. Xextern char txt_no_blank_line[];
  355. Xextern char txt_no_command[];
  356. Xextern char txt_no_filename[];
  357. Xextern char txt_no_group[];
  358. Xextern char txt_no_groups[];
  359. Xextern char txt_no_groups_to_delete[];
  360. Xextern char txt_no_groups_to_read[];
  361. Xextern char txt_no_groups_to_yank_in[];
  362. Xextern char txt_no_last_message[];
  363. Xextern char txt_no_mail_address[];
  364. Xextern char txt_no_match[];
  365. Xextern char txt_no_more_groups[];
  366. Xextern char txt_no_next_unread_art[];
  367. Xextern char txt_no_prev_group[];
  368. Xextern char txt_no_prev_unread_art[];
  369. Xextern char txt_no_resp[];
  370. Xextern char txt_no_resps_in_thread[];
  371. Xextern char txt_no_search_string[];
  372. Xextern char txt_no_subject[];
  373. Xextern char txt_not_active_newsfeed[];
  374. Xextern char txt_not_in_active_file[];
  375. Xextern char txt_opt_autosave[];
  376. Xextern char txt_opt_catchup_groups[];
  377. Xextern char txt_opt_confirm_action[];
  378. Xextern char txt_opt_draw_arrow[];
  379. Xextern char txt_opt_maildir[];
  380. Xextern char txt_opt_mark_saved_read[];
  381. Xextern char txt_opt_page_scroll[];
  382. Xextern char txt_opt_pos_first_unread[];
  383. Xextern char txt_opt_post_process[];
  384. Xextern char txt_opt_print_header[];
  385. Xextern char txt_opt_printer[];
  386. Xextern char txt_opt_process_type[];
  387. Xextern char txt_opt_savedir[];
  388. Xextern char txt_opt_show_author[];
  389. Xextern char txt_opt_show_only_unread[];
  390. Xextern char txt_opt_sort_type[];
  391. Xextern char txt_opt_start_editor_offset[];
  392. Xextern char txt_opt_thread_arts[];
  393. Xextern char txt_option_not_enabled[];
  394. Xextern char txt_options_menu[];
  395. Xextern char txt_out_of_memory[];
  396. Xextern char txt_pipe_to_command[];
  397. Xextern char txt_piping[];
  398. Xextern char txt_plural[];
  399. Xextern char txt_post_a_followup[];
  400. Xextern char txt_post_an_article[];
  401. Xextern char txt_post_history_menu[];
  402. Xextern char txt_post_newsgroup[];
  403. Xextern char txt_post_process_none[];
  404. Xextern char txt_post_process_sh[];
  405. Xextern char txt_post_process_type[];
  406. Xextern char txt_post_process_uud_ext_zoo[];
  407. Xextern char txt_post_process_uud_lst_zoo[];
  408. Xextern char txt_post_process_uudecode[];
  409. Xextern char txt_post_processing[];
  410. Xextern char txt_post_processing_failed[];
  411. Xextern char txt_post_processing_finished[];
  412. Xextern char txt_post_subject[];
  413. Xextern char txt_posting[];
  414. Xextern char txt_printed[];
  415. Xextern char txt_printing[];
  416. Xextern char txt_quit[];
  417. Xextern char txt_quit_edit_cancel[];
  418. Xextern char txt_quit_edit_post[];
  419. Xextern char txt_quit_edit_xpost[];
  420. Xextern char txt_quit_edit_save_killfile[];
  421. Xextern char txt_quit_edit_send[];
  422. Xextern char txt_read_art[];
  423. Xextern char txt_read_resp[];
  424. Xextern char txt_reading_active_file[];
  425. Xextern char txt_rejected_by_nntpserver[];
  426. Xextern char txt_rename_error[];
  427. Xextern char txt_reply_to_author[];
  428. Xextern char txt_reset_newsrc[];
  429. Xextern char txt_resizing_window[];
  430. Xextern char txt_resp_redirect[];
  431. Xextern char txt_resp_to_poster[];
  432. Xextern char txt_resp_x_of_n[];
  433. Xextern char txt_s_at_s[];
  434. Xextern char txt_save_filename[];
  435. Xextern char txt_save_pattern[];
  436. Xextern char txt_saved[];
  437. Xextern char txt_saved_pattern_to[];
  438. Xextern char txt_saved_to_mailbox[];
  439. Xextern char txt_saving[];
  440. Xextern char txt_screen_init_failed[];
  441. Xextern char txt_search_backwards[];
  442. Xextern char txt_search_forwards[];
  443. Xextern char txt_searching[];
  444. Xextern char txt_select_group[];
  445. Xextern char txt_select_rcfile_option[];
  446. Xextern char txt_select_spooldir[];
  447. Xextern char txt_server_name_in_file_env_var[];
  448. Xextern char txt_shell_escape[];
  449. Xextern char txt_show_from_addr[];
  450. Xextern char txt_show_from_both[];
  451. Xextern char txt_show_from_name[];
  452. Xextern char txt_show_from_none[];
  453. Xextern char txt_spooldir_selection[];
  454. Xextern char txt_sort_by_date_ascend[];
  455. Xextern char txt_sort_by_date_descend[];
  456. Xextern char txt_sort_by_from_ascend[];
  457. Xextern char txt_sort_by_from_descend[];
  458. Xextern char txt_sort_by_nothing[];
  459. Xextern char txt_sort_by_subj_ascend[];
  460. Xextern char txt_sort_by_subj_descend[];
  461. Xextern char txt_stuff_nntp_cannot_open[];
  462. Xextern char txt_subscribe_pattern[];
  463. Xextern char txt_subscribe_to_new_group[];
  464. Xextern char txt_subscribed_num_groups[];
  465. Xextern char txt_subscribed_to[];
  466. Xextern char txt_subscribing[];
  467. Xextern char txt_subscribing_to[];
  468. Xextern char txt_suspended_message[];
  469. Xextern char txt_tagged_art[];
  470. Xextern char txt_there_is_no_news[];
  471. Xextern char txt_threading_arts[];
  472. Xextern char txt_thread_com[];
  473. Xextern char txt_thread_marked_as_unread[];
  474. Xextern char txt_thread_not_saved[];
  475. Xextern char txt_thread_page[];
  476. Xextern char txt_thread_resp_page[];
  477. Xextern char txt_thread_saved_to[];
  478. Xextern char txt_thread_saved_to_many[];
  479. Xextern char txt_thread_x_of_n[];
  480. Xextern char txt_toggled_rot13[];
  481. Xextern char txt_type_h_for_help[];
  482. Xextern char txt_unkilling_arts[];
  483. Xextern char txt_unsubscribe_pattern[];
  484. Xextern char txt_unsubscribed_num_groups[];
  485. Xextern char txt_unsubscribed_to[];
  486. Xextern char txt_unsubscribing[];
  487. Xextern char txt_unsubscribing_from[];
  488. Xextern char txt_untagged_art[];
  489. Xextern char txt_unthreading_arts[];
  490. Xextern char txt_uudecoding[];
  491. Xextern char txt_writes[];
  492. Xextern char txt_writes_name[];
  493. Xextern char txt_x_resp[];
  494. Xextern char txt_yanking_all_groups[];
  495. Xextern char txt_yanking_sub_groups[];
  496. Xextern char txt_you_have_mail[];
  497. X
  498. Xextern int LINES, COLS;
  499. Xextern int MORE_POS;
  500. Xextern int NOTESLINES;
  501. Xextern int RIGHT_POS;
  502. Xextern int *my_group;
  503. Xextern int *unread;
  504. Xextern int can_post;
  505. Xextern int catchup;
  506. Xextern int catchup_read_groups;
  507. Xextern int cmd_line;
  508. Xextern int compiled_with_nntp;
  509. Xextern int confirm_action;
  510. Xextern int created_rcdir;
  511. Xextern int debug;
  512. Xextern int default_move_group;
  513. Xextern int default_printer;
  514. Xextern int default_show_author;
  515. X#ifdef SIGTSTP
  516. Xextern int do_sigtstp;
  517. X#endif
  518. Xextern int draw_arrow_mark;
  519. Xextern int full_page_scroll;
  520. Xextern int group_hash[TABLE_SIZE];
  521. Xextern int group_top;
  522. Xextern int groupname_len;
  523. Xextern int index_file_killed;
  524. Xextern int inn_nntp_server;
  525. Xextern int inverse_okay;
  526. Xextern int killed_articles;
  527. Xextern int kill_level;
  528. Xextern int kill_num;
  529. Xextern int local_index;
  530. Xextern int mail_news;
  531. Xextern int mark_saved_read;
  532. Xextern int max_active;
  533. Xextern int max_art;
  534. Xextern int max_from;
  535. Xextern int max_subj;
  536. Xextern int max_kill;
  537. Xextern int max_save;
  538. Xextern int nntp_codeno;
  539. Xextern int num_active;
  540. Xextern int num_of_hot_arts;
  541. Xextern int num_of_killed_arts;
  542. Xextern int num_of_tagged_arts;
  543. Xextern int pos_first_unread;
  544. Xextern int post_proc_type;
  545. Xextern int print_header;
  546. Xextern int process_id;
  547. Xextern int read_news_via_nntp;
  548. Xextern int real_gid;
  549. Xextern int real_uid;
  550. Xextern int real_umask;
  551. Xextern int save_archive_name;
  552. Xextern int save_news;
  553. Xextern int save_num;
  554. Xextern int show_author;
  555. Xextern int show_only_unread;
  556. Xextern int sort_art_type;
  557. Xextern int space_mode;
  558. Xextern int spooldir_is_active;
  559. Xextern int start_editor_offset;
  560. Xextern int start_line_offset;
  561. Xextern int thread_arts;
  562. Xextern int tin_gid;
  563. Xextern int tin_uid;
  564. Xextern int top;
  565. Xextern int top_base;
  566. Xextern int unlink_article;
  567. Xextern int update;
  568. Xextern int verbose;
  569. Xextern int update_fork;
  570. Xextern int check_any_unread;
  571. Xextern int start_any_unread;
  572. Xextern int notify_new_groups;
  573. Xextern int xindex_supported;
  574. Xextern int xuser_supported;
  575. Xextern int xspooldir_supported;
  576. X
  577. Xextern long *base;
  578. X
  579. Xextern struct passwd *myentry;
  580. Xextern struct article_t *arts;
  581. Xextern struct group_t *active;
  582. Xextern struct kill_t *killf;
  583. Xextern struct posted_t *posted;
  584. Xextern struct save_t *save;
  585. Xextern struct screen_t *screen;
  586. X
  587. X#ifdef POSIX_JOB_CONTROL
  588. Xextern struct sigaction art_act;
  589. Xextern struct sigaction group_act;
  590. Xextern struct sigaction kill_act;
  591. Xextern struct sigaction main_act;
  592. Xextern struct sigaction old_act;
  593. Xextern struct sigaction page_act;
  594. Xextern struct sigaction rcfile_act;
  595. Xextern struct sigaction select_act;
  596. Xextern struct sigaction thread_act;
  597. X#endif
  598. END_OF_FILE
  599.   if test 17525 -ne `wc -c <'extern.h'`; then
  600.     echo shar: \"'extern.h'\" unpacked with wrong size!
  601.   fi
  602.   # end of 'extern.h'
  603. fi
  604. if test -f 'newsrc.c' -a "${1}" != "-c" ; then 
  605.   echo shar: Will not clobber existing file \"'newsrc.c'\"
  606. else
  607.   echo shar: Extracting \"'newsrc.c'\" \(20406 characters\)
  608.   sed "s/^X//" >'newsrc.c' <<'END_OF_FILE'
  609. X/*
  610. X *  Project   : tin - a threaded Netnews reader
  611. X *  Module    : newsrc.c
  612. X *  Author    : I.Lea & R.Skrenta
  613. X *  Created   : 01-04-91
  614. X *  Updated   : 19-04-92
  615. X *  Notes     :
  616. X *  Copyright : (c) Copyright 1991-92 by Iain Lea & Rich Skrenta
  617. X *              You may  freely  copy or  redistribute  this software,
  618. X *              so  long as there is no profit made from its use, sale
  619. X *              trade or  reproduction.  You may not change this copy-
  620. X *              right notice, and it must be included in any copy made
  621. X */
  622. X
  623. X#include    "tin.h"
  624. X
  625. X
  626. X/*
  627. X * Automatically subscribe user to newsgroups specified in
  628. X * /usr/lib/news/subscribe (locally) or same file but from
  629. X * NNTP server (LIST AUTOSUBSCRIBE) and create .newsrc
  630. X */
  631. X
  632. Xint auto_subscribe_groups ()
  633. X{
  634. X    char buf[LEN];
  635. X    FILE *fp_newsrc;
  636. X    FILE *fp_subs;
  637. X    int len;
  638. X    int ret_code = FALSE;
  639. X    
  640. X    if ((fp_subs = open_subscription_fp ()) != NULL) {
  641. X        if ((fp_newsrc = fopen (newsrc, "w")) != NULL) {
  642. X            while (fgets (buf, sizeof (buf), fp_subs) != NULL) {
  643. X                len = strlen (buf);
  644. X                if (len > 1) {
  645. X                    buf[len-1] = '\0';
  646. X                    fprintf (fp_newsrc, "%s:\n", buf);
  647. X                }    
  648. X            }    
  649. X            fclose (fp_newsrc);
  650. X            ret_code = TRUE;
  651. X        }    
  652. X        fclose (fp_subs);
  653. X    }
  654. X
  655. X    return (ret_code);
  656. X}
  657. X
  658. X/*
  659. X * make a backup of users .newsrc in case of the bogie man
  660. X */
  661. X
  662. Xvoid backup_newsrc ()
  663. X{
  664. X    char buf[8192];
  665. X    FILE *fp_newsrc, *fp_backup;
  666. X    
  667. X    if ((fp_newsrc = fopen (newsrc, "r")) != NULL) {
  668. X        sprintf (buf, "%s/.oldnewsrc", homedir);
  669. X        unlink (buf);    /* because rn makes a link of .newsrc -> .oldnewsrc */
  670. X        if ((fp_backup = fopen (buf, "w")) != NULL) {
  671. X            while (fgets (buf, sizeof (buf), fp_newsrc) != NULL) {
  672. X                fputs (buf, fp_backup);
  673. X            }
  674. X            fclose (fp_backup);
  675. X        }
  676. X        fclose (fp_newsrc);
  677. X    }
  678. X}
  679. X
  680. X/*
  681. X *  Read $HOME/.newsrc into my_group[]. my_group[] ints point to
  682. X *  active[] entries.  Sub_only determines  whether to just read
  683. X *  subscribed groups or all of them.
  684. X */
  685. X
  686. Xvoid read_newsrc (sub_only)
  687. X    int sub_only;        /* TRUE=subscribed groups only, FALSE=all groups */
  688. X{
  689. X    char c, *p, buf[8192];
  690. X    char old_groups[LEN];
  691. X    FILE *fp = (FILE *) 0;
  692. X    FILE *fp_old = (FILE *) 0;
  693. X    int i;
  694. X    int remove_old_groups = FALSE;
  695. X
  696. X    group_top = 0;
  697. X
  698. Xreread_newsrc:
  699. X
  700. X    if ((fp = fopen (newsrc, "r")) == NULL) {    /* attempt to make a .newsrc */
  701. X        if (auto_subscribe_groups ()) {        /* attempt to auto create newsrc */
  702. X            goto reread_newsrc;
  703. X        }    
  704. X        for (i = 0; i < num_active; i++) {
  705. X            if (group_top >= max_active) {
  706. X                expand_active ();
  707. X            }
  708. X            my_group[group_top] = i;
  709. X            active[i].flag = 0;
  710. X            unread[group_top] = -1;
  711. X            group_top++;
  712. X        }
  713. X        write_newsrc ();
  714. X        return;
  715. X    }
  716. X
  717. X    sprintf (old_groups, "%s/.newsrc.%d", homedir, process_id);
  718. X
  719. X    while (fgets (buf, sizeof buf, fp) != NULL) {
  720. X        p = buf;
  721. X        while (*p && *p != '\n' && *p != ' ' && *p != ':' && *p != '!')
  722. X            p++;
  723. X        c = *p;
  724. X        *p++ = '\0';
  725. X
  726. X        if (c == '!' && sub_only)
  727. X            continue;        /* unsubscribed */
  728. X
  729. X        if ((i = add_group (buf, FALSE)) < 0) {
  730. X            if (! remove_old_groups) {
  731. X                if ((fp_old = fopen (old_groups, "w")) == NULL) {
  732. X                    perror_message (txt_cannot_open, old_groups);
  733. X                    continue;
  734. X                }
  735. X                remove_old_groups = TRUE;
  736. X            }
  737. X            fprintf (fp_old, "%s\n", buf);
  738. X            continue;
  739. X        }
  740. X
  741. X        if (c != '!')        /* if we're subscribed to it */
  742. X            active[my_group[i]].flag |= SUBSCRIBED;
  743. X
  744. X        unread[i] = parse_unread (p, my_group[i]);
  745. X    }
  746. X    fclose (fp);
  747. X
  748. X    /*
  749. X     *  rewrite newsrc to get rid of any non-existant groups 
  750. X     */
  751. X    if (remove_old_groups) {
  752. X        fclose (fp_old);
  753. X        rewrite_newsrc ();
  754. X    }
  755. X}
  756. X
  757. X/*
  758. X *  Write a new newsrc from my_group[] and active[] mygroup if
  759. X *  rewriting to get rid of groups that don't exist any longer. Used
  760. X *  to a create a new .newsrc if there isn't one already, or when
  761. X *  the newsrc is reset.
  762. X */
  763. X
  764. Xvoid write_newsrc ()
  765. X{
  766. X    FILE *fp;
  767. X    int i;
  768. X
  769. X    if ((fp = fopen (newsrc, "w")) == NULL) {
  770. X        return;
  771. X    }
  772. X
  773. X    wait_message (txt_creating_newsrc);
  774. X
  775. X    for (i=0 ; i < num_active ; i++) {
  776. X        fprintf (fp, "%s! \n", active[i].name);
  777. X    }
  778. X
  779. X    fclose (fp);
  780. X}
  781. X
  782. X/*
  783. X *  Rewrite newsrc to get rid of groups that don't exist any longer.
  784. X */
  785. X
  786. Xvoid rewrite_newsrc ()
  787. X{
  788. X    char buf[8192], old[LEN];
  789. X    char old_groups[LEN];
  790. X    FILE *fp, *fp_old, *fp_new;
  791. X    int found_old_group, len;    
  792. X
  793. X    sprintf (old_groups, "%s/.newsrc.%d", homedir, process_id);
  794. X
  795. X    if ((fp = fopen (newsrc, "r")) == NULL)
  796. X        goto removed_old_groups_done;
  797. X
  798. X    if ((fp_old = fopen (old_groups, "r")) == NULL)
  799. X        goto removed_old_groups_done;
  800. X
  801. X    if ((fp_new = fopen (newnewsrc, "w")) == NULL)
  802. X        goto removed_old_groups_done;
  803. X
  804. X    while (fgets (buf, sizeof buf, fp) != NULL) {            /* read group from newsrc */
  805. X        rewind (fp_old);
  806. X        found_old_group = FALSE;    
  807. X        while (fgets (old, sizeof old, fp_old) != NULL) {    /* read group from oldgroups */
  808. X            len = strlen (old)-1;
  809. X            if ((buf[len] == ':' || buf[len] == '!') &&
  810. X                strncmp (buf, old, len) == 0) {
  811. X                old[len] = '\0';
  812. X                sprintf (msg, txt_deleting_from_newsrc, old);
  813. X                wait_message (msg);
  814. X                if (cmd_line) {
  815. X                    wait_message ("\n");
  816. X                }    
  817. X                found_old_group = TRUE;    
  818. X            }
  819. X        }
  820. X        if (! found_old_group) {
  821. X            fprintf (fp_new, "%s", buf);
  822. X        }
  823. X    }
  824. X    
  825. X    fclose (fp);
  826. X    fclose (fp_old);
  827. X    fclose (fp_new);
  828. X
  829. X    rename_file (newnewsrc, newsrc);
  830. X
  831. Xremoved_old_groups_done:
  832. X    unlink (old_groups);
  833. X}
  834. X
  835. X/*
  836. X *  Load the sequencer rang lists and mark arts[] according to the
  837. X *  .newsrc info for a particular group.  i.e.  rec.arts.comics: 1-94,97
  838. X */
  839. X
  840. Xvoid read_newsrc_line (group)
  841. X    char *group;
  842. X{
  843. X    FILE *fp;
  844. X    char buf[8192];
  845. X    char *p;
  846. X
  847. X    if ((fp = fopen (newsrc, "r")) == NULL)
  848. X        return;
  849. X
  850. X    while (fgets (buf, sizeof buf, fp) != NULL) {
  851. X        p = buf;
  852. X        while (*p && *p != '\n' && *p != ' ' && *p != ':' && *p != '!')
  853. X            p++;
  854. X        *p++ = '\0';
  855. X        if (strcmp (buf, group) != 0)
  856. X            continue;
  857. X        parse_seq (p);
  858. X        break;
  859. X    }
  860. X
  861. X    fclose (fp);
  862. X}
  863. X
  864. X/*
  865. X *  For our current group, update the sequencer information in .newsrc
  866. X */
  867. X
  868. Xvoid update_newsrc (group, groupnum, mark_unread)
  869. X    char *group;
  870. X    int groupnum;            /* index into active[] for this group */
  871. X    int mark_unread;
  872. X{
  873. X    FILE *fp;
  874. X    FILE *newfp;
  875. X    char buf[8192];
  876. X    char *p;
  877. X    char c;
  878. X
  879. X    if ((newfp = fopen (newnewsrc, "w")) == NULL) {
  880. X        goto update_done;
  881. X    }
  882. X
  883. X    if ((fp = fopen (newsrc, "r")) != NULL) {
  884. X        while (fgets (buf, sizeof buf, fp) != NULL) {
  885. X            for (p = buf; *p; p++)
  886. X                if (*p == '\n') {
  887. X                    *p = '\0';
  888. X                    break;
  889. X                }
  890. X
  891. X            p = buf;
  892. X            while (*p && *p != ' ' && *p != ':' && *p != '!')
  893. X                    p++;
  894. X            c = *p;
  895. X            if (c != '\0')
  896. X                *p++ = '\0';
  897. X
  898. X            if (c != '!' && c != ' ')
  899. X                c = ':';
  900. X
  901. X            if (strcmp (buf, group) == 0) {
  902. X                if (mark_unread) {
  903. X                    fprintf (newfp, "%s%c\n", buf, c);
  904. X                } else {
  905. X                    fprintf (newfp, "%s%c ", buf, c);
  906. X                    print_seq (newfp, groupnum);
  907. X                    fprintf (newfp, "\n");
  908. X                }
  909. X            } else
  910. X                fprintf (newfp, "%s%c%s\n", buf, c, p);
  911. X        }
  912. X        fclose (fp);
  913. X    }
  914. X
  915. X    fclose (newfp);
  916. X    rename_file (newnewsrc, newsrc);
  917. X
  918. Xupdate_done:
  919. X    ;
  920. X}
  921. X
  922. X/*
  923. X *  Subscribe/unsubscribe to a group in .newsrc.  ch should either be
  924. X *  '!' to unsubscribe or ':' to subscribe.  num is the group's index
  925. X *  in active[].
  926. X */
  927. X
  928. Xvoid subscribe (group, ch, num, out_seq)
  929. X    char *group;
  930. X    char ch;
  931. X    int num;
  932. X    int out_seq;                /* output sequencer info? */
  933. X{
  934. X    FILE *fp;
  935. X    FILE *newfp;
  936. X    char buf[8192];
  937. X    char *p;
  938. X    char c;
  939. X    int gotit = FALSE;
  940. X
  941. X    if (ch == '!')
  942. X        active[num].flag &= ~SUBSCRIBED;
  943. X    else
  944. X        active[num].flag |= SUBSCRIBED;
  945. X
  946. X    if ((newfp = fopen (newnewsrc, "w")) == NULL)
  947. X        goto subscribe_done;
  948. X
  949. X    if ((fp = fopen (newsrc, "r")) != NULL) {
  950. X        while (fgets (buf, sizeof buf, fp) != NULL) {
  951. X            if (strncmp ("options ", buf, 8) == 0) {
  952. X                fprintf (newfp, buf);
  953. X            } else {
  954. X                for (p = buf; *p; p++) {
  955. X                    if (*p == '\n') {
  956. X                        *p = '\0';
  957. X                        break;
  958. X                    }
  959. X                }    
  960. X
  961. X                p = buf;
  962. X                while (*p && *p != ' ' && *p != ':' && *p != '!')
  963. X                        p++;
  964. X                c = *p;
  965. X                if (c != '\0')
  966. X                    *p++ = '\0';
  967. X
  968. X                if (c != '!')
  969. X                    c = ':';
  970. X
  971. X                if (strcmp (buf, group) == 0) {
  972. X                    fprintf (newfp, "%s%c%s\n", buf, ch, p);
  973. X                    gotit = TRUE;
  974. X                } else {
  975. X                    fprintf (newfp, "%s%c%s\n", buf, c, p);
  976. X                }
  977. X            }
  978. X        }
  979. X        fclose (fp);
  980. X    }
  981. X
  982. X    if (! gotit) {
  983. X        if (out_seq) {
  984. X            fprintf (newfp, "%s%c ", group, ch);
  985. X            print_seq (newfp, num);
  986. X            fprintf (newfp, "\n");
  987. X        } else
  988. X            fprintf (newfp, "%s%c\n", group, ch);
  989. X    }
  990. X
  991. X    fclose (newfp);
  992. X    rename_file (newnewsrc, newsrc);
  993. X
  994. Xsubscribe_done:
  995. X    ;
  996. X}
  997. X
  998. X
  999. Xvoid reset_newsrc ()
  1000. X{
  1001. X    FILE *fp;
  1002. X    FILE *newfp;
  1003. X    char buf[8192];
  1004. X    char *p;
  1005. X    char c;
  1006. X    int i;
  1007. X
  1008. X    if ((newfp = fopen (newnewsrc, "w")) == NULL)
  1009. X        goto update_done;
  1010. X
  1011. X    if ((fp = fopen (newsrc, "r")) != NULL) {
  1012. X        while (fgets (buf, sizeof (buf), fp) != NULL) {
  1013. X            for (p = buf; *p && *p != '\n'; p++)
  1014. X                continue;
  1015. X            *p = '\0';
  1016. X
  1017. X            p = buf;
  1018. X            while (*p && *p != ' ' && *p != ':' && *p != '!')
  1019. X                    p++;
  1020. X            c = *p;
  1021. X            if (c != '\0')
  1022. X                *p++ = '\0';
  1023. X
  1024. X            if (c != '!')
  1025. X                c = ':';
  1026. X
  1027. X            fprintf (newfp, "%s%c\n", buf, c);
  1028. X        }
  1029. X        fclose (fp);
  1030. X    }
  1031. X
  1032. X    fclose (newfp);
  1033. X    rename_file (newnewsrc, newsrc);
  1034. X
  1035. Xupdate_done:
  1036. X    for (i = 0; i < group_top; i++)
  1037. X        unread[i] = -1;
  1038. X}
  1039. X
  1040. X
  1041. Xvoid delete_group (group)
  1042. X    char *group;
  1043. X{
  1044. X    FILE *fp;
  1045. X    FILE *newfp;
  1046. X    char buf[8192];
  1047. X    char *p;
  1048. X    char c;
  1049. X    int gotit = FALSE;
  1050. X    FILE *del;
  1051. X
  1052. X    if ((newfp = fopen (newnewsrc, "w")) == NULL)
  1053. X        goto del_done;
  1054. X
  1055. X    if ((del = fopen (delgroups, "a+")) == NULL)
  1056. X        goto del_done;
  1057. X
  1058. X    if ((fp = fopen (newsrc, "r")) != NULL) {
  1059. X        while (fgets (buf, sizeof (buf), fp) != NULL) {
  1060. X            for (p = buf; *p && *p != '\n'; p++)
  1061. X                continue;
  1062. X            *p = '\0';
  1063. X
  1064. X            p = buf;
  1065. X            while (*p && *p != ' ' && *p != ':' && *p != '!')
  1066. X                    p++;
  1067. X            c = *p;
  1068. X            if (c != '\0')
  1069. X                *p++ = '\0';
  1070. X
  1071. X            if (c != '!')
  1072. X                c = ':';
  1073. X
  1074. X            if (strcmp (buf, group) == 0) {
  1075. X                fprintf (del, "%s%c%s\n", buf, c, p);
  1076. X                gotit = TRUE;
  1077. X            } else
  1078. X                fprintf (newfp, "%s%c%s\n", buf, c, p);
  1079. X        }
  1080. X        fclose (fp);
  1081. X    }
  1082. X
  1083. X    fclose (newfp);
  1084. X
  1085. X    if (! gotit)
  1086. X        fprintf (del, "%s! \n", group);
  1087. X
  1088. X    fclose (del);
  1089. X    rename_file (newnewsrc, newsrc);
  1090. X
  1091. Xdel_done:
  1092. X    ;
  1093. X}
  1094. X
  1095. X
  1096. Xint undel_group ()
  1097. X{
  1098. X    FILE *del;
  1099. X    FILE *newfp;
  1100. X    FILE *fp;
  1101. X    char buf[2][8192];
  1102. X    char *p;
  1103. X    int which = 0;
  1104. X    long h;
  1105. X    extern int cur_groupnum;
  1106. X    int i, j;
  1107. X    char c;
  1108. X
  1109. X    if ((del = fopen(delgroups, "r")) == NULL) {
  1110. X        return FALSE;
  1111. X    }
  1112. X
  1113. X    unlink(delgroups);
  1114. X    
  1115. X    if ((newfp = fopen(delgroups, "w")) == NULL) {
  1116. X        return FALSE;
  1117. X    }
  1118. X
  1119. X    buf[0][0] = '\0';
  1120. X    buf[1][0] = '\0';
  1121. X
  1122. X    while (fgets(buf[which], sizeof (buf[which]), del) != NULL) {
  1123. X        which = !which;
  1124. X        if (*buf[which])
  1125. X            fputs(buf[which], newfp);
  1126. X    }
  1127. X
  1128. X    fclose(del);
  1129. X    fclose(newfp);
  1130. X    which = !which;
  1131. X
  1132. X    if (!*buf[which]) {
  1133. X        return FALSE;
  1134. X    }
  1135. X
  1136. X    for (p = buf[which]; *p && *p != '\n'; p++)
  1137. X        continue;
  1138. X    *p = '\0';
  1139. X
  1140. X    p = buf[which];
  1141. X    while (*p && *p != ' ' && *p != ':' && *p != '!')
  1142. X        p++;
  1143. X    c = *p;
  1144. X    if (c != '\0')
  1145. X        *p++ = '\0';
  1146. X
  1147. X    if (c != '!')
  1148. X        c = ':';
  1149. X
  1150. X    h = hash_groupname (buf[which]);
  1151. X
  1152. X    for (i = group_hash[h]; i >= 0; i = active[i].next) {
  1153. X        if (strcmp(buf[which], active[i].name) == 0) {
  1154. X            for (j = 0; j < group_top; j++)
  1155. X                if (my_group[j] == i) {
  1156. X                    return j;
  1157. X                }
  1158. X
  1159. X            active[i].flag &= ~UNSUBSCRIBED;   /* mark that we got it */
  1160. X            if (c != '!')
  1161. X                active[i].flag |= SUBSCRIBED;
  1162. X
  1163. X            if (group_top >= max_active)
  1164. X                expand_active ();
  1165. X            group_top++;
  1166. X            for (j = group_top; j > cur_groupnum; j--) {
  1167. X                my_group[j] = my_group[j-1];
  1168. X                unread[j] = unread[j-1];
  1169. X            }
  1170. X            my_group[cur_groupnum] = i;
  1171. X            unread[cur_groupnum] = parse_unread(p, i);
  1172. X
  1173. X            if ((fp = fopen(newsrc, "r")) == NULL) {
  1174. X                return FALSE;
  1175. X            }
  1176. X            if ((newfp = fopen(newnewsrc, "w")) == NULL) {
  1177. X                fclose(fp);
  1178. X                return FALSE;
  1179. X            }
  1180. X            i = 0;
  1181. X            while (fgets(buf[!which], sizeof (buf[!which]), fp) != NULL) {
  1182. X                for (p = buf[!which]; *p && *p != '\n'; p++)
  1183. X                    continue;
  1184. X                *p = '\0';
  1185. X
  1186. X                p = buf[!which];
  1187. X                while (*p && *p!=' ' && *p != ':' && *p != '!')
  1188. X                    p++;
  1189. X                c = *p;
  1190. X                if (c != '\0')
  1191. X                    *p++ = '\0';
  1192. X
  1193. X                if (c != '!')
  1194. X                    c = ':';
  1195. X
  1196. X                while (i < cur_groupnum) {
  1197. X                    if (strcmp(buf[!which],
  1198. X                      active[my_group[i]].name) == 0) {
  1199. X                        fprintf(newfp, "%s%c%s\n",
  1200. X                            buf[!which], c, p);
  1201. X                        goto foo_cont;
  1202. X                    }
  1203. X                    i++;
  1204. X                }
  1205. X                fprintf(newfp, "%s%c%s\n", buf[which], c, p);
  1206. X                fprintf(newfp, "%s%c%s\n", buf[!which], c, p);
  1207. X                break;
  1208. Xfoo_cont:;
  1209. X            }
  1210. X
  1211. X            while (fgets (buf[!which], sizeof (buf[!which]), fp) != NULL)
  1212. X                fputs (buf[!which], newfp);
  1213. X
  1214. X            fclose (newfp);
  1215. X            fclose (fp);
  1216. X            rename_file (newnewsrc, newsrc);
  1217. X            return TRUE;
  1218. X        }
  1219. X    }
  1220. X    return FALSE;
  1221. X}
  1222. X
  1223. X
  1224. Xvoid mark_group_read (group, groupnum)
  1225. X    char *group;
  1226. X    int groupnum;            /* index into active[] for this group */
  1227. X{
  1228. X    FILE *fp;
  1229. X    FILE *newfp;
  1230. X    char buf[8192];
  1231. X    char *p;
  1232. X    char c;
  1233. X
  1234. X    if (active[groupnum].max < 2)
  1235. X        return;
  1236. X
  1237. X    if ((newfp = fopen (newnewsrc, "w")) == NULL)
  1238. X        goto mark_group_read_done;
  1239. X
  1240. X    if ((fp = fopen (newsrc, "r")) != NULL) {
  1241. X        while (fgets(buf, sizeof (buf), fp) != NULL) {
  1242. X            for (p = buf; *p; p++)
  1243. X                if (*p == '\n') {
  1244. X                    *p = '\0';
  1245. X                    break;
  1246. X                }
  1247. X
  1248. X            p = buf;
  1249. X            while (*p && *p != ' ' && *p != ':' && *p != '!')
  1250. X                    p++;
  1251. X            c = *p;
  1252. X            if (c != '\0')
  1253. X                *p++ = '\0';
  1254. X
  1255. X            if (c != '!')
  1256. X                c = ':';
  1257. X
  1258. X            if (strcmp (buf, group) == 0) {
  1259. X                fprintf (newfp, "%s%c 1-%ld\n", buf, c, active[groupnum].max);
  1260. X            } else
  1261. X                fprintf(newfp, "%s%c%s\n", buf, c, p);
  1262. X        }
  1263. X        fclose (fp);
  1264. X    }
  1265. X
  1266. X    fclose (newfp);
  1267. X    rename_file (newnewsrc, newsrc);
  1268. X
  1269. Xmark_group_read_done:
  1270. X    ;
  1271. X}
  1272. X
  1273. X
  1274. Xvoid parse_seq(s)
  1275. X    char *s;
  1276. X{
  1277. X    long low, high;
  1278. X    int i;
  1279. X
  1280. X    while (*s) {
  1281. X        while (*s && (*s < '0' || *s > '9'))
  1282. X            s++;
  1283. X
  1284. X        if (*s && *s >= '0' && *s <= '9') {
  1285. X            low = (long) atol (s);
  1286. X            while (*s && *s >= '0' && *s <= '9')
  1287. X                s++;
  1288. X            if (*s == '-') {
  1289. X                s++;
  1290. X                high = (long) atol (s);
  1291. X                while (*s && *s >= '0' && *s <= '9')
  1292. X                    s++;
  1293. X            }  else
  1294. X                high = low;
  1295. X
  1296. X            for (i = 0; i < top; i++)
  1297. X                if (arts[i].artnum >= low && arts[i].artnum <= high)
  1298. X                    arts[i].unread = ART_READ;
  1299. X        }
  1300. X    }
  1301. X}
  1302. X
  1303. X/*
  1304. X *  Read the first range from the .newsrc sequencer information.
  1305. X *  If the top of the first range is higher than what the active
  1306. X *  file claims is the bottom, use it as the new bottom instead.
  1307. X */
  1308. X
  1309. Xint parse_unread (s, groupnum)
  1310. X    char *s;
  1311. X    int groupnum;            /* index for group in active[] */
  1312. X{
  1313. X    long low, high;
  1314. X    long last_high;
  1315. X    int sum = 0;
  1316. X    int gotone = FALSE;
  1317. X    int n;
  1318. X
  1319. X    high = 0;
  1320. X
  1321. X    if (*s) {
  1322. X        while (*s && (*s < '0' || *s > '9')) {
  1323. X            s++;
  1324. X        }    
  1325. X
  1326. X        if (*s && *s >= '0' && *s <= '9') {
  1327. X            low = (long) atol (s);
  1328. X            while (*s && *s >= '0' && *s <= '9')
  1329. X                s++;
  1330. X            if (*s == '-') {
  1331. X                s++;
  1332. X                high = (long) atol (s);
  1333. X                while (*s && *s >= '0' && *s <= '9')
  1334. X                    s++;
  1335. X            }  else
  1336. X                high = low;
  1337. X            gotone = TRUE;
  1338. X        }
  1339. X    }
  1340. X
  1341. X    /* Note that in the active file min will be one greater than max
  1342. X     * when there are no articles in the spool directory. ie., it is
  1343. X      * always true that "max - min + 1 = article count (including
  1344. X      * expired articles)"
  1345. X      */
  1346. X
  1347. X    if (high < active[groupnum].min - 1)
  1348. X        high = active[groupnum].min - 1;
  1349. X
  1350. X    while (*s) {
  1351. X        last_high = high;
  1352. X
  1353. X        while (*s && (*s < '0' || *s > '9'))
  1354. X            s++;
  1355. X
  1356. X        if (*s && *s >= '0' && *s <= '9') {
  1357. X            low = (long) atol (s);
  1358. X            while (*s && *s >= '0' && *s <= '9')
  1359. X                s++;
  1360. X            if (*s == '-') {
  1361. X                s++;
  1362. X                high = (long) atol (s);
  1363. X                while (*s && *s >= '0' && *s <= '9')
  1364. X                    s++;
  1365. X            }  else
  1366. X                high = low;
  1367. X
  1368. X            if (low > last_high)    /* otherwise seq out of order */
  1369. X                sum += (low - last_high) - 1;
  1370. X        }
  1371. X    }
  1372. X
  1373. X    if (gotone) {
  1374. X        if (active[groupnum].max > high)
  1375. X            sum += active[groupnum].max - high;
  1376. X        return sum;
  1377. X    }
  1378. X
  1379. X    n = (int) (active[groupnum].max - active[groupnum].min) + 1;
  1380. X    
  1381. X    if (n < 0)
  1382. X        return -1;
  1383. X    else
  1384. X        return (n);
  1385. X}
  1386. X
  1387. X
  1388. Xint get_line_unread(group, groupnum)
  1389. X    char *group;
  1390. X    int groupnum;                /* index for group in active[] */
  1391. X{
  1392. X    FILE *fp;
  1393. X    char buf[8192];
  1394. X    char *p;
  1395. X    int ret = -1;
  1396. X
  1397. X    if ((fp = fopen(newsrc, "r")) == NULL)
  1398. X        return -1;
  1399. X
  1400. X    while (fgets(buf, sizeof (buf), fp) != NULL) {
  1401. X        p = buf;
  1402. X        while (*p && *p != '\n' && *p != ' ' && *p != ':' && *p != '!')
  1403. X            p++;
  1404. X        *p++ = '\0';
  1405. X        
  1406. X        if (strcmp (buf, group) != 0)
  1407. X            continue;
  1408. X            
  1409. X        ret = parse_unread (p, groupnum);
  1410. X        break;
  1411. X    }
  1412. X
  1413. X    fclose (fp);
  1414. X    return ret;
  1415. X}
  1416. X
  1417. X
  1418. Xvoid print_seq (fp, groupnum)
  1419. X    FILE *fp;
  1420. X    int groupnum;            /* index into active[] for this group */
  1421. X{
  1422. X    long int artnum, last_read, artmax;
  1423. X    int i;
  1424. X    int flag = FALSE;
  1425. X    
  1426. X    assert(top >= 0);
  1427. X
  1428. X      /*
  1429. X       *  sort into the same order as in the spool area for writing
  1430. X       *  read article numbers to ~/.newsrc
  1431. X       */
  1432. X     if (top > 0)
  1433. X         qsort ((char *) arts, top, sizeof (struct article_t), artnum_comp);
  1434. X  
  1435. X     /*
  1436. X      * Note that killed and expired articles do not appear in arts[].
  1437. X      * So, even if top is 0 there may be sequencer info to output.
  1438. X     */
  1439. X     if (top > 0 && arts[top-1].artnum > active[groupnum].max)
  1440. X         artmax = arts[top-1].artnum;
  1441. X     else
  1442. X         artmax = active[groupnum].max;
  1443. X     for (artnum=1, i=0; artnum <= artmax; ++artnum, ++i) {
  1444. X         assert(i<=top);
  1445. X         if (i==top || arts[i].unread == ART_READ || artnum != arts[i].artnum) {
  1446. X              if (flag)
  1447. X                  fprintf(fp, ",");
  1448. X              else
  1449. X                  flag = TRUE;
  1450. X             fprintf (fp, "%ld", artnum);
  1451. X             while (i < top && arts[i].unread == ART_READ)
  1452. X                 ++i;
  1453. X             last_read = (i<top ? arts[i].artnum - 1 : artmax);
  1454. X             if (last_read != artnum) {
  1455. X                 fprintf(fp, "-%ld", last_read);
  1456. X              }
  1457. X
  1458. X             assert(i <= top);
  1459. X             if (i == top)
  1460. X                 break;
  1461. X             artnum = arts[i].artnum;
  1462. X          }
  1463. X      }
  1464. X  
  1465. X      fflush (fp);
  1466. X     if (top == 0)
  1467. X         return;
  1468. X
  1469. X    /*
  1470. X     *  resort into required sort order
  1471. X     */
  1472. X    switch (sort_art_type) {
  1473. X        case SORT_BY_NOTHING:        /* already sorted above */
  1474. X            break;
  1475. X        case SORT_BY_SUBJ_DESCEND:
  1476. X        case SORT_BY_SUBJ_ASCEND:
  1477. X            qsort ((char *) arts, top, sizeof (struct article_t), subj_comp);
  1478. X            break;
  1479. X        case SORT_BY_FROM_DESCEND:
  1480. X        case SORT_BY_FROM_ASCEND:
  1481. X            qsort ((char *) arts, top, sizeof (struct article_t), from_comp);
  1482. X            break;
  1483. X        case SORT_BY_DATE_DESCEND:
  1484. X        case SORT_BY_DATE_ASCEND:
  1485. X            qsort ((char *) arts, top, sizeof (struct article_t), date_comp);
  1486. X            break;
  1487. X    }
  1488. X}
  1489. X
  1490. X/*
  1491. X *  rewrite .newsrc and position group at specifed position
  1492. X */
  1493. X
  1494. Xint pos_group_in_newsrc (group, pos)
  1495. X    char *group;
  1496. X    int pos;
  1497. X{
  1498. X    char sub[1024];
  1499. X    char unsub[1024];
  1500. X    char buf[1024];
  1501. X    char newsgroup[1024];
  1502. X    extern int cur_groupnum;
  1503. X    FILE *fp_in, *fp_out;
  1504. X    FILE *fp_sub, *fp_unsub;
  1505. X    int repositioned = FALSE;
  1506. X    int subscribed_pos = 1;
  1507. X    int group_len;
  1508. X    int option_line = FALSE;
  1509. X    int ret_code = FALSE;
  1510. X
  1511. X    if ((fp_in = fopen (newsrc, "r")) == NULL) {
  1512. X        goto rewrite_group_done;
  1513. X    }
  1514. X    if ((fp_out = fopen (newnewsrc, "w")) == NULL) {
  1515. X        goto rewrite_group_done;
  1516. X    }
  1517. X
  1518. X    sprintf (sub, "/tmp/.subrc.%d", process_id);
  1519. X    sprintf (unsub, "/tmp/.unsubrc.%d", process_id);
  1520. X
  1521. X    if ((fp_sub = fopen (sub, "w")) == NULL) {
  1522. X        goto rewrite_group_done;
  1523. X    }
  1524. X    if ((fp_unsub = fopen (unsub, "w")) == NULL) {
  1525. X        goto rewrite_group_done;
  1526. X    }
  1527. X
  1528. X    /*
  1529. X     *  split newsrc into subscribed and unsubscribed to files
  1530. X     */
  1531. X    group_len = strlen (group);
  1532. X
  1533. X    while (fgets (buf, sizeof (buf), fp_in) != NULL) {
  1534. X        if (strncmp (group, buf, group_len) == 0 && buf[group_len] == ':') {
  1535. X            my_strncpy (newsgroup, buf, sizeof (newsgroup));
  1536. X        } else if (strchr (buf, ':') != NULL) {
  1537. X            fprintf (fp_sub, "%s", buf);
  1538. X        } else if (strchr (buf, '!') != NULL) {
  1539. X            fprintf (fp_unsub, "%s", buf);
  1540. X        } else {    /* options line at beginning of .newsrc */
  1541. X            fprintf (fp_sub, "%s", buf);
  1542. X            option_line = TRUE;
  1543. X        }
  1544. X    }
  1545. X
  1546. X    fclose (fp_in);
  1547. X    fclose (fp_sub);
  1548. X    fclose (fp_unsub);
  1549. X
  1550. X    /*
  1551. X     *  write subscribed groups & position group to newnewsrc
  1552. X     */
  1553. X    if ((fp_sub = fopen (sub, "r")) == NULL) {
  1554. X        unlink (sub);
  1555. X        goto rewrite_group_done;
  1556. X    }
  1557. X    while (fgets (buf, sizeof (buf), fp_sub) != NULL) {
  1558. X        if (option_line) {
  1559. X            if (strchr (buf, ':') == NULL && strchr (buf, '!') == NULL) {
  1560. X                fprintf (fp_out, "%s", buf);
  1561. X                continue;
  1562. X            } else {
  1563. X                option_line = FALSE;
  1564. X            }
  1565. X        }
  1566. X
  1567. X        if (pos == subscribed_pos) {
  1568. X            fprintf (fp_out, "%s\n", newsgroup);
  1569. X            repositioned = TRUE;
  1570. X        }
  1571. X        
  1572. X        fprintf (fp_out, "%s", buf);
  1573. X
  1574. X        subscribed_pos++;
  1575. X    }
  1576. X    if (! repositioned) {
  1577. X        fprintf (fp_out, "%s\n", newsgroup);
  1578. X        repositioned = TRUE;
  1579. X    }
  1580. X    
  1581. X    fclose (fp_sub);
  1582. X     unlink (sub);
  1583. X
  1584. X    /*
  1585. X     *  write unsubscribed groups to newnewsrc
  1586. X     */
  1587. X    if ((fp_unsub = fopen (unsub, "r")) == NULL) {
  1588. X        unlink (unsub);
  1589. X        goto rewrite_group_done;
  1590. X    }
  1591. X    while (fgets (buf, sizeof (buf), fp_unsub) != NULL) {
  1592. X        fprintf (fp_out, "%s", buf);
  1593. X    }
  1594. X
  1595. X    fclose (fp_unsub);
  1596. X    unlink (unsub);
  1597. X    fclose (fp_out);
  1598. X
  1599. X    if (repositioned) {
  1600. X        cur_groupnum = pos;
  1601. X        rename_file (newnewsrc, newsrc);
  1602. X        ret_code = TRUE;
  1603. X    }
  1604. X
  1605. Xrewrite_group_done:
  1606. X    return ret_code;
  1607. X}
  1608. X
  1609. X/*
  1610. X *  mark all orther Xref: articles as read when one article read
  1611. X *  Xref: sitename newsgroup:artnum newsgroup:artnum [newsgroup:artnum ...]
  1612. X */
  1613. Xvoid mark_all_xref_read (xref_line)
  1614. X    char *xref_line; 
  1615. X{
  1616. X/*
  1617. X    char group[LEN];
  1618. X    long artnum;
  1619. X*/    
  1620. X    if (xref_line == (char *) 0) {
  1621. X        return;
  1622. X    }
  1623. X
  1624. X    /*
  1625. X     *  check sitename macthes nodename of current machine
  1626. X     */
  1627. X
  1628. X    /*
  1629. X     *  tokenize each pair and update that newsgroup if it
  1630. X     *  is in users my_group[].
  1631. X     */
  1632. X     
  1633. X}
  1634. END_OF_FILE
  1635.   if test 20406 -ne `wc -c <'newsrc.c'`; then
  1636.     echo shar: \"'newsrc.c'\" unpacked with wrong size!
  1637.   fi
  1638.   # end of 'newsrc.c'
  1639. fi
  1640. if test -f 'tin.h' -a "${1}" != "-c" ; then 
  1641.   echo shar: Will not clobber existing file \"'tin.h'\"
  1642. else
  1643.   echo shar: Extracting \"'tin.h'\" \(13510 characters\)
  1644.   sed "s/^X//" >'tin.h' <<'END_OF_FILE'
  1645. X/*
  1646. X *  Project   : tin - a threaded Netnews reader
  1647. X *  Module    : tin.h
  1648. X *  Author    : I.Lea & R.Skrenta
  1649. X *  Created   : 01-04-91
  1650. X *  Updated   : 10-05-92
  1651. X *  Notes     : #include files, #defines & struct's
  1652. X *  Copyright : (c) Copyright 1991-92 by Iain Lea & Rich Skrenta
  1653. X *              You may  freely  copy or  redistribute  this software,
  1654. X *              so  long as there is no profit made from its use, sale
  1655. X *              trade or  reproduction.  You may not change this copy-
  1656. X *              right notice, and it must be included in any copy made
  1657. X */
  1658. X
  1659. X#include    <stdio.h>
  1660. X
  1661. X#include    <signal.h>
  1662. X#include    <errno.h>
  1663. X#include    <sys/types.h>
  1664. X#include    <sys/stat.h>
  1665. X#include    <pwd.h>
  1666. X#include    <ctype.h>
  1667. X#include    <time.h>
  1668. X#ifndef apollo
  1669. X#    include    <unistd.h>
  1670. X#endif
  1671. X
  1672. X#ifdef BSD
  1673. X#    include    <strings.h>
  1674. X#    include    <fcntl.h>
  1675. X#else
  1676. X/*
  1677. X#    ifndef apollo
  1678. X#        include    <stdlib.h>
  1679. X#    endif
  1680. X#    include    <string.h>
  1681. X*/
  1682. X#endif
  1683. X
  1684. X#ifndef MINIX
  1685. X#    include <sys/ioctl.h>
  1686. X#endif
  1687. X
  1688. X#ifdef M_XENIX
  1689. X#    include    <prototypes.h>
  1690. X#endif
  1691. X
  1692. X#ifdef SVR4
  1693. X#    include <locale.h>
  1694. X#endif
  1695. X
  1696. X#if !defined(BSD) && !defined(sinix) && !defined(RS6000)
  1697. X#    include    <sys/utsname.h>
  1698. X#endif
  1699. X
  1700. X/*
  1701. X * Needed for resizing under an xterm
  1702. X */
  1703. X
  1704. X#if defined(SIGWINCH)
  1705. X#    if !defined(TIOCGWINSZ) && !defined(TIOCGSIZE)
  1706. X#        if !defined(sinix) && !defined(nsc)
  1707. X#            include <sys/stream.h>
  1708. X#            ifdef PTX
  1709. X#                include <termio.h>
  1710. X#            else
  1711. X#                ifndef apollo
  1712. X#                    include <sys/ptem.h>
  1713. X#                    include <sys/tty.h>
  1714. X#                endif
  1715. X#                if !defined(SCO_UNIX) && !defined(SVR4) && !defined(apollo)
  1716. X#                    include <sys/pty.h>
  1717. X#                endif
  1718. X#            endif
  1719. X#        endif
  1720. X#    endif
  1721. X#endif
  1722. X
  1723. X/*
  1724. X * Setup support for reading from CD-ROM
  1725. X */
  1726. X
  1727. X#ifdef CDROM_ONLY
  1728. X#    define CDROM_ABLE
  1729. X#endif
  1730. X#ifdef CDROM_ABLE
  1731. X#    define XSPOOLDIR
  1732. X#    define NNTP_ABLE
  1733. X#    undef NNTP_ONLY
  1734. X#    undef NNTP_INEWS
  1735. X#endif
  1736. X
  1737. X/*
  1738. X * Setup support for reading from NNTP
  1739. X */
  1740. X#if defined(NNTP_ABLE) || defined(NNTP_ONLY)
  1741. X#    ifndef NNTP_ABLE
  1742. X#        define    NNTP_ABLE
  1743. X#    endif
  1744. X#    ifndef NNTP_INEWS
  1745. X#        define    NNTP_INEWS
  1746. X#    endif
  1747. X#endif
  1748. X
  1749. X/*
  1750. X * Index file daemon version of tin. Will create/update index files from cron
  1751. X * on NNTP server machine so clients can retreive index file with NNTP XINDEX
  1752. X * command from server. Also can be used on machines that just want one copy
  1753. X * of all the index files in one place. In this case the normal tin must have
  1754. X * access to the index directory (-I dir option) or be setuid news.
  1755. X */
  1756. X#ifdef INDEX_DAEMON
  1757. X#    undef NNTP_ABLE
  1758. X#    undef NNTP_ONLY
  1759. X#    undef NNTP_INEWS
  1760. X#endif
  1761. X
  1762. X/*
  1763. X * Determine signal return type
  1764. X */
  1765. X#ifdef __GNUC__
  1766. Xtypedef void sigtype_t;
  1767. X#else    
  1768. X#    if defined(sony)
  1769. Xtypedef int sigtype_t;
  1770. X#    else
  1771. X#        if __STDC__ || defined(sinix) || defined(sun) || \
  1772. X           defined(ultrix) || defined(atthcx) || defined(PTX)
  1773. Xtypedef void sigtype_t;
  1774. X#        else
  1775. Xtypedef int sigtype_t;
  1776. X#        endif
  1777. X#    endif
  1778. X#endif
  1779. X
  1780. X/*
  1781. X * Specify News spool & control directories
  1782. X */
  1783. X#ifndef SPOOLDIR
  1784. X#    define        SPOOLDIR    "/usr/spool/news"
  1785. X#endif
  1786. X#ifndef LIBDIR
  1787. X#    define        LIBDIR        "/usr/lib/news"
  1788. X#endif
  1789. X#ifndef INEWSDIR
  1790. X#    define        INEWSDIR    LIBDIR
  1791. X#endif
  1792. X
  1793. X/*
  1794. X * Determine machine configuration for external programs & directories
  1795. X */
  1796. X
  1797. X#ifdef BSD
  1798. X#    ifdef _SEQUENT_
  1799. X#        define        memcmp(s1, s2, n)    bcmp(s2, s1, n)
  1800. X#    endif
  1801. X#    define        strchr(str, ch)    index(str, ch)
  1802. X#    define        DEFAULT_SHELL    "/bin/csh"
  1803. X#    define        DEFAULT_MAILER    "/bin/mail"
  1804. X#    define        DEFAULT_EDITOR    "/usr/ucb/vi"
  1805. X#    define        DEFAULT_PRINTER    "/usr/ucb/lpr"
  1806. X#    define        DEFAULT_SUM    "sum"
  1807. X#    ifdef DGUX
  1808. X#        define        DEFAULT_MAILBOX    "/usr/mail"
  1809. X#        define        POSIX_JOB_CONTROL
  1810. X#        define        USE_INVERSE_HACK
  1811. X#    else
  1812. X#        define        DEFAULT_MAILBOX    "/usr/spool/mail"
  1813. X#    endif
  1814. X#    ifndef USE_LONG_FILENAMES
  1815. X#        define USE_LONG_FILENAMES
  1816. X#    endif
  1817. X#else
  1818. X#    ifdef M_XENIX
  1819. X#        define        DEFAULT_EDITOR    "/bin/vi"
  1820. X#        define        DEFAULT_MAILER    "/usr/bin/mail"
  1821. X#        define        DEFAULT_MAILBOX    "/usr/spool/mail"
  1822. X#    endif
  1823. X#    if defined(NCR) || defined(atthcx) || defined(HPUX)
  1824. X#        define        DEFAULT_MAILER    "/usr/bin/mailx"
  1825. X#    endif
  1826. X#    ifdef PTX
  1827. X#        define        DEFAULT_MAILER    "/usr/bin/mailx"
  1828. X#        ifndef USE_LONG_FILENAMES
  1829. X#            define    USE_LONG_FILENAMES
  1830. X#        endif
  1831. X#    endif
  1832. X#    ifdef RS6000
  1833. X#        define        DEFAULT_MAILER    "/usr/bin/mail"
  1834. X#        define        DEFAULT_PRINTER    "/bin/lp"
  1835. X#    endif
  1836. X#    ifdef sinix
  1837. X#        define        DEFAULT_MAILER    "/bin/rmail"
  1838. X#        define        DEFAULT_PRINTER    "/bin/lpr"
  1839. X#        ifndef USE_LONG_FILENAMES
  1840. X#            define USE_LONG_FILENAMES
  1841. X#        endif
  1842. X#    endif
  1843. X#    ifdef SVR4
  1844. X#        ifndef USE_LONG_FILENAMES
  1845. X#            define    USE_LONG_FILENAMES
  1846. X#        endif
  1847. X#    endif
  1848. X#    ifdef UNIXPC
  1849. X#        define        DEFAULT_MAILER    "/bin/rmail"
  1850. X#    endif
  1851. X#    ifndef DEFAULT_SHELL
  1852. X#        define        DEFAULT_SHELL    "/bin/sh"
  1853. X#    endif
  1854. X#    ifndef DEFAULT_EDITOR
  1855. X#        define        DEFAULT_EDITOR    "/usr/bin/vi"
  1856. X#    endif
  1857. X#    ifndef DEFAULT_MAILBOX
  1858. X#        define        DEFAULT_MAILBOX    "/usr/mail"
  1859. X#    endif
  1860. X#    ifndef DEFAULT_MAILER
  1861. X#        define        DEFAULT_MAILER    "/bin/mail"
  1862. X#    endif
  1863. X#    ifndef DEFAULT_PRINTER
  1864. X#        define        DEFAULT_PRINTER    "/usr/bin/lp"
  1865. X#    endif
  1866. X#    define        DEFAULT_SUM        "sum -r"
  1867. X#endif
  1868. X
  1869. X#ifdef USE_LONG_FILENAMES
  1870. X#    define        LONG_PATH_PART    "part"
  1871. X#    define        LONG_PATH_PATCH    "patch"
  1872. X#else
  1873. X#    define        LONG_PATH_PART    ""
  1874. X#    define        LONG_PATH_PATCH    "p"
  1875. X#endif
  1876. X
  1877. X/*
  1878. X * Useful for logging user usage
  1879. X */
  1880. X#ifdef LOG_USER
  1881. X#    define        LOG_USER_FILE    "/tmp/.tin_log" 
  1882. X#endif
  1883. X
  1884. X/*
  1885. X * Should active file be rereaf for new news & if so how often
  1886. X */
  1887. X#ifndef NO_RESYNC_ACTIVE_FILE
  1888. X#    ifndef RESYNC_ACTIVE_SECS
  1889. X#        define    RESYNC_ACTIVE_SECS    300    /* reread active every n secs */
  1890. X#    endif
  1891. X#endif
  1892. X
  1893. X/*
  1894. X * Initial sizes of internal arrays for small (<4MB) & large memory machines
  1895. X */
  1896. X#ifdef SMALL_MEMORY_MACHINE
  1897. X#    define        DEFAULT_ACTIVE_NUM    1800    
  1898. X#    define        DEFAULT_ARTICLE_NUM    400    
  1899. X#    define        DEFAULT_KILL_NUM    10    
  1900. X#    define        DEFAULT_SAVE_NUM    10    
  1901. X#else
  1902. X#    define        DEFAULT_ACTIVE_NUM    1800    
  1903. X#    define        DEFAULT_ARTICLE_NUM    1200    
  1904. X#    define        DEFAULT_KILL_NUM    30    
  1905. X#    define        DEFAULT_SAVE_NUM    30    
  1906. X#endif
  1907. X
  1908. X#define        RCDIR            ".tin"
  1909. X#define        RCFILE            "tinrc"
  1910. X#define        INDEXDIR        ".index"
  1911. X#define        KILLFILE        "kill"
  1912. X#define        POSTFILE        "posted"
  1913. X#define        UNTHREADFILE    "unthread"
  1914. X#define        DEFAULT_MAILDIR    "Mail"
  1915. X
  1916. X#define BUG_REPORT_ADDRESS    "iain%anl433.uucp@Germany.EU.net"
  1917. X
  1918. X#ifdef TRUE
  1919. X#    undef TRUE
  1920. X#endif
  1921. X#define        TRUE        1
  1922. X
  1923. X#ifdef FALSE
  1924. X#    undef FALSE
  1925. X#endif
  1926. X#define        FALSE        0
  1927. X
  1928. X#define        LEN                1024
  1929. X#define        PATH_LEN            256
  1930. X#define        HEADER_LEN            1024
  1931. X#define        MODULO_COUNT_NUM        5
  1932. X#define        TABLE_SIZE            1409
  1933. X#define        MAX_PAGES            1000
  1934. X#define        ctrl(c)                ((c) & 0x1F)
  1935. X
  1936. X#ifndef DEFAULT_COMMENT
  1937. X#    define        DEFAULT_COMMENT    ": "    /* used when by follow-ups & replys */
  1938. X#endif
  1939. X#ifndef UNREAD_ART_MARK
  1940. X#    define        UNREAD_ART_MARK    '+'    /* used to show that an art is unread */
  1941. X#endif
  1942. X#ifndef RETURN_ART_MARK
  1943. X#    define        RETURN_ART_MARK    '-'    /* used to show that an art will return */
  1944. X#endif
  1945. X#ifndef HOT_ART_MARK
  1946. X#    define        HOT_ART_MARK    '*'    /* used to show that an art was auto selected */
  1947. X#endif
  1948. X#ifndef READ_ART_MARK
  1949. X#    define        READ_ART_MARK    ' '    /* used to show that an art was not read or seen  */
  1950. X#endif
  1951. X
  1952. X#ifdef USE_INVERSE_HACK
  1953. X#    define        SELECT_MISC_COLS    21
  1954. X#    define        BLANK_GROUP_COLS    2
  1955. X#    define        BLANK_PAGE_COLS        2
  1956. X#else
  1957. X#    define        SELECT_MISC_COLS    21
  1958. X#    define        BLANK_GROUP_COLS    0
  1959. X#    define        BLANK_PAGE_COLS        0
  1960. X#endif
  1961. X
  1962. X#define        SCREEN_READ_UNREAD        6        /* position for "  +" / "   " */
  1963. X#define        INDEX_TOP                2
  1964. X
  1965. X#ifdef NO_REGEX 
  1966. X#    define STR_MATCH(s1,s2)    (str_str (s1, s2, strlen (s2)) != 0)
  1967. X#else        
  1968. X#    define STR_MATCH(s1,pat)    (wildmat (s1, pat))
  1969. X#endif
  1970. X
  1971. X#define IGNORE_ART(i)    ((arts[i].thread == ART_EXPIRED) || \
  1972. X             (arts[i].killed && kill_level > 0))
  1973. X
  1974. X/*
  1975. X *  used by get_arrow_key()
  1976. X */
  1977. X
  1978. X#define        KEYMAP_UNKNOWN            0
  1979. X#define        KEYMAP_UP                1
  1980. X#define        KEYMAP_DOWN                2
  1981. X#define        KEYMAP_PAGE_UP            3
  1982. X#define        KEYMAP_PAGE_DOWN        4
  1983. X#define        KEYMAP_HOME                5
  1984. X#define        KEYMAP_END                6
  1985. X
  1986. X/*
  1987. X *  used by feed.c - feed_articles()
  1988. X */
  1989. X#define        SELECT_LEVEL                1
  1990. X#define        GROUP_LEVEL                2
  1991. X#define        PAGE_LEVEL                3
  1992. X
  1993. X#define        FEED_MAIL                1
  1994. X#define        FEED_PIPE                2
  1995. X#define        FEED_PRINT                3
  1996. X#define        FEED_SAVE                4
  1997. X#define        FEED_XPOST                5
  1998. X
  1999. X/*
  2000. X *  used in art.c & rcfile.c
  2001. X */
  2002. X#define        SORT_BY_NOTHING            0        /* sort types on arts[] array */
  2003. X#define        SORT_BY_SUBJ_DESCEND    1
  2004. X#define        SORT_BY_SUBJ_ASCEND        2
  2005. X#define        SORT_BY_FROM_DESCEND    3
  2006. X#define        SORT_BY_FROM_ASCEND        4
  2007. X#define        SORT_BY_DATE_DESCEND    5
  2008. X#define        SORT_BY_DATE_ASCEND        6
  2009. X
  2010. X#define        SHOW_FROM_NONE            0
  2011. X#define        SHOW_FROM_ADDR            1
  2012. X#define        SHOW_FROM_NAME            2
  2013. X#define        SHOW_FROM_BOTH            3
  2014. X
  2015. X/*
  2016. X *  used in help.c
  2017. X */
  2018. X
  2019. X#define        HELP_INFO                0
  2020. X#define        POST_INFO                1
  2021. X
  2022. X/*
  2023. X *  used in save.c
  2024. X */
  2025. X
  2026. X#define        CHECK_ANY_NEWS            0
  2027. X#define        START_ANY_NEWS            1
  2028. X#define        MAIL_ANY_NEWS            2
  2029. X#define        SAVE_ANY_NEWS            3
  2030. X
  2031. X/*
  2032. X *  used in help.c
  2033. X */
  2034. X
  2035. X#define        HEADER_TO                0
  2036. X#define        HEADER_SUBJECT            1
  2037. X
  2038. X/*
  2039. X *  used in page.c & post.c
  2040. X */
  2041. X
  2042. X#define        POSTED_NONE                0
  2043. X#define        POSTED_REDRAW            1
  2044. X#define        POSTED_OK                2
  2045. X
  2046. X/*
  2047. X *  Assertion verifier
  2048. X */
  2049. X
  2050. X#if __STDC__ && !defined(apollo)
  2051. X#    define    assert(p)    if(! (p)) asfail(__FILE__, __LINE__, #p); else
  2052. X#else
  2053. X#    define    assert(p)    if(! (p)) asfail(__FILE__, __LINE__, "p"); else
  2054. X#endif
  2055. X
  2056. X#define        ESC        27
  2057. X#if defined(BSD) || defined(MINIX) || defined(apollo)
  2058. X#    define        CR        '\r'
  2059. X#else
  2060. X#    define        CR        10
  2061. X#endif
  2062. X
  2063. X/*
  2064. X * return codes for change_rcfile ()
  2065. X */
  2066. X
  2067. X#define        NO_KILLING        0
  2068. X#define        KILLING            1
  2069. X
  2070. X/*
  2071. X *  art.thread
  2072. X */
  2073. X
  2074. X#define        ART_NORMAL        -1
  2075. X#define        ART_EXPIRED        -2
  2076. X
  2077. X/*
  2078. X *  art.unread
  2079. X */
  2080. X
  2081. X#define        ART_READ        0
  2082. X#define        ART_UNREAD        1
  2083. X#define        ART_WILL_RETURN    2
  2084. X
  2085. X/*
  2086. X * used by group_t & my_group[]
  2087. X */
  2088. X#define        UNSUBSCRIBED    0x01    /* haven't put in my_group[] yet */
  2089. X#define        SUBSCRIBED        0x02    /* subscribed to */
  2090. X
  2091. X/*
  2092. X * kill_type used in struct kill_t
  2093. X */
  2094. X#define KILL_SUBJ    1
  2095. X#define KILL_FROM    2
  2096. X#define KILL_BOTH    3
  2097. X
  2098. X/*
  2099. X * usedin group.c & page.c
  2100. X */
  2101. X#define    ART_UNAVAILABLE    -1
  2102. X
  2103. X
  2104. X/*
  2105. X * used in feed.c & save.c
  2106. X */
  2107. X#define POST_PROC_NONE            0
  2108. X#define POST_PROC_SHAR            1
  2109. X#define POST_PROC_UUDECODE        2
  2110. X#define POST_PROC_UUD_LST_ZOO    3
  2111. X#define POST_PROC_UUD_EXT_ZOO    4
  2112. X
  2113. X/*
  2114. X *  struct article_t - article header
  2115. X *
  2116. X *  article.artnum:
  2117. X *    article number in spool directory for group
  2118. X *
  2119. X *  article.thread:
  2120. X *    -1 initial default
  2121. X *    -2 means article has expired (wasn't found in file search
  2122. X *    of spool directory for the group)
  2123. X *    >=0 points to another arts[] (struct article_t)
  2124. X *
  2125. X *  article.inthread:
  2126. X *    FALSE for the first article in a thread, TRUE for all
  2127. X *    following articles in thread
  2128. X *
  2129. X *  article.unread:
  2130. X *    boolean, has this article been read or not
  2131. X *
  2132. X *  article.killed:
  2133. X *    boolean, has this article been killed
  2134. X *
  2135. X *  article.hot:
  2136. X *    boolean, has this article been auto-selected
  2137. X *
  2138. X *  article.tagged:
  2139. X *    count, has this article been tagged for saving (>0) or not (=0)
  2140. X *
  2141. X *  article.date
  2142. X *    date: line used for sorting articles by date order
  2143. X *
  2144. X *  article.archive:
  2145. X *    archive name used in *source* groups
  2146. X *
  2147. X *  article.part:
  2148. X *    part no. of archive
  2149. X *
  2150. X *  article.patch:
  2151. X *    patch no. of archive
  2152. X *
  2153. X */
  2154. X
  2155. Xstruct article_t {
  2156. X    long artnum;
  2157. X    char *subject;        /* Subject: line from mail header */
  2158. X    char *from;        /* From: line from mail header (address) */
  2159. X    char *name;        /* From: line from mail header (full name) */
  2160. X    int thread;
  2161. X    int inthread;
  2162. X    unsigned int unread:2;    /* 0 = read, 1 = unread, 2 = will return */
  2163. X    unsigned int killed:1;    /* 0 = not killed, 1 = killed */
  2164. X    unsigned int hot:1;    /* 0 = not hot, 1 = hot */
  2165. X    int tagged;        /* 0 = not tagged, >0 = tagged */
  2166. X    char date[16];        /* Date: line from mail header */
  2167. X    char *archive;        /* Archive-name: line from mail header */
  2168. X    char *part;        /* part no. of archive */
  2169. X    char *patch;        /* patch no. of archive */
  2170. X};
  2171. X
  2172. X/*
  2173. X *  struct attribute_t - configurable attributes on a per group basis
  2174. X */
  2175. X
  2176. Xstruct attribute_t {
  2177. X    char *server;            /* read group locally/via nntp server */
  2178. X    char *maildir;            /* mail dir if other than ~/Mail */
  2179. X    char *savedir;            /* save dir if other than ~/News */
  2180. X    char *sigfile;            /* sig file if other than ~/.Sig */
  2181. X    unsigned int read:1;        /* marked TRUE if group was entered during session */
  2182. X    unsigned int showall:1;        /* 0 = only unread, 1 = all */
  2183. X    unsigned int thread:1;        /* 0 = unthread, 1 = thread */
  2184. X    unsigned int sortby:4;        /* 0 = none, 1 = , 2 = , 3 = , 4 = , */
  2185. X    unsigned int author:4;        /* 0 = none, 1 = name, 2 = addr, 3 = both */
  2186. X    unsigned int autosave:1;    /* 0 = none, 1 = save */
  2187. X    unsigned int process:4;        /* 0 = none, 1 = shar, 2 = uudecode, 
  2188. X                         3 = uud & list zoo, 4 = uud & ext zoo*/
  2189. X};
  2190. X
  2191. X/*
  2192. X *  struct group_t - newsgroup info from active file
  2193. X */
  2194. X
  2195. Xstruct group_t {
  2196. X    char *name;
  2197. X    long max;
  2198. X    long min;
  2199. X    char moderated;
  2200. X    int next;            /* next active entry in hash chain */
  2201. X    int flag;
  2202. X    struct attribute_t attribute;    /* per group attributes */ 
  2203. X};
  2204. X
  2205. X/*
  2206. X *  used in hashstr.c
  2207. X */
  2208. Xstruct hashnode {
  2209. X    char *s;                        /* the string we're saving */
  2210. X    struct hashnode *next;            /* chain for spillover */
  2211. X};
  2212. X
  2213. X/*
  2214. X *  used in kill.c
  2215. X */
  2216. Xstruct kill_t {
  2217. X    unsigned int kill_type:8;
  2218. X    unsigned int kill_how:8;    /* kill/auto select */
  2219. X    long kill_group;
  2220. X    char *kill_subj;
  2221. X    char *kill_from;
  2222. X};
  2223. X
  2224. Xstruct save_t {
  2225. X    char *subject;
  2226. X    char *dir;
  2227. X    char *file;
  2228. X    char *archive;
  2229. X    char *part;
  2230. X    char *patch;
  2231. X    int index;    
  2232. X    int saved;    
  2233. X    int is_mailbox;    
  2234. X};
  2235. X
  2236. Xstruct screen_t {
  2237. X    char *col;
  2238. X};
  2239. X
  2240. Xstruct posted_t {
  2241. X    char date[10];
  2242. X    char group[80];
  2243. X    char action;
  2244. X    char subj[120];
  2245. X};
  2246. X
  2247. Xstruct art_stat_t {
  2248. X    int total;    /* total article count */
  2249. X    int unread;    /* number of unread articles (does not include seen) arts */
  2250. X    int seen;    /* number of seen articles (ART_WILL_RETURN) */
  2251. X    int hot_total;    /* total hot count */
  2252. X    int hot_unread; /* hot and unread */
  2253. X    int hot_seen;    /* hot and seen */
  2254. X    char art_mark;    /* mark to use for this thread - not used for groups */
  2255. X};
  2256. X
  2257. Xstruct spooldir_t {
  2258. X    int state;
  2259. X    char *name;
  2260. X    char *comment;
  2261. X};
  2262. X
  2263. X/*
  2264. X *  function prototypes    & extern definitions    
  2265. X */ 
  2266. X
  2267. X#include    "patchlev.h"
  2268. X#include    "extern.h"
  2269. X#include    "proto.h"
  2270. END_OF_FILE
  2271.   if test 13510 -ne `wc -c <'tin.h'`; then
  2272.     echo shar: \"'tin.h'\" unpacked with wrong size!
  2273.   fi
  2274.   # end of 'tin.h'
  2275. fi
  2276. echo shar: End of archive 9 \(of 14\).
  2277. cp /dev/null ark9isdone
  2278. MISSING=""
  2279. for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 ; do
  2280.     if test ! -f ark${I}isdone ; then
  2281.     MISSING="${MISSING} ${I}"
  2282.     fi
  2283. done
  2284. if test "${MISSING}" = "" ; then
  2285.     echo You have unpacked all 14 archives.
  2286.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  2287. else
  2288.     echo You still must unpack the following archives:
  2289.     echo "        " ${MISSING}
  2290. fi
  2291. exit 0
  2292. exit 0 # Just in case...
  2293.