home *** CD-ROM | disk | FTP | other *** search
Text File | 1992-04-03 | 50.5 KB | 2,091 lines |
- Newsgroups: comp.sources.misc
- From: iain%anl433.uucp@germany.eu.net (Iain Lea)
- Subject: v29i051: tin - threaded full screen newsreader v1.1 PL2, Patch02b/4
- Message-ID: <1992Apr3.225928.7772@sparky.imd.sterling.com>
- X-Md4-Signature: 7f47f4fe398e7a61998bd6df64ca5adb
- Date: Fri, 3 Apr 1992 22:59:28 GMT
- Approved: kent@sparky.imd.sterling.com
-
- Submitted-by: iain%anl433.uucp@germany.eu.net (Iain Lea)
- Posting-number: Volume 29, Issue 51
- Archive-name: tin/patch02b
- Environment: BSD, SCO, ISC, SUNOS, SYSVR3, SYSVR4, ULTRIX, XENIX
- Patch-To: tin: Volume 29, Issue 19-30
-
- #!/bin/sh
- # this is patch112.shar.02 (part 2 of tin)
- # do not concatenate these parts, unpack them in order with /bin/sh
- # file tin.patch112 continued
- #
- if test ! -r _shar_seq_.tmp; then
- echo 'Please unpack part 1 first!'
- exit 1
- fi
- (read Scheck
- if test "$Scheck" != 2; then
- echo Please unpack part "$Scheck" next!
- exit 1
- else
- exit 0
- fi
- ) < _shar_seq_.tmp || exit 1
- if test ! -f _shar_wnt_.tmp; then
- echo 'x - still skipping tin.patch112'
- else
- echo 'x - continuing file tin.patch112'
- sed 's/^X//' << 'SHAR_EOF' >> 'tin.patch112' &&
- X * Module : getline.c
- ! * Author : Chris Thewalt / Iain Lea
- X * Created : 09-11-91
- ! * Updated : 13-03-92
- X * Notes : emacs style line editing input package.
- X * Copyright : (c) Copyright 1991-92 by Chris Thewalt & Iain Lea
- X * Permission to use, copy, modify, and distribute this
- --- 1,9 ----
- X /*
- X * Project : tin - a threaded Netnews reader
- X * Module : getline.c
- ! * Author : Chris Thewalt & Iain Lea
- X * Created : 09-11-91
- ! * Updated : 29-03-92
- X * Notes : emacs style line editing input package.
- X * Copyright : (c) Copyright 1991-92 by Chris Thewalt & Iain Lea
- X * Permission to use, copy, modify, and distribute this
- ***************
- *** 125,130 ****
- --- 125,131 ----
- X gl_addchar (str[i]);
- X }
- X while ((c = ReadCh ()) != EOF) {
- + c &= 0xff;
- X if (isprint (c)) {
- X if (number_only) {
- X if (isdigit (c) && gl_cnt < 6) { /* num < 100000 */
- Only in .: getline.o
- diff -rcs ../111/group.c ./group.c
- *** ../111/group.c Fri Mar 27 14:00:39 1992
- --- ./group.c Thu Mar 26 15:05:35 1992
- ***************
- *** 3,9 ****
- X * Module : group.c
- X * Author : I.Lea & R.Skrenta
- X * Created : 01-04-91
- ! * Updated : 22-03-92
- X * Notes :
- X * Copyright : (c) Copyright 1991-92 by Iain Lea & Rich Skrenta
- X * You may freely copy or redistribute this software,
- --- 3,9 ----
- X * Module : group.c
- X * Author : I.Lea & R.Skrenta
- X * Created : 01-04-91
- ! * Updated : 25-03-92
- X * Notes :
- X * Copyright : (c) Copyright 1991-92 by Iain Lea & Rich Skrenta
- X * You may freely copy or redistribute this software,
- ***************
- *** 153,162 ****
- X
- X case '|': /* pipe article/thread/tagged arts to command */
- X if (index_point >= 0) {
- - set_real_uid_gid ();
- X feed_articles (FEED_PIPE, GROUP_LEVEL, "Pipe",
- X (int) base[index_point], group_path);
- - set_tin_uid_gid ();
- X }
- X break;
- X
- --- 153,160 ----
- ***************
- *** 454,463 ****
- X
- X case 'm': /* mail article to somebody */
- X if (index_point >= 0) {
- - set_real_uid_gid ();
- X feed_articles (FEED_MAIL, GROUP_LEVEL, "Mail",
- X (int) base[index_point], group_path);
- - set_tin_uid_gid ();
- X }
- X break;
- X
- --- 452,459 ----
- ***************
- *** 511,520 ****
- X
- X case 'o': /* output art/thread/tagged arts to printer */
- X if (index_point >= 0) {
- - set_real_uid_gid ();
- X feed_articles (FEED_PRINT, GROUP_LEVEL, "Print",
- X (int) base[index_point], group_path);
- - set_tin_uid_gid ();
- X }
- X break;
- X
- --- 507,514 ----
- ***************
- *** 580,589 ****
- X
- X case 's': /* save regex pattern to file/s */
- X if (index_point >= 0) {
- - set_real_uid_gid ();
- X feed_articles (FEED_SAVE, GROUP_LEVEL, "Save",
- X (int) base[index_point], group_path);
- - set_tin_uid_gid ();
- X }
- X break;
- X
- --- 574,581 ----
- ***************
- *** 825,831 ****
- X if (show_only_unread) {
- X n = new_responses (i);
- X if (n > 0) {
- ! n = n - 1;
- X }
- X } else {
- X n = num_of_responses (i);
- --- 817,825 ----
- X if (show_only_unread) {
- X n = new_responses (i);
- X if (n > 0) {
- ! if (num_of_responses (i) == 0) {
- ! n = n - 1;
- ! }
- X }
- X } else {
- X n = num_of_responses (i);
- Only in .: group.o
- Files ../111/hashstr.c and ./hashstr.c are identical
- Only in .: hashstr.o
- diff -rcs ../111/help.c ./help.c
- *** ../111/help.c Fri Mar 27 14:00:39 1992
- --- ./help.c Sun Mar 29 04:49:52 1992
- ***************
- *** 3,9 ****
- X * Module : help.c
- X * Author : I.Lea
- X * Created : 01-04-91
- ! * Updated : 12-02-92
- X * Notes :
- X * Copyright : (c) Copyright 1991-92 by Iain Lea
- X * You may freely copy or redistribute this software,
- --- 3,9 ----
- X * Module : help.c
- X * Author : I.Lea
- X * Created : 01-04-91
- ! * Updated : 28-03-92
- X * Notes :
- X * Copyright : (c) Copyright 1991-92 by Iain Lea
- X * You may freely copy or redistribute this software,
- ***************
- *** 21,26 ****
- --- 21,27 ----
- X txt_help_ctrl_l,
- X txt_help_g_ctrl_k,
- X txt_help_g_ctrl_r,
- + txt_help_ctrl_y,
- X txt_help_g_cr,
- X txt_help_g_tab,
- X txt_help_b,
- Only in .: help.o
- diff -rcs ../111/inews.c ./inews.c
- *** ../111/inews.c Fri Mar 27 14:00:40 1992
- --- ./inews.c Sat Mar 28 10:29:39 1992
- ***************
- *** 3,9 ****
- X * Module : inews.c
- X * Author : I.Lea
- X * Created : 17-03-92
- ! * Updated : 19-03-92
- X * Notes : NNTP builtin version of inews
- X * Copyright : (c) Copyright 1991-92 by Iain Lea
- X * You may freely copy or redistribute this software,
- --- 3,9 ----
- X * Module : inews.c
- X * Author : I.Lea
- X * Created : 17-03-92
- ! * Updated : 28-03-92
- X * Notes : NNTP builtin version of inews
- X * Copyright : (c) Copyright 1991-92 by Iain Lea
- X * You may freely copy or redistribute this software,
- ***************
- *** 59,65 ****
- X }
- X }
- X
- ! #if defined(BSD) || defined(sinix)
- X gethostname (host_name, sizeof (host_name));
- X #else
- X uname (host_name);
- --- 59,65 ----
- X }
- X }
- X
- ! #if defined(BSD) || defined(sinix) || defined(RS6000)
- X gethostname (host_name, sizeof (host_name));
- X #else
- X uname (host_name);
- Only in .: inews.o
- diff -rcs ../111/init.c ./init.c
- *** ../111/init.c Fri Mar 27 14:00:40 1992
- --- ./init.c Fri Mar 27 12:28:44 1992
- ***************
- *** 3,9 ****
- X * Module : init.c
- X * Author : I.Lea
- X * Created : 01-04-91
- ! * Updated : 21-03-92
- X * Notes :
- X * Copyright : (c) Copyright 1991-92 by Iain Lea
- X * You may freely copy or redistribute this software,
- --- 3,9 ----
- X * Module : init.c
- X * Author : I.Lea
- X * Created : 01-04-91
- ! * Updated : 27-03-92
- X * Notes :
- X * Copyright : (c) Copyright 1991-92 by Iain Lea
- X * You may freely copy or redistribute this software,
- ***************
- *** 71,76 ****
- --- 71,77 ----
- X int max_art;
- X int real_uid;
- X int real_gid;
- + int start_editor_offset;
- X int tin_uid;
- X int tin_gid;
- X int top = 0;
- ***************
- *** 97,103 ****
- X int save_archive_name; /* save thread with name from Archive-name: field */
- X int mail_news; /* mail all arts to specified user */
- X int save_news; /* save all arts to savedir structure */
- - int save_separate; /* save a each part of a thread to a separate file */
- X int show_author; /* show Subject & From or only Subject in group menu */
- X int show_only_unread; /* show only new/unread arts or all arts */
- X int sort_art_type; /* sort arts[] array by subject,from or date field */
- --- 98,103 ----
- ***************
- *** 165,172 ****
- X post_proc_type = POST_PROC_NONE;
- X pos_first_unread = TRUE;
- X print_header = FALSE;
- - save_separate = TRUE;
- X save_archive_name = TRUE;
- X default_show_author = SHOW_FROM_NAME;
- X show_only_unread = FALSE;
- X sort_art_type = SORT_BY_NOTHING;
- --- 165,172 ----
- X post_proc_type = POST_PROC_NONE;
- X pos_first_unread = TRUE;
- X print_header = FALSE;
- X save_archive_name = TRUE;
- + start_editor_offset = TRUE;
- X default_show_author = SHOW_FROM_NAME;
- X show_only_unread = FALSE;
- X sort_art_type = SORT_BY_NOTHING;
- ***************
- *** 214,221 ****
- X strcpy (bug_addr, BUG_REPORT_ADDRESS);
- X strcpy (redirect_output, "> /dev/null 2>&1");
- X
- - set_real_uid_gid ();
- -
- X #ifdef INDEX_DAEMON
- X sprintf (indexdir, "%s/.index", SPOOLDIR);
- X strcpy (newsrc, active_file); /* so that all groups are indexed */
- --- 214,219 ----
- ***************
- *** 395,402 ****
- X
- X got_bug_addr:;
- X sprintf (txt_help_bug_report, txt_help_bug, bug_addr);
- -
- - set_tin_uid_gid ();
- X }
- X
- X
- --- 393,398 ----
- ***************
- *** 405,411 ****
- X int created = FALSE;
- X struct stat sb;
- X
- - set_real_uid_gid ();
- X if (stat (maildir, &sb) == -1) {
- X mkdir (maildir, 0755);
- X created = TRUE;
- --- 401,406 ----
- ***************
- *** 414,420 ****
- X mkdir (savedir, 0755);
- X created = TRUE;
- X }
- - set_tin_uid_gid ();
- X
- X return (created);
- X }
- --- 409,414 ----
- Only in .: init.o
- diff -rcs ../111/kill.c ./kill.c
- *** ../111/kill.c Fri Mar 27 14:00:44 1992
- --- ./kill.c Thu Mar 26 15:05:36 1992
- ***************
- *** 31,38 ****
- X
- X free_kill_array ();
- X
- - set_real_uid_gid ();
- -
- X if ((fp = fopen (killfile, "r")) != NULL) {
- X kill_num=0;
- X while (fgets (buf, sizeof buf, fp) != NULL) {
- --- 31,36 ----
- ***************
- *** 76,85 ****
- X }
- X }
- X fclose (fp);
- - set_tin_uid_gid ();
- X return TRUE;
- X } else {
- - set_tin_uid_gid ();
- X return FALSE;
- X }
- X
- --- 74,81 ----
- ***************
- *** 87,93 ****
- X fclose (fp);
- X killf[kill_num].kill_type = 0;
- X error_message ("corrupt kill file %s", killfile);
- - set_tin_uid_gid ();
- X return FALSE;
- X }
- X
- --- 83,88 ----
- ***************
- *** 100,107 ****
- X FILE *fp;
- X int i;
- X
- - set_real_uid_gid ();
- -
- X if (kill_num && (fp = fopen (killfile, "w")) != NULL) {
- X wait_message (txt_saving);
- X fprintf (fp, "# 1st line 1=(Subject: only) 2=(From: only) 3=(Subject: & From:)\n");
- --- 95,100 ----
- ***************
- *** 128,134 ****
- X fclose (fp);
- X chmod (killfile, 0600);
- X }
- - set_tin_uid_gid ();
- X }
- X
- X /*
- --- 121,126 ----
- ***************
- *** 158,164 ****
- --- 150,160 ----
- X if (do_sigtstp) {
- X #ifdef POSIX_JOB_CONTROL
- X sigemptyset (&kill_act.sa_mask);
- + #if defined(SA_RESTART)
- X kill_act.sa_flags = SA_RESTART | SA_RESETHAND;
- + #else
- + kill_act.sa_flags = 0;
- + #endif
- X kill_act.sa_handler = SIG_DFL;
- X sigaction (SIGTSTP, &kill_act, &old_act);
- X kill_act.sa_handler = SIG_IGN;
- ***************
- *** 345,351 ****
- --- 341,351 ----
- X if (do_sigtstp) {
- X #ifdef POSIX_JOB_CONTROL
- X sigemptyset (&kill_act.sa_mask);
- + #if defined(SA_RESTART)
- X kill_act.sa_flags = SA_RESTART | SA_RESETHAND;
- + #else
- + kill_act.sa_flags = 0;
- + #endif
- X kill_act.sa_handler = SIG_IGN;
- X sigaction (SIGTSTP, &old_act, 0L);
- X #else
- Only in .: kill.o
- diff -rcs ../111/lang.c ./lang.c
- *** ../111/lang.c Fri Mar 27 14:00:45 1992
- --- ./lang.c Sun Mar 29 04:49:14 1992
- ***************
- *** 3,9 ****
- X * Module : lang.c
- X * Author : I.Lea
- X * Created : 01-04-91
- ! * Updated : 21-03-92
- X * Notes :
- X * Copyright : (c) Copyright 1991-92 by Iain Lea
- X * You may freely copy or redistribute this software,
- --- 3,9 ----
- X * Module : lang.c
- X * Author : I.Lea
- X * Created : 01-04-91
- ! * Updated : 28-03-92
- X * Notes :
- X * Copyright : (c) Copyright 1991-92 by Iain Lea
- X * You may freely copy or redistribute this software,
- ***************
- *** 78,84 ****
- X char txt_post_subject[] = "Post Subject [%s]> ";
- X char txt_no_subject[] = "No subject";
- X char txt_cannot_open[] = "can't open %s";
- ! char txt_posting[] = "Posting...";
- X char txt_art_posted[] = "-- Article posted --";
- X char txt_art_rejected[] = "-- Article rejected (saved to %s) --";
- X char txt_abort_edit_post[] = "a)bort, e)dit, p)ost: ";
- --- 78,84 ----
- X char txt_post_subject[] = "Post Subject [%s]> ";
- X char txt_no_subject[] = "No subject";
- X char txt_cannot_open[] = "can't open %s";
- ! char txt_posting[] = "Posting article...";
- X char txt_art_posted[] = "-- Article posted --";
- X char txt_art_rejected[] = "-- Article rejected (saved to %s) --";
- X char txt_abort_edit_post[] = "a)bort, e)dit, p)ost: ";
- ***************
- *** 286,291 ****
- --- 286,292 ----
- X char txt_mail_bug_report[] = "Mail bug report...";
- X char txt_mail_bug_report_confirm[] = "Mail bug report to %s? (y/n): ";
- X char txt_reply_to_author[] = "Reply to author...";
- + char txt_no_blank_line[] = "No blank line found after header information. a)bort, e)dit: ";
- X
- X /*
- X * prompt.c
- ***************
- *** 298,305 ****
- X */
- X
- X char txt_opt_autosave[] = "1. Auto save : ";
- ! char txt_opt_save_separate[] = "2. Save separate : ";
- ! char txt_opt_mark_saved_read[] = "3. Mark saved read : ";
- X char txt_opt_kill_articles[] = "4. Kill articles : ";
- X char txt_opt_draw_arrow[] = "5. Draw arrow : ";
- X char txt_opt_print_header[] = "6. Print header : ";
- --- 299,306 ----
- X */
- X
- X char txt_opt_autosave[] = "1. Auto save : ";
- ! char txt_opt_start_editor_offset[] = "2. Editor Offset : ";
- ! char txt_opt_mark_saved_read[] = "3. Mark saved read : ";
- X char txt_opt_kill_articles[] = "4. Kill articles : ";
- X char txt_opt_draw_arrow[] = "5. Draw arrow : ";
- X char txt_opt_print_header[] = "6. Print header : ";
- ***************
- *** 332,338 ****
- X char txt_sort_by_date_descend[] = "Date: field (descending)";
- X char txt_sort_by_date_ascend[] = "Date: field (ascending)";
- X char txt_help_autosave[] = "Auto save article/thread by Archive-name: header. <SPACE> toggles & <CR> sets.";
- ! char txt_help_save_separate[] = "Save articles/threads to separate files. <SPACE> toggles & <CR> sets.";
- X char txt_help_print_header[] = "By printing print all/part of header. <SPACE> toggles & <CR> sets.";
- X char txt_help_pos_first_unread[] = "Put cursor at first/last unread art in groups. <SPACE> toggles & <CR> sets.";
- X char txt_help_show_author[] = "Show Subject & From (author) fields in group menu. <SPACE> toggles & <CR> sets.";
- --- 333,339 ----
- X char txt_sort_by_date_descend[] = "Date: field (descending)";
- X char txt_sort_by_date_ascend[] = "Date: field (ascending)";
- X char txt_help_autosave[] = "Auto save article/thread by Archive-name: header. <SPACE> toggles & <CR> sets.";
- ! char txt_help_start_editor_offset[] = "Start editor with line offset. <SPACE> toggles & <CR> sets.";
- X char txt_help_print_header[] = "By printing print all/part of header. <SPACE> toggles & <CR> sets.";
- X char txt_help_pos_first_unread[] = "Put cursor at first/last unread art in groups. <SPACE> toggles & <CR> sets.";
- X char txt_help_show_author[] = "Show Subject & From (author) fields in group menu. <SPACE> toggles & <CR> sets.";
- ***************
- *** 400,405 ****
- --- 401,407 ----
- X char txt_select_group[] = "Select group> ";
- X char txt_help_g_4[] = "4$ Select group 4 ($=select last group)\r\n";
- X char txt_help_g_ctrl_r[] = "^R Reset .newsrc\r\n";
- + char txt_help_ctrl_y[] = "^Y Yank in active file to see any new news\r\n";
- X char txt_help_g_ctrl_k[] = "^KZ Delete (Z=undelete) group from .newsrc\r\n";
- X char txt_help_g_cr[] = "<CR> Read current group\r\n";
- X char txt_help_g_c[] = "c Mark group as all read\r\n";
- Only in .: lang.o
- diff -rcs ../111/main.c ./main.c
- *** ../111/main.c Fri Mar 27 14:00:46 1992
- --- ./main.c Sun Mar 29 12:32:49 1992
- ***************
- *** 3,9 ****
- X * Module : main.c
- X * Author : I.Lea & R.Skrenta
- X * Created : 01-04-91
- ! * Updated : 22-03-92
- X * Notes :
- X * Copyright : (c) Copyright 1991-92 by Iain Lea & Rich Skrenta
- X * You may freely copy or redistribute this software,
- --- 3,9 ----
- X * Module : main.c
- X * Author : I.Lea & R.Skrenta
- X * Created : 01-04-91
- ! * Updated : 29-03-92
- X * Notes :
- X * Copyright : (c) Copyright 1991-92 by Iain Lea & Rich Skrenta
- X * You may freely copy or redistribute this software,
- ***************
- *** 24,30 ****
- X {
- X int created;
- X int start_groupnum = 0;
- !
- X cmd_line = TRUE;
- X debug = 0; /* debug OFF */
- X
- --- 24,34 ----
- X {
- X int created;
- X int start_groupnum = 0;
- !
- ! #ifdef SVR4
- ! setlocale (LC_ALL, "");
- ! #endif
- !
- X cmd_line = TRUE;
- X debug = 0; /* debug OFF */
- X
- ***************
- *** 54,63 ****
- X real_gid = getgid ();
- X
- X /*
- ! * we're setuid, so index in /usr/spool/news unless user root
- X */
- ! if (tin_uid != real_uid && real_uid != 0) {
- X local_index = FALSE;
- X } else { /* index in users home directory ~/.tin/.index */
- X local_index = TRUE;
- X }
- --- 58,70 ----
- X real_gid = getgid ();
- X
- X /*
- ! * we're setuid, so index in /usr/spool/news even if user root
- ! * This is quite essential if non local index files are
- ! * to be updated during the night from crontab by root.
- X */
- ! if (tin_uid != real_uid) {
- X local_index = FALSE;
- + set_real_uid_gid();
- X } else { /* index in users home directory ~/.tin/.index */
- X local_index = TRUE;
- X }
- ***************
- *** 276,287 ****
- X break;
- X
- X case 'V':
- ! #if defined(__DATE__) && defined(__TIME__)
- ! sprintf (msg, "Version: %s PL%d %s %s",
- X VERSION, PATCHLEVEL, __DATE__, __TIME__);
- ! #else
- X sprintf (msg, "Version: %s PL%d",
- X VERSION, PATCHLEVEL);
- X #endif
- X error_message (msg, "");
- X exit (1);
- --- 283,299 ----
- X break;
- X
- X case 'V':
- ! #ifndef COMPILED
- ! # if defined(__DATE__) && defined(__TIME__)
- ! sprintf (msg, "Version: %s PL%d %s %s",
- X VERSION, PATCHLEVEL, __DATE__, __TIME__);
- ! # else
- X sprintf (msg, "Version: %s PL%d",
- X VERSION, PATCHLEVEL);
- + # endif
- + #else
- + sprintf (msg, "Version: %s PL%d %s",
- + VERSION, PATCHLEVEL, COMPILED);
- X #endif
- X error_message (msg, "");
- X exit (1);
- ***************
- *** 416,422 ****
- X verbose = FALSE;
- X switch (fork ()) { /* fork child to update indexes in background */
- X case -1: /* error forking */
- ! error_message ("Failed to start background indexing process", "");
- X break;
- X case 0: /* child process */
- X process_id = getpid ();
- --- 428,434 ----
- X verbose = FALSE;
- X switch (fork ()) { /* fork child to update indexes in background */
- X case -1: /* error forking */
- ! perror_message ("Failed to start background indexing process", "");
- X break;
- X case 0: /* child process */
- X process_id = getpid ();
- Only in .: main.o
- diff -rcs ../111/memory.c ./memory.c
- *** ../111/memory.c Fri Mar 27 14:00:47 1992
- --- ./memory.c Wed Mar 25 10:21:59 1992
- ***************
- *** 3,9 ****
- X * Module : memory.c
- X * Author : I.Lea & R.Skrenta
- X * Created : 01-04-91
- ! * Updated : 16-02-92
- X * Notes :
- X * Copyright : (c) Copyright 1991-92 by Iain Lea & Rich Skrenta
- X * You may freely copy or redistribute this software,
- --- 3,9 ----
- X * Module : memory.c
- X * Author : I.Lea & R.Skrenta
- X * Created : 01-04-91
- ! * Updated : 25-03-92
- X * Notes :
- X * Copyright : (c) Copyright 1991-92 by Iain Lea & Rich Skrenta
- X * You may freely copy or redistribute this software,
- ***************
- *** 196,202 ****
- X }
- X
- X if (active != (struct group_t *) 0) { /* active[] */
- ! for (i=0 ; i < max_active ; i++) {
- X if (active[i].name != (char *) 0) {
- X free ((char *) active[i].name);
- X active[i].name = (char *) 0;
- --- 196,202 ----
- X }
- X
- X if (active != (struct group_t *) 0) { /* active[] */
- ! for (i=0 ; i < num_active ; i++) {
- X if (active[i].name != (char *) 0) {
- X free ((char *) active[i].name);
- X active[i].name = (char *) 0;
- Only in .: memory.o
- diff -rcs ../111/misc.c ./misc.c
- *** ../111/misc.c Fri Mar 27 14:00:52 1992
- --- ./misc.c Sun Mar 29 04:46:25 1992
- ***************
- *** 3,9 ****
- X * Module : misc.c
- X * Author : I.Lea & R.Skrenta
- X * Created : 01-04-91
- ! * Updated : 21-03-92
- X * Notes :
- X * Copyright : (c) Copyright 1991-92 by Iain Lea & Rich Skrenta
- X * You may freely copy or redistribute this software,
- --- 3,9 ----
- X * Module : misc.c
- X * Author : I.Lea & R.Skrenta
- X * Created : 01-04-91
- ! * Updated : 28-03-92
- X * Notes :
- X * Copyright : (c) Copyright 1991-92 by Iain Lea & Rich Skrenta
- X * You may freely copy or redistribute this software,
- ***************
- *** 60,66 ****
- X while (fgets (buf, sizeof (buf), fp_ip) != NULL) {
- X if (fprintf (fp_op, "%s", buf) == EOF) {
- X sprintf (msg, "Error: fprintf() failed in copy_fp(). errno=%d", errno);
- ! error_message (msg, "");
- X }
- X }
- X } else {
- --- 60,66 ----
- X while (fgets (buf, sizeof (buf), fp_ip) != NULL) {
- X if (fprintf (fp_op, "%s", buf) == EOF) {
- X sprintf (msg, "Error: fprintf() failed in copy_fp(). errno=%d", errno);
- ! perror_message (msg, "");
- X }
- X }
- X } else {
- ***************
- *** 67,73 ****
- X while (fgets (buf, sizeof (buf), fp_ip) != NULL) {
- X if (fprintf (fp_op, "%s%s", prefix, buf) == EOF) {
- X sprintf (msg, "Error: fprintf() failed in copy_fp(). errno=%d", errno);
- ! error_message (msg, "");
- X }
- X }
- X }
- --- 67,73 ----
- X while (fgets (buf, sizeof (buf), fp_ip) != NULL) {
- X if (fprintf (fp_op, "%s%s", prefix, buf) == EOF) {
- X sprintf (msg, "Error: fprintf() failed in copy_fp(). errno=%d", errno);
- ! perror_message (msg, "");
- X }
- X }
- X }
- ***************
- *** 102,112 ****
- X first = FALSE;
- X }
- X
- ! #ifdef NO_START_LINE
- ! sprintf (buf, "%s %s", editor, nam);
- ! #else
- ! sprintf (buf, "%s +%d %s", editor, start_line_offset, nam);
- ! #endif
- X
- X printf ("%s", buf);
- X return invoke_cmd (buf);
- --- 102,112 ----
- X first = FALSE;
- X }
- X
- ! if (start_editor_offset) {
- ! sprintf (buf, "%s +%d %s", editor, start_line_offset, nam);
- ! } else {
- ! sprintf (buf, "%s %s", editor, nam);
- ! }
- X
- X printf ("%s", buf);
- X return invoke_cmd (buf);
- ***************
- *** 149,156 ****
- X EndWin ();
- X Raw (FALSE);
- X
- - set_real_uid_gid ();
- -
- X #ifdef SIGTSTP
- X if (do_sigtstp)
- X susp = signal (SIGTSTP, SIG_DFL);
- --- 149,154 ----
- ***************
- *** 163,170 ****
- X signal (SIGTSTP, susp);
- X #endif
- X
- - set_tin_uid_gid ();
- -
- X Raw (TRUE);
- X InitWin ();
- X
- --- 161,166 ----
- ***************
- *** 221,234 ****
- X EndWin ();
- X Raw (FALSE);
- X
- - if (debug == 2) {
- - {
- - extern int test_reread;
- - printf ("resync ran %d times with max_active of %d\n", test_reread, max_active);
- - fflush (stdout);
- - }
- - }
- -
- X exit (ret);
- X }
- X
- --- 217,222 ----
- ***************
- *** 246,256 ****
- X
- X #ifndef INDEX_DAEMON
- X
- - set_real_uid_gid ();
- -
- X if ((fp = fopen (unthreadfile, "r")) == NULL) {
- ! error_message (txt_cannot_open, unthreadfile);
- ! set_tin_uid_gid ();
- X return;
- X }
- X
- --- 234,241 ----
- X
- X #ifndef INDEX_DAEMON
- X
- X if ((fp = fopen (unthreadfile, "r")) == NULL) {
- ! perror_message (txt_cannot_open, unthreadfile);
- X return;
- X }
- X
- ***************
- *** 269,276 ****
- X }
- X }
- X fclose (fp);
- - set_tin_uid_gid ();
- -
- X #endif /* INDEX_DAEMON */
- X }
- X
- --- 254,259 ----
- ***************
- *** 323,329 ****
- X }
- X if (unlink (old_filename) == -1) {
- X sprintf (buf, txt_rename_error, old_filename, new_filename);
- ! error_message (buf, "THREE");
- X return;
- X }
- X }
- --- 306,312 ----
- X }
- X if (unlink (old_filename) == -1) {
- X sprintf (buf, txt_rename_error, old_filename, new_filename);
- ! perror_message (buf, "THREE");
- X return;
- X }
- X }
- ***************
- *** 353,364 ****
- X #ifdef SIGTSTP
- X SIGTYPE (*susp)();
- X #endif
- !
- X time_remaining = alarm (0); /* save time remaining on alarm clock */
- X
- X EndWin ();
- X Raw (FALSE);
- - set_real_uid_gid ();
- X
- X #ifdef SIGTSTP
- X if (do_sigtstp)
- --- 336,347 ----
- X #ifdef SIGTSTP
- X SIGTYPE (*susp)();
- X #endif
- ! #ifndef NO_RESYNC_ACTIVE_FILE
- X time_remaining = alarm (0); /* save time remaining on alarm clock */
- + #endif
- X
- X EndWin ();
- X Raw (FALSE);
- X
- X #ifdef SIGTSTP
- X if (do_sigtstp)
- ***************
- *** 372,383 ****
- X signal (SIGTSTP, susp);
- X #endif
- X
- - set_tin_uid_gid ();
- -
- X Raw (TRUE);
- X InitWin ();
- X
- X alarm (time_remaining); /* restart resync alarm clock */
- X
- X return ret == 0;
- X }
- --- 355,366 ----
- X signal (SIGTSTP, susp);
- X #endif
- X
- X Raw (TRUE);
- X InitWin ();
- X
- + #ifndef NO_RESYNC_ACTIVE_FILE
- X alarm (time_remaining); /* restart resync alarm clock */
- + #endif
- X
- X return ret == 0;
- X }
- ***************
- *** 407,437 ****
- X EndInverse ();
- X }
- X
- -
- X void set_real_uid_gid ()
- X {
- X #if defined(BSD) && ! defined(sinix)
- X #ifdef sun
- X if (seteuid (real_uid) == -1) {
- ! error_message ("Error setreuid(real) failed", "");
- X }
- ! if (setrgid (real_gid) == -1) {
- ! error_message ("Error setregid(real) failed", "");
- X }
- X #else
- X if (setreuid (tin_uid, real_uid) == -1) {
- ! error_message ("Error setreuid(real) failed", "");
- X }
- X if (setregid (tin_gid, real_gid) == -1) {
- ! error_message ("Error setregid(real) failed", "");
- X }
- X #endif /* sun */
- X #else
- X if (setuid (real_uid) == -1) {
- ! error_message ("Error setuid(real) failed", "");
- X }
- X if (setgid (real_gid) == -1) {
- ! error_message ("Error setgid(real) failed", "");
- X }
- X #endif
- X }
- --- 390,421 ----
- X EndInverse ();
- X }
- X
- X void set_real_uid_gid ()
- X {
- + if (local_index)
- + return;
- X #if defined(BSD) && ! defined(sinix)
- X #ifdef sun
- X if (seteuid (real_uid) == -1) {
- ! perror_message ("Error setreuid(real) failed", "");
- X }
- ! if (setegid (real_gid) == -1) {
- ! perror_message ("Error setregid(real) failed", "");
- X }
- X #else
- X if (setreuid (tin_uid, real_uid) == -1) {
- ! perror_message ("Error setreuid(real) failed", "");
- X }
- X if (setregid (tin_gid, real_gid) == -1) {
- ! perror_message ("Error setregid(real) failed", "");
- X }
- X #endif /* sun */
- X #else
- X if (setuid (real_uid) == -1) {
- ! perror_message ("Error setuid(real) failed", "");
- X }
- X if (setgid (real_gid) == -1) {
- ! perror_message ("Error setgid(real) failed", "");
- X }
- X #endif
- X }
- ***************
- *** 439,466 ****
- X
- X void set_tin_uid_gid ()
- X {
- X #if defined(BSD) && ! defined(sinix)
- X #ifdef sun
- X if (seteuid (tin_uid) == -1) {
- ! error_message ("Error setreuid(real) failed", "");
- X }
- ! if (setrgid (tin_gid) == -1) {
- ! error_message ("Error setregid(real) failed", "");
- X }
- X #else
- X if (setreuid (real_uid, tin_uid) == -1) {
- ! error_message ("Error setreuid(tin) failed", "");
- X }
- X if (setregid (real_gid, tin_gid) == -1) {
- ! error_message ("Error setregid(tin) failed", "");
- X }
- X #endif /* sun */
- X #else
- X if (setuid (tin_uid) == -1) {
- ! error_message ("Error setuid(tin) failed", "");
- X }
- X if (setgid (tin_gid) == -1) {
- ! error_message ("Error setgid(tin) failed", "");
- X }
- X #endif
- X }
- --- 423,452 ----
- X
- X void set_tin_uid_gid ()
- X {
- + if (local_index)
- + return;
- X #if defined(BSD) && ! defined(sinix)
- X #ifdef sun
- X if (seteuid (tin_uid) == -1) {
- ! perror_message ("Error setreuid(real) failed", "");
- X }
- ! if (setegid (tin_gid) == -1) {
- ! perror_message ("Error setregid(real) failed", "");
- X }
- X #else
- X if (setreuid (real_uid, tin_uid) == -1) {
- ! perror_message ("Error setreuid(tin) failed", "");
- X }
- X if (setregid (real_gid, tin_gid) == -1) {
- ! perror_message ("Error setregid(tin) failed", "");
- X }
- X #endif /* sun */
- X #else
- X if (setuid (tin_uid) == -1) {
- ! perror_message ("Error setuid(tin) failed", "");
- X }
- X if (setgid (tin_gid) == -1) {
- ! perror_message ("Error setgid(tin) failed", "");
- X }
- X #endif
- X }
- ***************
- *** 624,629 ****
- --- 610,634 ----
- X }
- X
- X return ret;
- + }
- +
- + /*
- + * strcmp that ignores case
- + */
- +
- + #define FOLD_TO_UPPER(a) (islower ((int) (a)) ? toupper ((int) (a)) : (a))
- +
- + int my_stricmp (p, q)
- + char *p;
- + char *q;
- + {
- + for (; FOLD_TO_UPPER (*p) == FOLD_TO_UPPER (*q); ++p, ++q) {
- + if (*p == '\0') {
- + return (0);
- + }
- + }
- +
- + return (FOLD_TO_UPPER (*p) - FOLD_TO_UPPER (*q));
- X }
- X
- X /*
- Only in .: misc.o
- diff -rcs ../111/newsrc.c ./newsrc.c
- *** ../111/newsrc.c Fri Mar 27 14:00:53 1992
- --- ./newsrc.c Sat Mar 28 12:59:51 1992
- ***************
- *** 3,9 ****
- X * Module : newsrc.c
- X * Author : I.Lea & R.Skrenta
- X * Created : 01-04-91
- ! * Updated : 19-03-92
- X * Notes :
- X * Copyright : (c) Copyright 1991-92 by Iain Lea & Rich Skrenta
- X * You may freely copy or redistribute this software,
- --- 3,9 ----
- X * Module : newsrc.c
- X * Author : I.Lea & R.Skrenta
- X * Created : 01-04-91
- ! * Updated : 28-03-92
- X * Notes :
- X * Copyright : (c) Copyright 1991-92 by Iain Lea & Rich Skrenta
- X * You may freely copy or redistribute this software,
- ***************
- *** 29,36 ****
- X int len;
- X int ret_code = FALSE;
- X
- - set_real_uid_gid ();
- -
- X if ((fp_subs = open_subscription_fp ()) != NULL) {
- X if ((fp_newsrc = fopen (newsrc, "w")) != NULL) {
- X while (fgets (buf, sizeof (buf), fp_subs) != NULL) {
- --- 29,34 ----
- ***************
- *** 46,53 ****
- X fclose (fp_subs);
- X }
- X
- - set_tin_uid_gid ();
- -
- X return (ret_code);
- X }
- X
- --- 44,49 ----
- ***************
- *** 60,67 ****
- X char buf[8192];
- X FILE *fp_newsrc, *fp_backup;
- X
- - set_real_uid_gid ();
- -
- X if ((fp_newsrc = fopen (newsrc, "r")) != NULL) {
- X sprintf (buf, "%s/.oldnewsrc", homedir);
- X unlink (buf); /* because rn makes a link of .newsrc -> .oldnewsrc */
- --- 56,61 ----
- ***************
- *** 73,80 ****
- X }
- X fclose (fp_newsrc);
- X }
- -
- - set_tin_uid_gid ();
- X }
- X
- X /*
- --- 67,72 ----
- ***************
- *** 96,103 ****
- X
- X reread_newsrc:
- X
- - set_real_uid_gid ();
- -
- X if ((fp = fopen (newsrc, "r")) == NULL) { /* attempt to make a .newsrc */
- X if (auto_subscribe_groups ()) { /* attempt to auto create newsrc */
- X goto reread_newsrc;
- --- 88,93 ----
- ***************
- *** 130,136 ****
- X if ((i = add_group (buf, FALSE)) < 0) {
- X if (! remove_old_groups) {
- X if ((fp_old = fopen (old_groups, "w")) == NULL) {
- ! error_message (txt_cannot_open, old_groups);
- X continue;
- X }
- X remove_old_groups = TRUE;
- --- 120,126 ----
- X if ((i = add_group (buf, FALSE)) < 0) {
- X if (! remove_old_groups) {
- X if ((fp_old = fopen (old_groups, "w")) == NULL) {
- ! perror_message (txt_cannot_open, old_groups);
- X continue;
- X }
- X remove_old_groups = TRUE;
- ***************
- *** 153,160 ****
- X fclose (fp_old);
- X rewrite_newsrc ();
- X }
- -
- - set_tin_uid_gid ();
- X }
- X
- X /*
- --- 143,148 ----
- ***************
- *** 169,178 ****
- X FILE *fp;
- X int i;
- X
- - set_real_uid_gid ();
- -
- X if ((fp = fopen (newsrc, "w")) == NULL) {
- - set_tin_uid_gid ();
- X return;
- X }
- X
- --- 157,163 ----
- ***************
- *** 183,190 ****
- X }
- X
- X fclose (fp);
- -
- - set_tin_uid_gid ();
- X }
- X
- X /*
- --- 168,173 ----
- ***************
- *** 198,205 ****
- X FILE *fp, *fp_old, *fp_new;
- X int found_old_group, len;
- X
- - set_real_uid_gid ();
- -
- X sprintf (old_groups, "%s/.newsrc.%d", homedir, process_id);
- X
- X if ((fp = fopen (newsrc, "r")) == NULL)
- --- 181,186 ----
- ***************
- *** 240,246 ****
- X
- X removed_old_groups_done:
- X unlink (old_groups);
- - set_tin_uid_gid ();
- X }
- X
- X /*
- --- 221,226 ----
- ***************
- *** 287,296 ****
- X char *p;
- X char c;
- X
- ! set_real_uid_gid ();
- !
- ! if ((newfp = fopen (newnewsrc, "w")) == NULL)
- X goto update_done;
- X
- X if ((fp = fopen (newsrc, "r")) != NULL) {
- X while (fgets (buf, sizeof buf, fp) != NULL) {
- --- 267,275 ----
- X char *p;
- X char c;
- X
- ! if ((newfp = fopen (newnewsrc, "w")) == NULL) {
- X goto update_done;
- + }
- X
- X if ((fp = fopen (newsrc, "r")) != NULL) {
- X while (fgets (buf, sizeof buf, fp) != NULL) {
- ***************
- *** 328,334 ****
- X rename_file (newnewsrc, newsrc);
- X
- X update_done:
- ! set_tin_uid_gid ();
- X }
- X
- X /*
- --- 307,313 ----
- X rename_file (newnewsrc, newsrc);
- X
- X update_done:
- ! ;
- X }
- X
- X /*
- ***************
- *** 355,362 ****
- X else
- X active[num].flag |= SUBSCRIBED;
- X
- - set_real_uid_gid ();
- -
- X if ((newfp = fopen (newnewsrc, "w")) == NULL)
- X goto subscribe_done;
- X
- --- 334,339 ----
- ***************
- *** 406,412 ****
- X rename_file (newnewsrc, newsrc);
- X
- X subscribe_done:
- ! set_tin_uid_gid ();
- X }
- X
- X
- --- 383,389 ----
- X rename_file (newnewsrc, newsrc);
- X
- X subscribe_done:
- ! ;
- X }
- X
- X
- ***************
- *** 419,426 ****
- X char c;
- X int i;
- X
- - set_real_uid_gid ();
- -
- X if ((newfp = fopen (newnewsrc, "w")) == NULL)
- X goto update_done;
- X
- --- 396,401 ----
- ***************
- *** 449,456 ****
- X rename_file (newnewsrc, newsrc);
- X
- X update_done:
- - set_tin_uid_gid ();
- -
- X for (i = 0; i < group_top; i++)
- X unread[i] = -1;
- X }
- --- 424,429 ----
- ***************
- *** 467,474 ****
- X int gotit = FALSE;
- X FILE *del;
- X
- - set_real_uid_gid ();
- -
- X if ((newfp = fopen (newnewsrc, "w")) == NULL)
- X goto del_done;
- X
- --- 440,445 ----
- ***************
- *** 509,515 ****
- X rename_file (newnewsrc, newsrc);
- X
- X del_done:
- ! set_tin_uid_gid ();
- X }
- X
- X
- --- 480,486 ----
- X rename_file (newnewsrc, newsrc);
- X
- X del_done:
- ! ;
- X }
- X
- X
- ***************
- *** 526,535 ****
- X int i, j;
- X char c;
- X
- - set_real_uid_gid ();
- -
- X if ((del = fopen(delgroups, "r")) == NULL) {
- - set_tin_uid_gid ();
- X return FALSE;
- X }
- X
- --- 497,503 ----
- ***************
- *** 536,542 ****
- X unlink(delgroups);
- X
- X if ((newfp = fopen(delgroups, "w")) == NULL) {
- - set_tin_uid_gid ();
- X return FALSE;
- X }
- X
- --- 504,509 ----
- ***************
- *** 554,560 ****
- X which = !which;
- X
- X if (!*buf[which]) {
- - set_tin_uid_gid ();
- X return FALSE;
- X }
- X
- --- 521,526 ----
- ***************
- *** 578,584 ****
- X if (strcmp(buf[which], active[i].name) == 0) {
- X for (j = 0; j < group_top; j++)
- X if (my_group[j] == i) {
- - set_tin_uid_gid ();
- X return j;
- X }
- X
- --- 544,549 ----
- ***************
- *** 597,608 ****
- X unread[cur_groupnum] = parse_unread(p, i);
- X
- X if ((fp = fopen(newsrc, "r")) == NULL) {
- - set_tin_uid_gid ();
- X return FALSE;
- X }
- X if ((newfp = fopen(newnewsrc, "w")) == NULL) {
- X fclose(fp);
- - set_tin_uid_gid ();
- X return FALSE;
- X }
- X i = 0;
- --- 562,571 ----
- ***************
- *** 642,653 ****
- X fclose (newfp);
- X fclose (fp);
- X rename_file (newnewsrc, newsrc);
- - set_tin_uid_gid ();
- X return TRUE;
- X }
- X }
- - set_tin_uid_gid ();
- -
- X return FALSE;
- X }
- X
- --- 605,613 ----
- ***************
- *** 665,672 ****
- X if (active[groupnum].max < 2)
- X return;
- X
- - set_real_uid_gid ();
- -
- X if ((newfp = fopen (newnewsrc, "w")) == NULL)
- X goto mark_group_read_done;
- X
- --- 625,630 ----
- ***************
- *** 700,706 ****
- X rename_file (newnewsrc, newsrc);
- X
- X mark_group_read_done:
- ! set_tin_uid_gid ();
- X }
- X
- X
- --- 658,664 ----
- X rename_file (newnewsrc, newsrc);
- X
- X mark_group_read_done:
- ! ;
- X }
- X
- X
- ***************
- *** 733,738 ****
- --- 691,701 ----
- X }
- X }
- X
- + /*
- + * Read the first range from the .newsrc sequencer information.
- + * If the top of the first range is higher than what the active
- + * file claims is the bottom, use it as the new bottom instead.
- + */
- X
- X int parse_unread (s, groupnum)
- X char *s;
- ***************
- *** 744,759 ****
- X int gotone = FALSE;
- X int n;
- X
- - /*
- - * Read the first range from the .newsrc sequencer information. If the
- - * top of the first range is higher than what the active file claims is
- - * the bottom, use it as the new bottom instead
- - */
- -
- X high = 0;
- X if (*s) {
- ! while (*s && (*s < '0' || *s > '9'))
- X s++;
- X
- X if (*s && *s >= '0' && *s <= '9') {
- X low = (long) atol (s);
- --- 707,718 ----
- X int gotone = FALSE;
- X int n;
- X
- X high = 0;
- +
- X if (*s) {
- ! while (*s && (*s < '0' || *s > '9')) {
- X s++;
- + }
- X
- X if (*s && *s >= '0' && *s <= '9') {
- X low = (long) atol (s);
- ***************
- *** 943,950 ****
- X int option_line = FALSE;
- X int ret_code = FALSE;
- X
- - set_real_uid_gid ();
- -
- X if ((fp_in = fopen (newsrc, "r")) == NULL) {
- X goto rewrite_group_done;
- X }
- --- 902,907 ----
- ***************
- *** 1040,1046 ****
- X }
- X
- X rewrite_group_done:
- - set_tin_uid_gid ();
- X return ret_code;
- X }
- X
- --- 997,1002 ----
- Only in .: newsrc.o
- Files ../111/nntp.h and ./nntp.h are identical
- diff -rcs ../111/open.c ./open.c
- *** ../111/open.c Fri Mar 27 14:00:58 1992
- --- ./open.c Thu Mar 26 15:05:38 1992
- ***************
- *** 200,207 ****
- X char line[NNTP_STRLEN];
- X #endif
- X extern char index_file[];
- X
- ! find_index_file (group_name);
- X
- X #ifdef NNTP_XINDEX
- X if (read_news_via_nntp) {
- --- 200,215 ----
- X char line[NNTP_STRLEN];
- X #endif
- X extern char index_file[];
- + char group_path[LEN];
- + char *p;
- +
- + strcpy (group_path, group_name); /* turn comp.unix.amiga
- + into */
- + for (p = group_path; *p; p++) /* comp/unix/amiga */
- + if (*p == '.')
- + *p = '/';
- X
- ! find_index_file (group_name, group_path);
- X
- X #ifdef NNTP_XINDEX
- X if (read_news_via_nntp) {
- ***************
- *** 426,432 ****
- X mktemp (fnam);
- X
- X if ((fp = fopen (fnam, "w")) == NULL) {
- ! error_message (txt_stuff_nntp_cannot_open, fnam);
- X return FALSE;
- X }
- X
- --- 434,440 ----
- X mktemp (fnam);
- X
- X if ((fp = fopen (fnam, "w")) == NULL) {
- ! perror_message (txt_stuff_nntp_cannot_open, fnam);
- X return FALSE;
- X }
- X
- ***************
- *** 472,478 ****
- X }
- X
- X if ((fp = fopen (fnam, "r")) == NULL) {
- ! error_message (txt_nntp_to_fp_cannot_reopen, fnam);
- X return NULL;
- X }
- X
- --- 480,486 ----
- X }
- X
- X if ((fp = fopen (fnam, "r")) == NULL) {
- ! perror_message (txt_nntp_to_fp_cannot_reopen, fnam);
- X return NULL;
- X }
- X
- ***************
- *** 501,507 ****
- X }
- X
- X if ((fd = open (fnam, 0)) == -1) {
- ! error_message (txt_nntp_to_fd_cannot_reopen, fnam);
- X return -1;
- X }
- X
- --- 509,515 ----
- X }
- X
- X if ((fd = open (fnam, 0)) == -1) {
- ! perror_message (txt_nntp_to_fd_cannot_reopen, fnam);
- X return -1;
- X }
- X
- Only in .: open.o
- diff -rcs ../111/page.c ./page.c
- *** ../111/page.c Fri Mar 27 14:00:58 1992
- --- ./page.c Thu Mar 26 15:05:39 1992
- ***************
- *** 138,146 ****
- X goto restart;
- X
- X case '|': /* pipe article/thread/tagged arts to command */
- - set_real_uid_gid ();
- X feed_articles (FEED_PIPE, PAGE_LEVEL, "Pipe", respnum, group_path);
- - set_tin_uid_gid ();
- X break;
- X
- X case '/': /* search forwards in article */
- --- 138,144 ----
- ***************
- *** 427,435 ****
- X /* NOTREACHED */
- X
- X case 'm': /* mail article/thread/tagged articles to somebody */
- - set_real_uid_gid ();
- X feed_articles (FEED_MAIL, PAGE_LEVEL, "Mail", respnum, group_path);
- - set_tin_uid_gid ();
- X break;
- X
- X case 'M': /* options menu */
- --- 425,431 ----
- ***************
- *** 460,468 ****
- X break;
- X
- X case 'o': /* output art/thread/tagged arts to printer */
- - set_real_uid_gid ();
- X feed_articles (FEED_PRINT, PAGE_LEVEL, "Print", respnum, group_path);
- - set_tin_uid_gid ();
- X break;
- X
- X case 'p': /* previous article */
- --- 456,462 ----
- ***************
- *** 498,506 ****
- X break;
- X
- X case 's': /* save article/thread/tagged articles */
- - set_real_uid_gid ();
- X feed_articles (FEED_SAVE, PAGE_LEVEL, "Save", respnum, group_path);
- - set_tin_uid_gid ();
- X break;
- X
- X case 't': /* return to group selection page */
- --- 492,498 ----
- Only in .: page.o
- Only in .: patch112.shar.01
- Only in .: patch112.shar.02
- Only in .: patch112.shar.03
- Only in .: patch112.shar.04
- diff -rcs ../111/patchlev.h ./patchlev.h
- *** ../111/patchlev.h Fri Mar 27 14:01:22 1992
- --- ./patchlev.h Sun Mar 29 16:46:56 1992
- ***************
- *** 3,9 ****
- X * Module : patchlev.h
- X * Author : I.Lea
- X * Created : 01-04-91
- ! * Updated : 22-03-92
- X * Notes :
- X * Copyright : (c) Copyright 1991-92 by Iain Lea
- X * You may freely copy or redistribute this software,
- --- 3,9 ----
- X * Module : patchlev.h
- X * Author : I.Lea
- X * Created : 01-04-91
- ! * Updated : 29-03-92
- X * Notes :
- X * Copyright : (c) Copyright 1991-92 by Iain Lea
- X * You may freely copy or redistribute this software,
- ***************
- *** 12,16 ****
- X * right notice, and it must be included in any copy made
- X */
- X
- ! #define VERSION "1.1" /* Beta versions are "1.n Beta" */
- ! #define PATCHLEVEL 1
- --- 12,17 ----
- X * right notice, and it must be included in any copy made
- X */
- X
- ! #define VERSION "1.1" /* Beta versions are "1.n Beta" */
- ! #define PATCHLEVEL 2
- ! #define COMPILED "Sun Mar 29 15:47:11 CET 1992"
- Only in .: patchlev.h.old
- diff -rcs ../111/post.c ./post.c
- *** ../111/post.c Fri Mar 27 14:00:59 1992
- --- ./post.c Sat Mar 28 13:05:32 1992
- ***************
- *** 3,9 ****
- X * Module : post.c
- X * Author : I.Lea
- X * Created : 01-04-91
- ! * Updated : 22-03-92
- X * Notes : mailing/posting/replying/followup & cancel article routines
- X * Copyright : (c) Copyright 1991-92 by Iain Lea
- X * You may freely copy or redistribute this software,
- --- 3,9 ----
- X * Module : post.c
- X * Author : I.Lea
- X * Created : 01-04-91
- ! * Updated : 28-03-92
- X * Notes : mailing/posting/replying/followup & cancel article routines
- X * Copyright : (c) Copyright 1991-92 by Iain Lea
- X * You may freely copy or redistribute this software,
- ***************
- *** 35,45 ****
- X int i, j, k;
- X int no_of_lines = 0;
- X
- - set_real_uid_gid ();
- -
- X if ((fp = fopen (postfile, "r")) == NULL) {
- X clear_message ();
- - set_tin_uid_gid ();
- X return FALSE;
- X } else {
- X while (fgets (buf, sizeof (buf), fp) != NULL) {
- --- 35,42 ----
- ***************
- *** 84,90 ****
- X posted[i].subj[k++] = '\0';
- X }
- X fclose (fp);
- - set_tin_uid_gid ();
- X
- X show_info_page (POST_INFO, (char **) 0, txt_post_history_menu);
- X if (posted != (struct posted_t *) 0) {
- --- 81,86 ----
- ***************
- *** 108,115 ****
- X
- X sprintf (tmp_post, "%s.%d", postfile, process_id);
- X
- - set_real_uid_gid ();
- -
- X if ((tmp_fp = fopen (tmp_post, "w")) != NULL) {
- X time (&epoch);
- X tm = localtime (&epoch);
- --- 104,109 ----
- ***************
- *** 128,137 ****
- X }
- X fclose (tmp_fp);
- X }
- - set_tin_uid_gid ();
- X }
- X
- X /*
- X * Post an original article (not a followup)
- X */
- X
- --- 122,191 ----
- X }
- X fclose (tmp_fp);
- X }
- X }
- X
- X /*
- + * Check the article file so that it is not missing the blank line
- + * between the header information and the text.
- + */
- +
- + int post_header_ok (article)
- + char* article;
- + {
- + FILE *fp;
- + char line[LEN];
- + int cnt= 0;
- + int len, ind;
- + char prev_ch;
- + int header;
- +
- + if ((fp = fopen (article, "r")) == NULL) {
- + perror_message (txt_cannot_open, article);
- + return FALSE;
- + }
- +
- + while (fgets (line, LEN, fp) != NULL) {
- + cnt++;
- + len= strlen (line);
- + if (len > 0)
- + if (line[len - 1] == '\n')
- + line[--len]= 0;
- +
- + if ((len == 0) && (cnt >= 2)) {
- + fclose(fp);
- + return TRUE;
- + }
- + prev_ch= ' ';
- + header= FALSE;
- + for (ind= 0; ind < len; ind++) /* Skip white space */
- + if ((line[ind] != ' ') && (line[ind] != '\t'))
- + break;
- + for (; ind < len; ind++) {
- + /* Header as long as the first token ends with ':' */
- + if (((ind == len - 1) &&
- + (line[ind] == ':')) ||
- + (((line[ind] == ' ') ||
- + (line[ind] == '\t')) &&
- + (prev_ch == ':'))) {
- + header= TRUE;
- + break;
- + }
- +
- + if ((line[ind] == ' ') ||
- + (line[ind] == '\t'))
- + break;
- + prev_ch= line[ind];
- + }
- + if (! header) {
- + fclose (fp);
- + return FALSE;
- + }
- + }
- + fclose (fp);
- + return FALSE;
- + }
- +
- + /*
- X * Post an original article (not a followup)
- X */
- X
- ***************
- *** 147,153 ****
- X int redraw_screen = FALSE;
- X
- X *posted = FALSE;
- ! start_line_offset = 4;
- X
- X if (active[my_group[cur_groupnum]].moderated == 'm') {
- X sprintf (msg, "Group %s is moderated. Continue? (y/n): ", group);
- --- 201,207 ----
- X int redraw_screen = FALSE;
- X
- X *posted = FALSE;
- ! start_line_offset = 5;
- X
- X if (active[my_group[cur_groupnum]].moderated == 'm') {
- X sprintf (msg, "Group %s is moderated. Continue? (y/n): ", group);
- ***************
- *** 177,187 ****
- X
- X wait_message (txt_post_an_article);
- X
- - set_real_uid_gid ();
- -
- X if ((fp = fopen (article, "w")) == NULL) {
- ! error_message (txt_cannot_open, article);
- ! set_tin_uid_gid ();
- X return (redraw_screen);
- X }
- X chmod (article, 0600);
- --- 231,238 ----
- X
- X wait_message (txt_post_an_article);
- X
- X if ((fp = fopen (article, "w")) == NULL) {
- ! perror_message (txt_cannot_open, article);
- X return (redraw_screen);
- X }
- X chmod (article, 0600);
- ***************
- *** 188,194 ****
- X
- X fprintf (fp, "Subject: %s\n", subj);
- X fprintf (fp, "Newsgroups: %s\n", group);
- - fprintf (fp, "Distribution: \n");
- X if (*my_org) {
- X fprintf (fp, "Organization: %s\n", my_org);
- X start_line_offset++;
- --- 239,244 ----
- ***************
- *** 197,202 ****
- --- 247,253 ----
- X fprintf (fp, "Reply-To: %s\n", reply_to);
- X start_line_offset++;
- X }
- + fprintf (fp, "Distribution: \n\n");
- X fprintf (fp, "\n");
- X
- X add_signature (fp, FALSE);
- ***************
- *** 207,222 ****
- X switch (ch) {
- X case 'e':
- X invoke_editor (article);
- ! set_real_uid_gid ();
- X redraw_screen = TRUE;
- ! break;
- !
- X case 'a':
- X case ESC:
- X if (unlink_article)
- X unlink (article);
- X clear_message ();
- - set_tin_uid_gid ();
- X return (redraw_screen);
- X
- X case 'p':
- --- 258,285 ----
- X switch (ch) {
- X case 'e':
- X invoke_editor (article);
- ! while (! post_header_ok(article)) {
- ! do {
- ! sprintf (msg, "%s%c", txt_no_blank_line, 'e');
- ! wait_message (msg);
- ! MoveCursor (LINES, (int) strlen (txt_no_blank_line));
- ! if ((ch = (char) ReadCh ()) == CR)
- ! ch = 'e';
- ! } while (ch != ESC && ch != 'a' && ch != 'e');
- ! if (ch == 'e')
- ! invoke_editor (article);
- ! else
- ! break;
- ! }
- X redraw_screen = TRUE;
- ! if (ch == 'e') {
- ! break;
- ! }
- X case 'a':
- X case ESC:
- X if (unlink_article)
- X unlink (article);
- X clear_message ();
- X return (redraw_screen);
- X
- X case 'p':
- ***************
- *** 230,236 ****
- X sprintf (buf, txt_art_rejected, dead_article);
- X info_message (buf);
- X sleep (3);
- - set_tin_uid_gid ();
- X return (redraw_screen);
- X }
- X }
- --- 293,298 ----
- ***************
- *** 248,254 ****
- X find_mail_header (HEADER_SUBJECT, article, subj);
- X if (unlink_article)
- X unlink (article);
- - set_tin_uid_gid ();
- X update_art_posted_file (group, subj);
- X return (redraw_screen);
- X }
- --- 310,315 ----
- ***************
- *** 298,308 ****
- X }
- X }
- X
- - set_real_uid_gid ();
- -
- X if ((fp = fopen (article, "w")) == NULL) {
- ! error_message (txt_cannot_open, article);
- ! set_tin_uid_gid ();
- X return (ret_code);
- X }
- X chmod (article, 0600);
- --- 359,366 ----
- X }
- X }
- X
- X if ((fp = fopen (article, "w")) == NULL) {
- ! perror_message (txt_cannot_open, article);
- X return (ret_code);
- X }
- X chmod (article, 0600);
- ***************
- *** 314,323 ****
- X } else {
- X fprintf (fp, "Newsgroups: %s\n", note_h_newsgroups);
- X }
- ! if (note_h_distrib != '\0') {
- ! fprintf (fp, "Distribution: %s\n", note_h_distrib);
- ! start_line_offset++;
- ! }
- X fprintf (fp, "References: %s\n", note_h_messageid);
- X
- X if (*my_org) {
- --- 372,378 ----
- X } else {
- X fprintf (fp, "Newsgroups: %s\n", note_h_newsgroups);
- X }
- !
- X fprintf (fp, "References: %s\n", note_h_messageid);
- X
- X if (*my_org) {
- ***************
- *** 328,333 ****
- --- 383,392 ----
- X fprintf (fp, "Reply-To: %s\n", reply_to);
- X start_line_offset++;
- X }
- + if (note_h_distrib != '\0') {
- + fprintf (fp, "Distribution: %s\n", note_h_distrib);
- + start_line_offset++;
- + }
- X fprintf (fp, "\n");
- X
- X if (copy_text) { /* if "copy_text" */
- ***************
- *** 350,356 ****
- X switch (ch) {
- X case 'e':
- X invoke_editor (article);
- - set_real_uid_gid ();
- X ret_code = POSTED_REDRAW;
- X break;
- X
- --- 409,414 ----
- ***************
- *** 359,365 ****
- X if (unlink_article)
- X unlink (article);
- X clear_message ();
- - set_tin_uid_gid ();
- X return (ret_code);
- X
- X case 'p':
- --- 417,422 ----
- ***************
- *** 373,379 ****
- X sprintf (buf, txt_art_rejected, dead_article);
- X info_message (buf);
- X sleep (3);
- - set_tin_uid_gid ();
- X return (ret_code);
- X }
- X }
- --- 430,435 ----
- ***************
- *** 397,405 ****
- X }
- X
- X if (unlink_article) {
- - set_real_uid_gid ();
- X unlink (article);
- - set_tin_uid_gid ();
- X }
- X
- X return (ret_code);
- --- 453,459 ----
- ***************
- *** 423,434 ****
- X strcpy (mail_to, address);
- X clear_message ();
- X
- - set_real_uid_gid ();
- -
- X sprintf (nam, "%s/.letter", homedir);
- X if ((fp = fopen (nam, "w")) == NULL) {
- ! error_message (txt_cannot_open, nam);
- ! set_tin_uid_gid ();
- X return (redraw_screen);
- X }
- X chmod (nam, 0600);
- --- 477,485 ----
- X strcpy (mail_to, address);
- X clear_message ();
- X
- X sprintf (nam, "%s/.letter", homedir);
- X if ((fp = fopen (nam, "w")) == NULL) {
- ! perror_message (txt_cannot_open, nam);
- X return (redraw_screen);
- X }
- X chmod (nam, 0600);
- ***************
- *** 470,476 ****
- X switch (ch) {
- X case 'e':
- X invoke_editor (nam);
- - set_real_uid_gid ();
- X redraw_screen = TRUE;
- X break;
- X
- --- 521,526 ----
- ***************
- *** 478,484 ****
- X case ESC:
- X unlink (nam);
- X clear_message ();
- - set_tin_uid_gid ();
- X return (redraw_screen);
- X
- X case 's':
- --- 528,533 ----
- ***************
- *** 501,509 ****
- X }
- X
- X mail_to_someone_done:
- - set_real_uid_gid ();
- X unlink (nam);
- - set_tin_uid_gid ();
- X
- X return (redraw_screen);
- X }
- --- 550,556 ----
- ***************
- *** 529,540 ****
- X
- X wait_message (txt_mail_bug_report);
- X
- - set_real_uid_gid ();
- -
- X sprintf (nam, "%s/.bugreport", homedir);
- X if ((fp = fopen (nam, "w")) == NULL) {
- ! error_message (txt_cannot_open, nam);
- SHAR_EOF
- true || echo 'restore of tin.patch112 failed'
- fi
- echo 'End of tin part 2'
- echo 'File tin.patch112 is continued in part 3'
- echo 3 > _shar_seq_.tmp
- exit 0
- --
- Dr. med. dipl.-math Dieter Becker Tel.: (0 / +49) 6841 - 16 3046
- Medizinische Universitaets- und Poliklinik Fax.: (0 / +49) 6841 - 16 3369
- Innere Medizin III
- D - 6650 Homburg / Saar Email: becker@med-in.uni-sb.de
- exit 0 # Just in case...
-