home *** CD-ROM | disk | FTP | other *** search
- Path: wupost!uunet!mcsun!unido!estevax!norisc!iain
- From: iain@norisc.UUCP (Iain Lea)
- Newsgroups: alt.sources
- Subject: tin v1.00 - YAN (Yet Another Newsreader) Part 05/08
- Message-ID: <586@norisc.UUCP>
- Date: 23 Aug 91 13:54:45 GMT
- Sender: iain@norisc.UUCP (Iain Lea)
- Organization: What organization?
- Lines: 2054
-
- Submitted-by: iain@estevax.uucp
- Archive-name: tin/part05
-
- #!/bin/sh
- # this is tin.shar.05 (part 5 of tin)
- # do not concatenate these parts, unpack them in order with /bin/sh
- # file page.c continued
- #
- if touch 2>&1 | fgrep '[-amc]' > /dev/null
- then TOUCH=touch
- else TOUCH=true
- fi
- if test ! -r shar3_seq_.tmp; then
- echo "Please unpack part 1 first!"
- exit 1
- fi
- (read Scheck
- if test "$Scheck" != 5; then
- echo "Please unpack part $Scheck next!"
- exit 1
- else
- exit 0
- fi
- ) < shar3_seq_.tmp || exit 1
- echo "x - Continuing file page.c"
- sed 's/^X//' << 'SHAR_EOF' >> page.c &&
- X arts[respnum].unread = ART_WILL_RETURN;
- X info_message(txt_art_marked_as_unread);
- X break;
- X
- X default:
- X info_message(txt_bad_command);
- X }
- X }
- X}
- X
- X
- Xvoid redraw_page(respnum, group)
- X int respnum;
- X char *group;
- X{
- X
- X if (note_page == NOTE_UNAVAIL) {
- X ClearScreen();
- X printf(txt_art_unavailable, arts[respnum].artnum);
- X fflush(stdout);
- X } else if (note_page > 0) {
- X note_page--;
- X fseek(note_fp, note_mark[note_page], 0);
- X show_note_page(respnum, group);
- X }
- X}
- X
- X
- Xvoid show_note_page (respnum, group)
- X int respnum;
- X char *group;
- X{
- X char buf[LEN+1];
- X char buf2[LEN+50];
- X int percent;
- X char *p, *q;
- X int i, j;
- X int ctrl_L; /* form feed character detected */
- X
- X ClearScreen();
- X
- X note_line = 1;
- X
- X if (note_page == 0)
- X show_first_header (respnum, group);
- X else
- X show_cont_header (respnum);
- X
- X ctrl_L = FALSE;
- X while (note_line < LINES) {
- X if (fgets(buf, LEN, note_fp) == NULL) {
- X note_end = TRUE;
- X break;
- X }
- X
- X buf[LEN-1] = '\0';
- X if (rotate)
- X for (p = buf, q = buf2;
- X *p && *p != '\n' && q<&buf2[LEN]; p++) {
- X if (*p == '\b' && q > buf2) {
- X q--;
- X } else if (*p == 12) { /* ^L */
- X *q++ = '^';
- X *q++ = 'L';
- X ctrl_L = TRUE;
- X } else if (*p == '\t') {
- X i = q - buf2;
- X j = (i|7) + 1;
- X
- X while (i++ < j)
- X *q++ = ' ';
- X } else if (((*p) & 0x7F) < 32) {
- X *q++ = '^';
- X *q++ = ((*p) & 0x7F) + '@';
- X } else if (*p >= 'A' && *p <= 'Z')
- X *q++ = 'A' + (*p - 'A' + rotate) % 26;
- X else if (*p >= 'a' && *p <= 'z')
- X *q++ = 'a' + (*p - 'a' + rotate) % 26;
- X else
- X *q++ = *p;
- X }
- X else
- X for (p = buf, q = buf2;
- X *p && *p != '\n' && q<&buf2[LEN]; p++) {
- X if (*p == '\b' && q > buf2) {
- X q--;
- X } else if (*p == 12) { /* ^L */
- X *q++ = '^';
- X *q++ = 'L';
- X ctrl_L = TRUE;
- X } else if (*p == '\t') {
- X i = q - buf2;
- X j = (i|7) + 1;
- X
- X while (i++ < j)
- X *q++ = ' ';
- X } else if (((*p) & 0x7F) < 32) {
- X *q++ = '^';
- X *q++ = ((*p) & 0x7F) + '@';
- X } else
- X *q++ = *p;
- X }
- X
- X *q = '\0';
- X
- X printf("%s\r\n", buf2);
- X
- X note_line += ((int) strlen (buf2) / COLS) + 1;
- X
- X if (ctrl_L) {
- X break;
- X }
- X }
- X
- X note_mark[++note_page] = ftell(note_fp);
- X
- X StartInverse();
- X
- X if (note_end) {
- X MoveCursor(LINES, MORE_POS-5);
- X if (arts[respnum].thread != -1)
- X printf(txt_next_resp);
- X else
- X printf(txt_last_resp);
- X } else {
- X if (note_size > 0) {
- X percent = note_mark[note_page] * 100 / note_size;
- X sprintf (buf, "%s(%d%%) [%ld/%ld]", txt_more, percent, note_mark[note_page], note_size);
- X MoveCursor (LINES, (COLS - (int) strlen (buf))-1);
- X CleartoEOLN ();
- X printf ("%s", buf);
- X } else {
- X MoveCursor(LINES, MORE_POS);
- X printf(txt_more);
- X }
- X }
- X
- X EndInverse();
- X
- X fflush(stdout);
- X}
- X
- X
- Xvoid show_first_header (respnum, group)
- X int respnum;
- X char *group;
- X{
- X int whichresp;
- X int x_resp;
- X char buf[LEN+1];
- X char tmp[LEN+1];
- X int pos, i;
- X int n;
- X
- X whichresp = which_resp (respnum);
- X x_resp = nresp (which_base (respnum));
- X
- X ClearScreen ();
- X
- X strcpy (buf, note_h_date);
- X pos = (COLS - (int) strlen (group)) / 2;
- X for (i = strlen(buf); i < pos; i++)
- X buf[i] = ' ';
- X buf[i] = '\0';
- X
- X strcat (buf, group);
- X
- X for (i = strlen(buf); i < RIGHT_POS; i++)
- X buf[i] = ' ';
- X buf[i] = '\0';
- X
- X printf (txt_note_x_of_n, buf, which_base (respnum) + 1, top_base);
- X
- X sprintf (buf, txt_art, arts[respnum].artnum);
- X n = strlen (buf);
- X fputs (buf, stdout);
- X
- X strcpy (buf, note_h_subj);
- X buf[RIGHT_POS - 2 - n] = '\0';
- X
- X pos = ((COLS - (int) strlen (buf)) / 2) - 2;
- X
- X if (pos > n) {
- X MoveCursor (1, pos);
- X } else {
- X MoveCursor (1, n);
- X }
- X
- X StartInverse ();
- X fputs (buf, stdout);
- X EndInverse ();
- X
- X MoveCursor (1, RIGHT_POS);
- X if (whichresp)
- X printf (txt_resp_x_of_n, whichresp, x_resp);
- X else {
- X if (x_resp == 0)
- X printf (txt_no_resp);
- X else if (x_resp == 1)
- X printf (txt_1_resp);
- X else
- X printf (txt_x_resp, x_resp);
- X }
- X
- X if (*note_h_org)
- X sprintf (tmp, txt_s_at_s, note_full_name, note_h_org);
- X else
- X strcpy (tmp, note_full_name);
- X
- X tmp[LEN] = '\0';
- X
- X sprintf (buf, "%s ", note_from_addr);
- X
- X pos = COLS - 1 - (int) strlen(tmp);
- X if ((int) strlen (buf) + (int) strlen (tmp) >= COLS - 1) {
- X strncat (buf, tmp, COLS - 1 - (int) strlen(buf));
- X buf[COLS - 1] = '\0';
- X } else {
- X for (i = strlen(buf); i < pos; i++)
- X buf[i] = ' ';
- X buf[i] = '\0';
- X strcat (buf, tmp);
- X }
- X printf ("%s\r\n\r\n", buf);
- X
- X note_line += 4;
- X}
- X
- X
- Xvoid show_cont_header (respnum)
- X int respnum;
- X{
- X int whichresp;
- X int whichbase;
- X char buf[LEN+1];
- X
- X whichresp = which_resp (respnum);
- X whichbase = which_base (respnum);
- X
- X assert (whichbase < top_base);
- X
- X if (whichresp)
- X sprintf(buf, txt_note_resp_page,
- X whichbase + 1,
- X top_base,
- X whichresp,
- X note_page + 1,
- X note_h_subj);
- X else
- X sprintf(buf, txt_note_page,
- X whichbase + 1,
- X top_base,
- X note_page + 1,
- X note_h_subj);
- X
- X buf[COLS] = '\0';
- X printf("%s\r\n\r\n", buf);
- X
- X note_line += 2;
- X}
- X
- X
- Xvoid open_note (art, group_path)
- X long art;
- X char *group_path;
- X{
- X char buf[1025];
- X char *p;
- X
- X note_page = 0;
- X
- X if ((note_fp = open_art_fp (group_path, art)) == NULL) {
- X note_page = NOTE_UNAVAIL;
- X return;
- X }
- X
- X note_h_from[0] = '\0';
- X note_h_path[0] = '\0';
- X note_h_subj[0] = '\0';
- X note_h_org[0] = '\0';
- X note_h_date[0] = '\0';
- X note_h_newsgroups[0] = '\0';
- X note_h_messageid[0] = '\0';
- X note_h_distrib[0] = '\0';
- X note_h_followup[0] = '\0';
- X
- X while (fgets(buf, 1024, note_fp) != NULL) {
- X buf[1024] = '\0';
- X
- X for (p=buf ; *p && *p != '\n' ; p++) {
- X if (((*p) & 0x7F) < 32)
- X *p = ' ';
- X }
- X *p = '\0';
- X
- X if (*buf == '\0')
- X break;
- X
- X if (strncmp(buf, "From: ", 6) == 0) {
- X strcpy(note_h_from, &buf[6]);
- X note_h_from[LEN-1] = '\0';
- X } else if (strncmp(buf, "Path: ", 6) == 0) {
- X strcpy(note_h_path, &buf[6]);
- X note_h_path[LEN-1] = '\0';
- X } else if (strncmp(buf, "Subject: ", 9) == 0) {
- X strcpy(note_h_subj, &buf[9]);
- X note_h_subj[LEN-1] = '\0';
- X } else if (strncmp(buf, "Organization: ", 14) == 0) {
- X strcpy(note_h_org, &buf[14]);
- X note_h_org[LEN-1] = '\0';
- X } else if (strncmp(buf, "Date: ", 6) == 0) {
- X strcpy(note_h_date, &buf[6]);
- X note_h_date[LEN-1] = '\0';
- X } else if (strncmp(buf, "Newsgroups: ", 12) == 0) {
- X strcpy(note_h_newsgroups, &buf[12]);
- X note_h_newsgroups[LEN-1] = '\0';
- X } else if (strncmp(buf, "Message-ID: ", 12) == 0) {
- X strcpy(note_h_messageid, &buf[12]);
- X note_h_messageid[LEN-1] = '\0';
- X } else if (strncmp(buf, "Distribution: ", 14) == 0) {
- X strcpy(note_h_distrib, &buf[14]);
- X note_h_distrib[LEN-1] = '\0';
- X } else if (strncmp(buf, "Followup-To: ", 13) == 0) {
- X strcpy(note_h_followup, &buf[13]);
- X note_h_followup[LEN-1] = '\0';
- X }
- X }
- X
- X note_page = 0;
- X note_mark[0] = ftell (note_fp);
- X
- X parse_from (note_h_from, note_from_addr, note_full_name);
- X note_end = FALSE;
- X
- X return;
- X}
- X
- X
- Xvoid note_cleanup()
- X{
- X if (note_page != NOTE_UNAVAIL)
- X fclose(note_fp);
- X}
- X
- X
- Xint prompt_response(ch, respnum)
- X int respnum;
- X{
- X int num;
- X
- X clear_message ();
- X
- X if ((num = parse_num (ch, txt_read_resp)) == -1) {
- X clear_message ();
- X return -1;
- X }
- X
- X return choose_resp (which_base (respnum), num);
- X}
- X
- X/*
- X * return response number n from thread i
- X */
- X
- Xint choose_resp (i, n)
- X int i;
- X int n;
- X{
- X int j;
- X
- X j = base[i];
- X
- X while (n-- && arts[j].thread >= 0) {
- X j = arts[j].thread;
- X }
- X
- X return j;
- X}
- X
- X
- X/*
- X * Parse various From: lines into the component mail addresses and
- X * real names
- X */
- X
- Xvoid parse_from (str, addr, name)
- X char *str;
- X char *addr;
- X char *name;
- X{
- X char *p;
- X
- X for (p=str ; *p ; p++) {
- X if (((*p) & 0x7F) < 32)
- X *p = ' ';
- X }
- X
- X while (*str && *str != ' ')
- X *addr++ = *str++;
- X *addr = '\0';
- X if (*str++ == ' ') {
- X if (*str++ == '(') {
- X if (*str == '"')
- X str++; /* Kill "quotes around names" */
- X /* But don't touch quotes inside the */
- X /* Name (that's what that nonsense */
- X /* below is for */
- X while (*str && *str != ')' && !(*str=='"'&&str[1]==')'))
- X *name++ = *str++;
- X }
- X }
- X *name = '\0';
- X}
- X
- X
- X/*
- X * Find the previous response. Go to the last response in the previous
- X * thread if we go past the beginning of this thread.
- X */
- X
- Xint prev_response (n)
- X int n;
- X{
- X int resp;
- X int i;
- X
- X resp = which_resp (n);
- X
- X if (resp > 0)
- X return choose_resp (which_base (n), resp-1);
- X
- X i = which_base (n) - 1;
- X
- X if (i < 0)
- X return -1;
- X
- X return choose_resp (i, nresp (i));
- X}
- X
- X
- X/*
- X * Find the next response. Go to the next basenote if there
- X * are no more responses in this thread
- X */
- X
- Xint next_response (n)
- X int n;
- X{
- X int i;
- X
- X if (arts[n].thread >= 0)
- X return arts[n].thread;
- X
- X i = which_base (n) + 1;
- X
- X if (i >= top_base)
- X return -1;
- X
- X return base[i];
- X}
- X
- X
- X/*
- X * Given a respnum (index into arts[]), find the respnum of the
- X * next basenote
- X */
- X
- Xint next_basenote (n)
- X int n;
- X{
- X int i;
- X
- X i = which_base (n) + 1;
- X if (i >= top_base)
- X return -1;
- X
- X return base[i];
- X}
- X
- X
- Xvoid yank_to_addr (orig, addr)
- X char *orig;
- X char *addr;
- X{
- X char *p;
- X
- X for (p = orig; *p; p++)
- X if (((*p) & 0x7F) < 32)
- X *p = ' ';
- X
- X while (*addr)
- X addr++;
- X
- X while (*orig) {
- X while (*orig && (*orig == ' ' || *orig == '"' || *orig == ','))
- X orig++;
- X *addr++ = ' ';
- X while (*orig && (*orig != ' ' && *orig != ',' && *orig != '"'))
- X *addr++ = *orig++;
- X while (*orig && (*orig == ' ' || *orig == '"' || *orig == ','))
- X orig++;
- X if (*orig == '(') {
- X while (*orig && *orig != ')')
- X orig++;
- X if (*orig == ')')
- X orig++;
- X }
- X }
- X *addr = '\0';
- X}
- X
- X/*
- X * Read a file grabbing the address given for To: and
- X * sticking it in mail_to
- X */
- X
- Xvoid find_new_to (nam, mail_to)
- X char *nam;
- X char *mail_to;
- X{
- X FILE *fp;
- X char buf[LEN+1];
- X char buf2[LEN+1];
- X char new_mail_to[LEN+1];
- X char *p;
- X
- X *new_mail_to = '\0';
- X
- X if ((fp = fopen(nam, "r")) == NULL) {
- X fprintf(stderr, txt_cannot_open, nam);
- X return;
- X }
- X
- X while (fgets(buf, 1024, fp) != NULL) {
- X for (p = buf; *p && *p != '\n'; p++) ;
- X *p = '\0';
- X
- X if (*buf == '\0')
- X break;
- X
- X if (strncmp(buf, "To: ", 4) == 0) {
- X strncpy(buf2, &buf[4], LEN);
- X buf2[LEN-1] = '\0';
- X yank_to_addr(buf2, new_mail_to);
- X } else if (strncmp(buf, "Cc: ", 4) == 0) {
- X strncpy(buf2, &buf[4], LEN);
- X buf2[LEN-1] = '\0';
- X yank_to_addr(buf2, new_mail_to);
- X }
- X }
- X
- X fclose(fp);
- X if (new_mail_to[0] == ' ')
- X my_strncpy(mail_to, &new_mail_to[1], LEN);
- X else
- X my_strncpy(mail_to, new_mail_to, LEN);
- X}
- X
- X
- Xint mail_to_someone ()
- X{
- X char nam[100];
- X FILE *fp;
- X char ch;
- X char ch_default = 's';
- X char buf[LEN+1];
- X char mail_to[LEN+1];
- X
- X if (! parse_string (txt_mail_art_to, mail_to))
- X return FALSE;
- X if (mail_to[0] == '\0')
- X return FALSE;
- X
- X setuid (real_uid);
- X setgid (real_gid);
- X
- X sprintf(nam, "%s/.letter", homedir);
- X if ((fp = fopen(nam, "w")) == NULL) {
- X error_message (txt_cannot_open, nam);
- X setuid(tin_uid);
- X setgid(tin_gid);
- X return FALSE;
- X }
- X chmod(nam, 0600);
- X
- X fprintf(fp, "To: %s\n", mail_to);
- X fprintf(fp, "Subject: %s\n", note_h_subj);
- X if (*note_h_followup)
- X fprintf(fp, "Newsgroups: %s\n\n", note_h_followup);
- X else
- X fprintf(fp, "Newsgroups: %s\n", note_h_newsgroups);
- X if (*my_org)
- X fprintf(fp, "Organization: %s\n", my_org);
- X if (*reply_to)
- X fprintf(fp, "Reply-To: %s\n", reply_to);
- X fputs("\n", fp);
- X
- X fseek(note_fp, 0L, 0);
- X copy_fp(note_fp, fp, "");
- X
- X add_signature (fp, TRUE);
- X fclose(fp);
- X
- X while (1) {
- X do {
- X sprintf (msg, "%s%c", txt_abort_edit_send, ch_default);
- X wait_message (msg);
- X MoveCursor(LINES, strlen (txt_abort_edit_send));
- X if ((ch = ReadCh()) == CR)
- X ch = ch_default;
- X } while (ch != 'a' && ch != 'e' && ch != 's');
- X
- X switch (ch) {
- X case 'e':
- X start_line_offset = 5;
- X invoke_editor(nam);
- X break;
- X
- X case 'a':
- X clear_message();
- X setuid(tin_uid);
- X setgid(tin_gid);
- X return FALSE;
- X
- X case 's':
- X/*
- X * Open letter and get the To: line in case they changed it with
- X * the editor
- X */
- X find_new_to(nam, mail_to);
- X sprintf (msg, txt_mailing_to, mail_to);
- X wait_message (msg);
- X sprintf(buf, "%s \"%s\" < %s", mailer, mail_to, nam);
- X if (invoke_cmd(buf)) {
- X info_message(txt_message_sent);
- X goto mail_to_someone_done;
- X } else {
- X error_message (txt_command_failed_s, buf);
- X break;
- X }
- X }
- X }
- X
- Xmail_to_someone_done:
- X setuid(tin_uid);
- X setgid(tin_gid);
- X
- X return TRUE;
- X}
- X
- X
- Xint mail_bug_report ()
- X{
- X char nam[100];
- X FILE *fp;
- X char ch;
- X char ch_default = 's';
- X char buf[LEN+1];
- X char mail_to[LEN+1];
- X int start_line = 4;
- X
- X setuid (real_uid);
- X setgid (real_gid);
- X
- X sprintf (nam, "%s/.bugreport", homedir);
- X if ((fp = fopen (nam, "w")) == NULL) {
- X error_message (txt_cannot_open, nam);
- X setuid (tin_uid);
- X setgid (tin_gid);
- X return FALSE;
- X }
- X chmod(nam, 0600);
- X
- X fprintf (fp, "To: %s\n", BUG_REPORT_ADDRESS);
- X fprintf (fp, "Subject: BUG REPORT %s %s\n", progname, version);
- X if (*my_org) {
- X fprintf (fp, "Organization: %s\n", my_org);
- X start_line++;
- X }
- X if (*reply_to) {
- X fprintf (fp, "Reply-To: %s\n", reply_to);
- X start_line++;
- X }
- X fputs ("\n", fp);
- X
- X add_signature (fp, TRUE);
- X fclose (fp);
- X
- X ch = 'e';
- X while (1) {
- X switch (ch) {
- X case 'e':
- X start_line_offset = start_line;
- X invoke_editor (nam);
- X break;
- X
- X case 'a':
- X clear_message ();
- X unlink (nam);
- X setuid (tin_uid);
- X setgid (tin_gid);
- X return FALSE;
- X
- X case 's':
- X strcpy (mail_to, BUG_REPORT_ADDRESS);
- X find_new_to (nam, mail_to);
- X sprintf (msg, txt_mailing_to, mail_to);
- X wait_message (msg);
- X sprintf (buf, "%s \"%s\" < %s", mailer, mail_to, nam);
- X if (invoke_cmd (buf)) {
- X info_message (txt_message_sent);
- X goto mail_bug_report_done;
- X } else {
- X error_message (txt_command_failed_s, buf);
- X break;
- X }
- X }
- X
- X do {
- X sprintf (msg, "%s%c", txt_abort_edit_send, ch_default);
- X wait_message (msg);
- X MoveCursor (LINES, strlen (txt_abort_edit_send));
- X if ((ch = ReadCh ()) == CR)
- X ch = ch_default;
- X } while (ch != 'a' && ch != 'e' && ch != 's');
- X }
- X
- Xmail_bug_report_done:
- X unlink (nam);
- X
- X setuid (tin_uid);
- X setgid (tin_gid);
- X
- X return TRUE;
- X}
- X
- X
- Xint mail_to_author (copy_text)
- X int copy_text;
- X{
- X char nam[100];
- X FILE *fp;
- X char ch;
- X char ch_default = 's';
- X char buf[LEN+1];
- X char mail_to[LEN+1];
- X
- X setuid(real_uid);
- X setgid(real_gid);
- X
- X sprintf(nam, "%s/.letter", homedir);
- X if ((fp = fopen(nam, "w")) == NULL) {
- X error_message (txt_cannot_open, nam);
- X setuid(tin_uid);
- X setgid(tin_gid);
- X return(FALSE);
- X }
- X chmod(nam, 0600);
- X
- X fprintf(fp, "To: %s%s (%s)\n", note_from_addr, add_addr, note_full_name);
- X fprintf(fp, "Subject: Re: %s\n", eat_re(note_h_subj) );
- X fprintf(fp, "Newsgroups: %s\n", note_h_newsgroups);
- X if (*my_org)
- X fprintf(fp, "Organization: %s\n", my_org);
- X if (*reply_to)
- X fprintf(fp, "Reply-To: %s\n", reply_to);
- X fputs("\n", fp);
- X
- X if (copy_text) { /* if "copy_text" */
- X fprintf(fp, txt_in_art_you_write, note_h_messageid);
- X
- X fseek(note_fp, note_mark[0], 0);
- X copy_fp(note_fp, fp, "> ");
- X }
- X
- X add_signature (fp, TRUE);
- X fclose(fp);
- X
- X ch = 'e';
- X while (1) {
- X switch (ch) {
- X case 'e':
- X start_line_offset = 5;
- X invoke_editor(nam);
- X break;
- X
- X case 'a':
- X clear_message();
- X setuid(tin_uid);
- X setgid(tin_gid);
- X return FALSE;
- X
- X case 's':
- X strcpy(mail_to, note_from_addr);
- X find_new_to(nam, mail_to);
- X sprintf(msg, txt_mailing_to, mail_to);
- X wait_message (msg);
- X sprintf (buf, "%s \"%s\" < %s", mailer, mail_to, nam);
- X if (invoke_cmd (buf)) {
- X info_message (txt_message_sent);
- X goto mail_to_author_done;
- X } else {
- X error_message (txt_command_failed_s, buf);
- X break;
- X }
- X }
- X
- X do {
- X sprintf (msg, "%s%c", txt_abort_edit_send, ch_default);
- X wait_message (msg);
- X MoveCursor(LINES, strlen (txt_abort_edit_send));
- X if ((ch = ReadCh()) == CR)
- X ch = ch_default;
- X } while (ch != 'a' && ch != 'e' && ch != 's');
- X }
- X
- Xmail_to_author_done:
- X setuid(tin_uid);
- X setgid(tin_gid);
- X
- X return TRUE;
- X}
- X
- X
- Xint post_response (group, respnum)
- X char *group;
- X int respnum;
- X{
- X FILE *fp;
- X char nam[LEN+1];
- X char ch, *ptr;
- X char ch_default = 'p';
- X char buf[LEN+1];
- X
- X start_line_offset = 6;
- X
- X if (*note_h_followup && strcmp (note_h_followup, "poster") == 0) {
- X clear_message ();
- X if (! prompt_yn (LINES, txt_resp_to_poster, 'y')) {
- X return FALSE;
- X }
- X *note_h_followup = '\0';
- X } else if (*note_h_followup && strcmp(note_h_followup, group) != 0) {
- X MoveCursor (LINES/2, 0);
- X CleartoEOS ();
- X StartInverse ();
- X center_line ((LINES/2)+2, txt_resp_redirect);
- X EndInverse ();
- X MoveCursor ((LINES/2)+4, 0);
- X
- X printf (" ");
- X ptr = note_h_followup;
- X while (*ptr) {
- X if (*ptr != ',') {
- X putc (*ptr, stdout);
- X } else {
- X printf ("\r\n ");
- X }
- X fflush (stdout);
- X ptr++;
- X }
- X
- X if (! prompt_yn (LINES, txt_continue, 'y')) {
- X return FALSE;
- X }
- X }
- X
- X setuid(real_uid);
- X setgid(real_gid);
- X
- X sprintf(nam, "%s/.article", homedir);
- X if ((fp = fopen(nam, "w")) == NULL) {
- X error_message (txt_cannot_open, nam);
- X setuid(tin_uid);
- X setgid(tin_gid);
- X return FALSE;
- X }
- X chmod(nam, 0600);
- X
- X fprintf(fp, "Subject: Re: %s\n", eat_re(note_h_subj));
- X
- X if (*note_h_followup && strcmp(note_h_followup, "poster") != 0)
- X fprintf(fp, "Newsgroups: %s\n", note_h_followup);
- X else
- X fprintf(fp, "Newsgroups: %s\n", note_h_newsgroups);
- X
- X if (*my_org) {
- X fprintf(fp, "Organization: %s\n", my_org);
- X }
- X
- X if (*reply_to) {
- X fprintf(fp, "Reply-To: %s\n", reply_to);
- X start_line_offset++;
- X }
- X
- X if (note_h_distrib != '\0') {
- X fprintf(fp, "Distribution: %s\n", note_h_distrib);
- X start_line_offset++;
- X }
- X
- X fprintf(fp, "References: %s\n", note_h_messageid);
- X fprintf(fp, "\n");
- X
- X if (respnum) { /* if "copy_text" */
- X if (note_h_from[0]) {
- X fprintf(fp, txt_writes, note_h_from);
- X }
- X
- X fseek(note_fp, note_mark[0], 0);
- X copy_fp(note_fp, fp, "> ");
- X }
- X
- X add_signature (fp, FALSE);
- X fclose(fp);
- X
- X ch = 'e';
- X while (1) {
- X switch (ch) {
- X case 'e':
- X invoke_editor (nam);
- X break;
- X
- X case 'a':
- X clear_message ();
- X setuid (tin_uid);
- X setgid (tin_gid);
- X return FALSE;
- X
- X case 'p':
- X wait_message (txt_posting);
- X sprintf (buf, "%s/inews -h < %s", LIBDIR, nam);
- X if (invoke_cmd (buf)) {
- X info_message (txt_art_posted);
- X goto post_response_done;
- X } else {
- X error_message (txt_art_rejected, NULL);
- X break;
- X }
- X }
- X
- X do {
- X sprintf (msg, "%s%c", txt_abort_edit_post, ch_default);
- X wait_message (msg);
- X MoveCursor(LINES, strlen (txt_abort_edit_post));
- X if ((ch = ReadCh()) == CR)
- X ch = ch_default;
- X } while (ch != 'a' && ch != 'e' && ch != 'p');
- X }
- X
- Xpost_response_done:
- X setuid(tin_uid);
- X setgid(tin_gid);
- X
- X if (*note_h_followup && strcmp(note_h_followup, "poster") != 0)
- X update_art_posted_file (note_h_followup, note_h_subj);
- X else
- X update_art_posted_file (note_h_newsgroups, note_h_subj);
- X
- X return TRUE;
- X}
- X
- X
- Xvoid pipe_article()
- X{
- X char command[LEN+1];
- X FILE *fp;
- X
- X if (!parse_string(txt_pipe_to_command, command))
- X return;
- X if (command[0] == '\0')
- X return;
- X
- X Raw(FALSE);
- X
- X if ((fp = popen(command, "w")) == NULL) {
- X error_message (txt_command_failed_s, command);
- X goto pipe_article_done;
- X }
- X
- X fseek(note_fp, 0L, 0);
- X copy_fp(note_fp, fp, "");
- X pclose(fp);
- X
- Xpipe_article_done:
- X
- X Raw(TRUE);
- X continue_prompt();
- X}
- X
- X
- Xvoid print_article ()
- X{
- X char command[LEN+1];
- X FILE *fp;
- X
- X if (default_printer) {
- X sprintf (command, "%s -P%s > /dev/null 2>&1",
- X printer, get_val ("PRINTER","ps0"));
- X } else {
- X sprintf (command, "%s > /dev/null 2>&1", printer);
- X }
- X
- X if ((fp = popen(command, "w")) == NULL) {
- X info_message (txt_error_printing_art);
- X } else {
- X wait_message (txt_printing);
- X if (print_header) {
- X fseek(note_fp, 0L, 0);
- X } else {
- X fprintf (fp, "From: %s\n", note_h_from);
- X fprintf (fp, "Subject: %s\n\n", note_h_subj);
- X fseek (note_fp, note_mark[0], 0);
- X }
- X copy_fp(note_fp, fp, "");
- X pclose(fp);
- X fseek(note_fp, note_mark[note_page], 0);
- X info_message (txt_art_printed);
- X }
- X}
- X
- X
- Xvoid print_thread (respnum, group_path)
- X int respnum;
- X char *group_path;
- X{
- X char command[LEN+1];
- X FILE *fp;
- X int b;
- X int i;
- X
- X b = which_base (respnum);
- X
- X if (default_printer) {
- X sprintf (command, "%s -P%s > /dev/null 2>&1",
- X printer, get_val ("PRINTER","ps0"));
- X } else {
- X sprintf (command, "%s > /dev/null 2>&1", printer);
- X }
- X
- X for (i = base[b]; i >= 0; i = arts[i].thread) {
- X if ((fp = popen(command, "w")) == NULL) {
- X info_message (txt_error_printing_thread);
- X break;
- X } else {
- X note_cleanup();
- X wait_message (txt_printing);
- X open_note(arts[i].artnum, group_path);
- X
- X if (print_header) {
- X fseek(note_fp, 0L, 0);
- X } else {
- X fprintf (fp, "From: %s\n", note_h_from);
- X fprintf (fp, "Subject: %s\n\n", note_h_subj);
- X fseek (note_fp, note_mark[0], 0);
- X }
- X copy_fp(note_fp, fp, "");
- X
- X pclose(fp);
- X }
- X info_message (txt_thread_printed);
- X }
- X
- X open_note(arts[respnum].artnum, group_path);
- X fseek(note_fp, note_mark[note_page], 0);
- X}
- X
- X
- Xint show_last_page ()
- X{
- X char buf[LEN+1];
- X char buf2[LEN+50];
- X char *p, *q;
- X int ctrl_L; /* form feed character detected */
- X int i, j;
- X
- X if (note_end) {
- X return FALSE;
- X }
- X
- X while (! note_end) {
- X note_line = 1;
- X ctrl_L = FALSE;
- X
- X if (note_page == 0) {
- X note_line += 4;
- X } else {
- X note_line += 2;
- X }
- X while (note_line < LINES) {
- X if (fgets(buf, LEN, note_fp) == NULL) {
- X note_end = TRUE;
- X break;
- X }
- X buf[LEN-1] = '\0';
- X for (p = buf, q = buf2; *p && *p != '\n' && q<&buf2[LEN]; p++) {
- X if (*p == '\b' && q > buf2) {
- X q--;
- X } else if (*p == 12) { /* ^L */
- X *q++ = '^';
- X *q++ = 'L';
- X ctrl_L = TRUE;
- X } else if (*p == '\t') {
- X i = q - buf2;
- X j = (i|7) + 1;
- X
- X while (i++ < j) {
- X *q++ = ' ';
- X }
- X } else if (((*p) & 0x7F) < 32) {
- X *q++ = '^';
- X *q++ = ((*p) & 0x7F) + '@';
- X } else {
- X *q++ = *p;
- X }
- X }
- X *q = '\0';
- X note_line += ((int) strlen (buf2) / COLS) + 1;
- X
- X if (ctrl_L) {
- X break;
- X }
- X }
- X if (! note_end) {
- X note_mark[++note_page] = ftell(note_fp);
- X }
- X }
- X fseek (note_fp, note_mark[note_page], 0);
- X return TRUE;
- X}
- SHAR_EOF
- echo "File page.c is complete" &&
- $TOUCH -am 0822180591 page.c &&
- chmod 0600 page.c ||
- echo "restore of page.c failed"
- set `wc -c page.c`;Wc_c=$1
- if test "$Wc_c" != "34638"; then
- echo original size 34638, current size $Wc_c
- fi
- # ============= posted.c ==============
- echo "x - extracting posted.c (Text)"
- sed 's/^X//' << 'SHAR_EOF' > posted.c &&
- X/*
- X * Project : tin - a visual threaded usenet newsreader
- X * Module : posted.c
- X * Author : I.Lea
- X * Created : 01-04-91
- X * Updated : 19-08-91
- X * Release : 1.0
- X * Notes :
- X * Copyright : (c) Copyright 1991 by Iain Lea
- X * You may freely copy or redistribute this software,
- X * so long as there is no profit made from its use, sale
- X * trade or reproduction. You may not change this copy-
- X * right notice, and it must be included in any copy made
- X */
- X
- X#include "tin.h"
- X
- X
- Xint user_posted_messages ()
- X{
- X char buf[LEN+1];
- X FILE *fp;
- X int ch;
- X int i;
- X
- X if ((fp = fopen (postfile, "r")) != NULL) {
- X ClearScreen ();
- X printf("%s\r\n", nice_time()); /* time in upper left */
- X
- X StartInverse ();
- X center_line (1, txt_post_history_menu);
- X EndInverse ();
- X
- X MoveCursor(INDEX_TOP, 0);
- X for (i=1 ; fgets (buf, LEN, fp) != NULL ; ) {
- X if (buf[0] != '#') {
- X buf[strlen (buf)-1] = ' ';
- X buf[COLS-2] = '\0';
- X printf ("%s% *s\r\n", buf, (COLS - (int) strlen (buf))-2, " ");
- X i++;
- X }
- X if (i > NOTESLINES) {
- X center_line(LINES, txt_hit_any_key);
- X if ((ch = ReadCh()) != ' ') {
- X break;
- X }
- X clear_message ();
- X MoveCursor(INDEX_TOP, 0);
- X i=1;
- X }
- X }
- X fclose (fp);
- X
- X if (i != 1 && i < NOTESLINES) {
- X while (i <= NOTESLINES) {
- X MoveCursor((INDEX_TOP+i)-1, 0);
- X CleartoEOLN ();
- X i++;
- X }
- X center_line(LINES, txt_hit_any_key);
- X ch = ReadCh();
- X }
- X clear_note_area ();
- X return TRUE;
- X }
- X info_message (txt_no_arts_posted);
- X return FALSE;
- X}
- X
- X
- Xvoid update_art_posted_file (group, subj)
- X char *group;
- X char *subj;
- X{
- X char buf[LEN+1];
- X char tmp_post[LEN+1];
- X FILE *fp, *tmp_fp;
- X long epoch;
- X struct tm *tm;
- X
- X sprintf (tmp_post, "%s.%d", postfile, getpid ());
- X
- X setuid(real_uid);
- X setgid(real_gid);
- X
- X if ((tmp_fp = fopen (tmp_post, "w")) != NULL) {
- X time(&epoch);
- X tm = localtime (&epoch);
- X fprintf (tmp_fp, "%02d-%02d-%02d %-32s %-s\n",
- X tm->tm_mday, tm->tm_mon+1, tm->tm_year, group, subj);
- X fclose (tmp_fp);
- X }
- X
- X if ((tmp_fp = fopen (tmp_post, "a+")) != NULL) {
- X if ((fp = fopen (postfile, "r")) != NULL) {
- X while (fgets (buf, LEN, fp) != NULL) {
- X fprintf (tmp_fp, "%s", buf);
- X }
- X fclose (fp);
- X rename_file (tmp_post, postfile);
- X }
- X fclose (tmp_fp);
- X }
- X
- X setuid(tin_uid);
- X setgid(tin_gid);
- X}
- SHAR_EOF
- $TOUCH -am 0819114691 posted.c &&
- chmod 0600 posted.c ||
- echo "restore of posted.c failed"
- set `wc -c posted.c`;Wc_c=$1
- if test "$Wc_c" != "2328"; then
- echo original size 2328, current size $Wc_c
- fi
- # ============= prompt.c ==============
- echo "x - extracting prompt.c (Text)"
- sed 's/^X//' << 'SHAR_EOF' > prompt.c &&
- X/*
- X * Project : tin - a visual threaded usenet newsreader
- X * Module : prompt.c
- X * Author : R.Skrenta / I.Lea
- X * Created : 01-04-91
- X * Updated : 10-08-91
- X * Release : 1.0
- X * Notes :
- X * Copyright : (c) Copyright 1991 by Rich Skrenta & Iain Lea
- X * You may freely copy or redistribute this software,
- X * so long as there is no profit made from its use, sale
- X * trade or reproduction. You may not change this copy-
- X * right notice, and it must be included in any copy made
- X */
- X
- X#include "tin.h"
- X
- X/*
- X * parse_num
- X * get a number from the user
- X * Return -1 if missing or bad number typed
- X */
- X
- Xint parse_num (ch, prompt)
- X char ch;
- X char *prompt;
- X{
- X char buf[40];
- X int len;
- X int i;
- X int num;
- X
- X MoveCursor(LINES,0);
- X printf("%s %c",prompt,ch);
- X fflush(stdout);
- X buf[0] = ch;
- X buf[1] = '\0';
- X len = 1;
- X ch = ReadCh();
- X while (ch != '\n' && ch != '\r') {
- X if (ch == 8 || ch == 127) {
- X if (len) {
- X len--;
- X buf[len] = '\0';
- X putchar('\b');
- X putchar(' ');
- X putchar('\b');
- X } else {
- X MoveCursor(LINES, 0);
- X CleartoEOLN();
- X return(-1);
- X }
- X } else if (ch == 21) { /* control-U */
- X for (i = len;i>0;i--) {
- X putchar('\b');
- X putchar(' ');
- X putchar('\b');
- X }
- X buf[0] = '\0';
- X len = 0;
- X } else if (ch >= '0' && ch <= '9' && len < 4) {
- X buf[len++] = ch;
- X buf[len] = '\0';
- X putchar (ch);
- X } else
- X putchar(7);
- X fflush(stdout);
- X ch = ReadCh();
- X }
- X
- X MoveCursor(LINES, 0);
- X CleartoEOLN();
- X
- X if (len) {
- X num = atoi(buf);
- X return(num);
- X } else
- X return(-1);
- X}
- X
- X
- X/*
- X * parse_string
- X * get a string from the user
- X * Return TRUE if a valid string was typed, FALSE otherwise
- X */
- X
- Xint parse_string (prompt, buf)
- X char *prompt;
- X char *buf;
- X{
- X int len;
- X int i;
- X char ch;
- X
- X clear_message();
- X MoveCursor(LINES,0);
- X printf("%s", prompt);
- X fflush(stdout);
- X buf[0] = '\0';
- X len = 0;
- X ch = ReadCh();
- X while (ch != '\n' && ch != '\r') {
- X if (ch == 8 || ch == 127) {
- X if (len) {
- X len--;
- X buf[len] = '\0';
- X putchar('\b');
- X putchar(' ');
- X putchar('\b');
- X } else {
- X MoveCursor(LINES, 0);
- X CleartoEOLN();
- X return(FALSE);
- X }
- X } else if (ch == 21) { /* control-U */
- X for (i = len;i>0;i--) {
- X putchar('\b');
- X putchar(' ');
- X putchar('\b');
- X }
- X buf[0] = '\0';
- X len = 0;
- X } else if (ch >= ' ' && len < 60) {
- X buf[len++] = ch;
- X buf[len] = '\0';
- X putchar (ch);
- X } else
- X putchar(7);
- X fflush(stdout);
- X ch = ReadCh();
- X }
- X MoveCursor(LINES,0);
- X CleartoEOLN();
- X
- X return TRUE;
- X}
- X
- X
- Xint prompt_yn (line, prompt, default_ch)
- X int line;
- X char *prompt;
- X char default_ch;
- X{
- X char ch;
- X
- X MoveCursor (line, 0);
- X CleartoEOLN ();
- X printf ("%s%c", prompt, default_ch);
- X fflush (stdout);
- X MoveCursor (line, strlen (prompt));
- X
- X if ((ch = ReadCh()) == CR) {
- X ch = default_ch;
- X }
- X
- X if (line == LINES) {
- X clear_message();
- X } else {
- X MoveCursor (line, strlen (prompt));
- X printf ("%c", ch);
- X fflush (stdout);
- X }
- X
- X return (ch == 'y' ? TRUE : FALSE);
- X}
- X
- X
- Xvoid continue_prompt()
- X{
- X info_message(txt_hit_any_key);
- X ReadCh();
- X}
- X
- X
- SHAR_EOF
- $TOUCH -am 0819090891 prompt.c &&
- chmod 0600 prompt.c ||
- echo "restore of prompt.c failed"
- set `wc -c prompt.c`;Wc_c=$1
- if test "$Wc_c" != "3061"; then
- echo original size 3061, current size $Wc_c
- fi
- # ============= proto.h ==============
- echo "x - extracting proto.h (Text)"
- sed 's/^X//' << 'SHAR_EOF' > proto.h &&
- X#ifdef __STDC__
- X
- X/* art.c */
- Xvoid art_susp(int sig);
- Xlong my_atol(char *s, int n);
- Xvoid find_base(void);
- Xint num_of_arts(void);
- Xint valid_artnum(long art);
- Xint purge_needed(void);
- Xvoid index_group(char *group, char *group_path);
- Xint read_group(char *group, char *group_path);
- Xvoid make_threads(int rethread);
- Xchar *eat_re(char *s);
- Xlong hash_s(char *s);
- Xint parse_headers(int fd, struct header *h);
- Xvoid dump_index(char *group, int killed);
- Xvoid my_strncpy(char *p, char *q, int n);
- Xint load_index(void);
- Xvoid find_local_index(char *group);
- Xvoid do_update(void);
- Xvoid reload_index_file(char *group, int killed);
- Xchar *parse_date(char *date, char *str);
- Xint artnum_comp(struct header *s1, struct header *s2);
- Xint subj_comp(struct header *s1, struct header *s2);
- Xint from_comp(struct header *s1, struct header *s2);
- Xint date_comp(struct header *s1, struct header *s2);
- Xint set_article(struct header *art);
- X/* curses.c */
- Xint InitScreen(void);
- Xvoid ScreenSize(int *num_lines, int *num_columns);
- Xvoid ClearScreen(void);
- Xvoid MoveCursor(int row, int col);
- Xvoid CleartoEOLN(void);
- Xvoid CleartoEOS(void);
- Xvoid StartInverse(void);
- Xvoid EndInverse(void);
- Xint RawState(void);
- Xvoid Raw(int state);
- Xint ReadCh(void);
- Xint outchar(int c);
- X/* debug.c */
- Xint debug_print_arts(void);
- Xvoid debug_print_header(struct header *s);
- Xint debug_print_comment(char *comment);
- Xvoid debug_print_base(void);
- Xvoid debug_print_active(void);
- X/* group.c */
- Xvoid group_susp(int sig);
- Xvoid group_page(char *group);
- Xvoid fix_new_highest(int groupnum);
- Xvoid show_group_page(char *group);
- Xvoid draw_subject_arrow(void);
- Xvoid erase_subject_arrow(void);
- Xint prompt_subject_num(int ch, char *group);
- Xint new_responses(int thread);
- Xvoid clear_note_area(void);
- Xint post_base(char *group);
- Xint find_new_pos(int old_top, long old_artnum, int cur_pos);
- X/* hashstr.c */
- Xchar *hash_str(char *s);
- Xstruct hashnode *add_string(char *s);
- Xvoid hash_init(void);
- Xvoid hash_reclaim(void);
- X/* help.c */
- Xvoid help_select_commands(void);
- Xvoid help_select_info(void);
- Xvoid help_group_commands(void);
- Xvoid help_group_info(void);
- Xvoid help_page_commands(void);
- Xvoid help_page_info(void);
- X/* kill.c */
- Xint read_kill_file(void);
- Xvoid write_kill_file(void);
- Xint kill_art_menu(char *group_name, int index);
- Xint untag_all_articles(void);
- Xint kill_any_articles(char *group);
- X/* lang.c */
- X/* mail.c */
- Xvoid mail_setup(void);
- Xint mail_check(void);
- X/* main.c */
- Xvoid main_susp(int sig);
- Xvoid signal_handler(int sig);
- Xvoid main(int argc, char *argv[]);
- Xvoid usage(char *progname);
- X/* memory.c */
- Xvoid init_alloc(void);
- Xvoid expand_art(void);
- Xvoid free_art_array(void);
- Xvoid expand_active(void);
- Xvoid expand_kill(void);
- Xvoid expand_save(void);
- Xvoid init_screen_array(int allocate);
- Xvoid free_all_arrays(void);
- Xvoid free_kill_array(void);
- Xvoid free_save_array(void);
- Xchar *my_malloc(unsigned size);
- Xchar *my_realloc(char *p, unsigned size);
- X/* misc.c */
- Xvoid init_selfinfo(void);
- Xint which_base(int n);
- Xint which_resp(int n);
- Xint nresp(int n);
- Xvoid asfail(char *file, int line, char *cond);
- Xvoid copy_fp(FILE *a, FILE *b, char *prefix);
- Xchar *get_val(char *env, char *def);
- Xint invoke_editor(char *nam);
- Xvoid shell_escape(void);
- Xvoid tin_done(int ret);
- Xvoid read_active(void);
- Xint active_comp(struct group_ent *s1, struct group_ent *s2);
- Xvoid add_signature(FILE *fp, int flag);
- Xlong hash_groupname(char *buf);
- Xvoid rename_file(char *old_filename, char *new_filename);
- Xchar *str_dup(char *str);
- Xint invoke_cmd(char *nam);
- X/* newsrc.c */
- Xvoid read_newsrc(int sub_only);
- Xvoid write_newsrc(void);
- Xvoid read_newsrc_line(char *group);
- Xvoid update_newsrc(char *group, int groupnum);
- Xvoid subscribe(char *group, int ch, int num, int out_seq);
- Xvoid reset_newsrc(void);
- Xvoid delete_group(char *group);
- Xint undel_group(void);
- Xvoid mark_group_read(char *group, int groupnum);
- Xvoid parse_seq(char *s);
- Xint parse_unread(char *s, int groupnum);
- Xint get_line_unread(char *group, int groupnum);
- Xvoid print_seq(FILE *fp, int groupnum);
- Xint pos_group_in_newsrc(char *group, int pos);
- X/* open.c */
- Xchar *is_remote(void);
- Xvoid nntp_startup(void);
- Xvoid nntp_finish(void);
- XFILE *open_active_fp(void);
- XFILE *open_art_fp(char *group_path, long art);
- Xint open_header_fd(char *group_path, long art);
- Xint base_comp(long *a, long *b);
- Xvoid setup_base(char *group, char *group_path);
- Xint get_respcode(void);
- Xint stuff_nntp(char *fnam);
- XFILE *nntp_to_fp(void);
- Xint nntp_to_fd(void);
- X/* page.c */
- Xvoid page_susp(int sig);
- Xint show_page(int respnum, char *group, char *group_path);
- Xvoid redraw_page(int respnum, char *group);
- Xvoid show_note_page(int respnum, char *group);
- Xvoid show_first_header(int respnum, char *group);
- Xvoid show_cont_header(int respnum);
- Xvoid open_note(long art, char *group_path);
- Xvoid note_cleanup(void);
- Xint prompt_response(int ch, int respnum);
- Xint choose_resp(int i, int n);
- Xvoid parse_from(char *str, char *addr, char *name);
- Xint prev_response(int n);
- Xint next_response(int n);
- Xint next_basenote(int n);
- Xvoid yank_to_addr(char *orig, char *addr);
- Xvoid find_new_to(char *nam, char *mail_to);
- Xint mail_to_someone(void);
- Xint mail_bug_report(void);
- Xint mail_to_author(int copy_text);
- Xint post_response(char *group, int respnum);
- Xvoid pipe_article(void);
- Xvoid print_article(void);
- Xvoid print_thread(int respnum, char *group_path);
- Xint show_last_page(void);
- X/* posted.c */
- Xint user_posted_messages(void);
- Xvoid update_art_posted_file(char *group, char *subj);
- X/* prompt.c */
- Xint parse_num(int ch, char *prompt);
- Xint parse_string(char *prompt, char *buf);
- Xint prompt_yn(int line, char *prompt, int default_ch);
- Xvoid continue_prompt(void);
- X/* rcfile.c */
- Xint read_rcfile(void);
- Xvoid write_rcfile(void);
- Xint change_rcfile(char *group, int kill_at_once);
- Xvoid parse_menu_string(int line, int col, char *var);
- Xvoid expand_rel_abs_pathname(int line, int col, char *str);
- Xvoid show_menu_help(char *help_message);
- X/* save.c */
- Xvoid save_art_to_file(int respnum, int index, int mailbox, char *filename);
- Xvoid save_thread_to_file(int respnum, char *group_path);
- Xint save_regex_arts(char *group_path, char *group);
- Xint append_to_existing_file(int i);
- Xint create_path(char *path);
- Xint create_sub_dir(int i);
- Xvoid add_to_save_list(int index, struct header *article, int is_mailbox, char *path);
- Xvoid sort_save_list(void);
- Xint save_comp(struct save_t *s1, struct save_t *s2);
- Xchar *save_filename(int i);
- Xchar *get_first_savefile(void);
- Xchar *get_last_savefile(void);
- Xint post_process_files(void);
- Xvoid post_process_sh(void);
- Xvoid post_process_uud(int pp);
- Xvoid uudecode(FILE *fp_in, char *dst_file);
- Xvoid doaline (char *s, FILE *fp_out);
- Xvoid outdec (char *p, int n, FILE *fp_out);
- Xchar *get_archive_file(char *dir, char *ext);
- Xvoid delete_processed_files(void);
- Xvoid post_process_patch(void);
- X/* screen.c */
- Xvoid info_message(char *msg);
- Xvoid wait_message(char *msg);
- Xvoid error_message(char *template, char *msg);
- Xvoid clear_message(void);
- Xvoid center_line(int line, char *str);
- Xvoid draw_arrow(int line);
- Xvoid erase_arrow(int line);
- X/* search.c */
- Xint search_author(int current_art, int forward);
- Xvoid search_group(int forward);
- Xvoid search_subject(int forward, char *group);
- Xint search_article(int forward);
- Xchar *str_str(char *text, char *pattern);
- Xvoid make_lower(char *s, char *t);
- X/* select.c */
- Xvoid select_susp(int sig);
- Xvoid selection_index(void);
- Xvoid group_selection_page(void);
- Xint prompt_group_num(int ch);
- Xvoid erase_group_arrow(void);
- Xvoid draw_group_arrow(void);
- Xint choose_new_group(void);
- Xint add_group(char *s, int get_unread);
- Xint next_unread(int n);
- Xint prev_unread(int n);
- Xint reposition_group(char *group, int default_num);
- X/* time.c */
- Xvoid nicedate(char *timestr, char *newstr);
- Xvoid nicetime(char *timestr, char *newstr);
- Xchar *nice_time(void);
- X/* wildmat.c */
- Xint wildmat(char *text, char *p);
- X
- X#else
- X
- X/* art.c */
- Xvoid art_susp(/*int sig*/);
- Xlong my_atol(/*char *s, int n*/);
- Xvoid find_base(/*void*/);
- Xint num_of_arts(/*void*/);
- Xint valid_artnum(/*long art*/);
- Xint purge_needed(/*void*/);
- Xvoid index_group(/*char *group, char *group_path*/);
- Xint read_group(/*char *group, char *group_path*/);
- Xvoid make_threads(/*int rethread*/);
- Xchar *eat_re(/*char *s*/);
- Xlong hash_s(/*char *s*/);
- Xint parse_headers(/*int fd, struct header *h*/);
- Xvoid dump_index(/*char *group, int killed*/);
- Xvoid my_strncpy(/*char *p, char *q, int n*/);
- Xint load_index(/*void*/);
- Xvoid find_local_index(/*char *group*/);
- Xvoid do_update(/*void*/);
- Xvoid reload_index_file(/*char *group, int killed*/);
- Xchar *parse_date(/*char *date, char *str*/);
- Xint artnum_comp(/*struct header *s1, struct header *s2*/);
- Xint subj_comp(/*struct header *s1, struct header *s2*/);
- Xint from_comp(/*struct header *s1, struct header *s2*/);
- Xint date_comp(/*struct header *s1, struct header *s2*/);
- Xint set_article(/*struct header *art*/);
- X/* curses.c */
- Xint InitScreen(/*void*/);
- Xvoid ScreenSize(/*int *lines, int *columns*/);
- Xvoid ClearScreen(/*void*/);
- Xvoid MoveCursor(/*int row, int col*/);
- Xvoid CleartoEOLN(/*void*/);
- Xvoid CleartoEOS(/*void*/);
- Xvoid StartInverse(/*void*/);
- Xvoid EndInverse(/*void*/);
- Xint RawState(/*void*/);
- Xvoid Raw(/*int state*/);
- Xint ReadCh(/*void*/);
- Xint outchar(/*int c*/);
- X/* debug.c */
- Xint debug_print_arts(/*void*/);
- Xvoid debug_print_header(/*struct header *s*/);
- Xint debug_print_comment(/*char *comment*/);
- Xvoid debug_print_base(/*void*/);
- Xvoid debug_print_active(/*void*/);
- X/* group.c */
- Xvoid group_susp(/*int sig*/);
- Xvoid group_page(/*char *group*/);
- Xvoid fix_new_highest(/*int groupnum*/);
- Xvoid show_group_page(/*char *group*/);
- Xvoid draw_subject_arrow(/*void*/);
- Xvoid erase_subject_arrow(/*void*/);
- Xint prompt_subject_num(/*int ch, char *group*/);
- Xint new_responses(/*int thread*/);
- Xvoid clear_note_area(/*void*/);
- Xint post_base(/*char *group*/);
- Xint find_new_pos(/*int old_top, long old_artnum, int cur_pos*/);
- X/* hashstr.c */
- Xchar *hash_str(/*char *s*/);
- Xstruct hashnode *add_string(/*char *s*/);
- Xvoid hash_init(/*void*/);
- Xvoid hash_reclaim(/*void*/);
- X/* help.c */
- Xvoid help_select_commands(/*void*/);
- Xvoid help_select_info(/*void*/);
- Xvoid help_group_commands(/*void*/);
- Xvoid help_group_info(/*void*/);
- Xvoid help_page_commands(/*void*/);
- Xvoid help_page_info(/*void*/);
- X/* kill.c */
- Xint read_kill_file(/*void*/);
- Xvoid write_kill_file(/*void*/);
- Xint kill_art_menu(/*char *group_name, int index*/);
- Xint untag_all_articles(/*void*/);
- Xint kill_any_articles(/*char *group*/);
- X/* lang.c */
- X/* mail.c */
- Xvoid mail_setup(/*void*/);
- Xint mail_check(/*void*/);
- X/* main.c */
- Xvoid main_susp(/*int sig*/);
- Xvoid signal_handler(/*int sig*/);
- Xvoid main(/*int argc, char *argv[]*/);
- Xvoid usage(/*char *progname*/);
- X/* memory.c */
- Xvoid init_alloc(/*void*/);
- Xvoid expand_art(/*void*/);
- Xvoid free_art_array(/*void*/);
- Xvoid expand_active(/*void*/);
- Xvoid expand_kill(/*void*/);
- Xvoid expand_save(/*void*/);
- Xvoid init_screen_array(/*int allocate*/);
- Xvoid free_all_arrays(/*void*/);
- Xvoid free_kill_array(/*void*/);
- Xvoid free_save_array(/*void*/);
- Xchar *my_malloc(/*unsigned size*/);
- Xchar *my_realloc(/*char *p, unsigned size*/);
- X/* misc.c */
- Xvoid init_selfinfo(/*void*/);
- Xint which_base(/*int n*/);
- Xint which_resp(/*int n*/);
- Xint nresp(/*int n*/);
- Xvoid asfail(/*char *file, int line, char *cond*/);
- Xvoid copy_fp(/*FILE *a, FILE *b, char *prefix*/);
- Xchar *get_val(/*char *env, char *def*/);
- Xint invoke_editor(/*char *nam*/);
- Xvoid shell_escape(/*void*/);
- Xvoid tin_done(/*int ret*/);
- Xvoid read_active(/*void*/);
- Xint active_comp(/*struct group_ent *s1, struct group_ent *s2*/);
- Xvoid add_signature(/*FILE *fp, int flag*/);
- Xlong hash_groupname(/*char *buf*/);
- Xvoid rename_file(/*char *old_filename, char *new_filename*/);
- Xchar *str_dup(/*char *str*/);
- Xint invoke_cmd(/*char *nam*/);
- X/* newsrc.c */
- Xvoid read_newsrc(/*int sub_only*/);
- Xvoid write_newsrc(/*void*/);
- Xvoid read_newsrc_line(/*char *group*/);
- Xvoid update_newsrc(/*char *group, int groupnum*/);
- Xvoid subscribe(/*char *group, int ch, int num, int out_seq*/);
- Xvoid reset_newsrc(/*void*/);
- Xvoid delete_group(/*char *group*/);
- Xint undel_group(/*void*/);
- Xvoid mark_group_read(/*char *group, int groupnum*/);
- Xvoid parse_seq(/*char *s*/);
- Xint parse_unread(/*char *s, int groupnum*/);
- Xint get_line_unread(/*char *group, int groupnum*/);
- Xvoid print_seq(/*FILE *fp, int groupnum*/);
- Xint pos_group_in_newsrc(/*char *group, int pos*/);
- X/* open.c */
- Xchar *is_remote(/*void*/);
- Xvoid nntp_startup(/*void*/);
- Xvoid nntp_finish(/*void*/);
- XFILE *open_active_fp(/*void*/);
- XFILE *open_art_fp(/*char *group_path, long art*/);
- Xint open_header_fd(/*char *group_path, long art*/);
- Xint base_comp(/*long *a, long *b*/);
- Xvoid setup_base(/*char *group, char *group_path*/);
- Xint get_respcode(/*void*/);
- Xint stuff_nntp(/*char *fnam*/);
- XFILE *nntp_to_fp(/*void*/);
- Xint nntp_to_fd(/*void*/);
- X/* page.c */
- Xvoid page_susp(/*int sig*/);
- Xint show_page(/*int respnum, char *group, char *group_path*/);
- Xvoid redraw_page(/*int respnum, char *group*/);
- Xvoid show_note_page(/*int respnum, char *group*/);
- Xvoid show_first_header(/*int respnum, char *group*/);
- Xvoid show_cont_header(/*int respnum*/);
- Xvoid open_note(/*long art, char *group_path*/);
- Xvoid note_cleanup(/*void*/);
- Xint prompt_response(/*int ch, int respnum*/);
- Xint choose_resp(/*int i, int n*/);
- Xvoid parse_from(/*char *str, char *addr, char *name*/);
- Xint prev_response(/*int n*/);
- Xint next_response(/*int n*/);
- Xint next_basenote(/*int n*/);
- Xvoid yank_to_addr(/*char *orig, char *addr*/);
- Xvoid find_new_to(/*char *nam, char *mail_to*/);
- Xint mail_to_someone(/*void*/);
- Xint mail_bug_report(/*void*/);
- Xint mail_to_author(/*int copy_text*/);
- Xint post_response(/*char *group, int respnum*/);
- Xvoid pipe_article(/*void*/);
- Xvoid print_article(/*void*/);
- Xvoid print_thread(/*int respnum, char *group_path*/);
- Xint show_last_page(/*void*/);
- X/* posted.c */
- Xint user_posted_messages(/*void*/);
- Xvoid update_art_posted_file(/*char *group, char *subj*/);
- X/* prompt.c */
- Xint parse_num(/*int ch, char *prompt*/);
- Xint parse_string(/*char *prompt, char *buf*/);
- Xint prompt_yn(/*int line, char *prompt, int default_ch*/);
- Xvoid continue_prompt(/*void*/);
- X/* rcfile.c */
- Xint read_rcfile(/*void*/);
- Xvoid write_rcfile(/*void*/);
- Xint change_rcfile(/*char *group, int kill_at_once*/);
- Xvoid parse_menu_string(/*int line, int col, char *var*/);
- Xvoid expand_rel_abs_pathname(/*int line, int col, char *str*/);
- Xvoid show_menu_help(/*char *help_message*/);
- X/* save.c */
- Xvoid save_art_to_file(/*int respnum, int index, int mailbox, char *filename*/);
- Xvoid save_thread_to_file(/*int respnum, char *group_path*/);
- Xint save_regex_arts(/*char *group_path, char *group*/);
- Xint append_to_existing_file(/*int i*/);
- Xint create_path(/*char *path*/);
- Xint create_sub_dir(/*int i*/);
- Xvoid add_to_save_list(/*int index, struct header *article, int is_mailbox, char *path*/);
- Xvoid sort_save_list(/*void*/);
- Xint save_comp(/*struct save_t *s1, struct save_t *s2*/);
- Xchar *save_filename(/*int i*/);
- Xchar *get_first_savefile(/*void*/);
- Xchar *get_last_savefile(/*void*/);
- Xint post_process_files(/*void*/);
- Xvoid post_process_sh(/*void*/);
- Xvoid post_process_uud(/*int pp*/);
- Xvoid uudecode(/*FILE *fp_in, char *dst_file*/);
- Xvoid doaline (/*char *s, FILE *fp_out*/);
- Xvoid outdec (/*char *p, int n, FILE *fp_out*/);
- Xchar *get_archive_file(/*char *dir, char *ext*/);
- Xvoid delete_processed_files(/*void*/);
- Xvoid post_process_patch(/*void*/);
- X/* screen.c */
- Xvoid info_message(/*char *msg*/);
- Xvoid wait_message(/*char *msg*/);
- Xvoid error_message(/*char *template, char *msg*/);
- Xvoid clear_message(/*void*/);
- Xvoid center_line(/*int line, char *str*/);
- Xvoid draw_arrow(/*int line*/);
- Xvoid erase_arrow(/*int line*/);
- X/* search.c */
- Xint search_author(/*int current_art, int forward*/);
- Xvoid search_group(/*int forward*/);
- Xvoid search_subject(/*int forward, char *group*/);
- Xint search_article(/*int forward*/);
- Xchar *str_str(/*char *text, char *pattern*/);
- Xvoid make_lower(/*char *s, char *t*/);
- X/* select.c */
- Xvoid select_susp(/*int sig*/);
- Xvoid selection_index(/*void*/);
- Xvoid group_selection_page(/*void*/);
- Xint prompt_group_num(/*int ch*/);
- Xvoid erase_group_arrow(/*void*/);
- Xvoid draw_group_arrow(/*void*/);
- Xint choose_new_group(/*void*/);
- Xint add_group(/*char *s, int get_unread*/);
- Xint next_unread(/*int n*/);
- Xint prev_unread(/*int n*/);
- Xint reposition_group(/*char *group, int default_num*/);
- X/* time.c */
- Xvoid nicedate(/*char *timestr, char *newstr*/);
- Xvoid nicetime(/*char *timestr, char *newstr*/);
- Xchar *nice_time(/*void*/);
- X/* wildmat.c */
- Xint wildmat(/*char *text, char *p*/);
- X
- X#endif
- SHAR_EOF
- $TOUCH -am 0823134291 proto.h &&
- chmod 0600 proto.h ||
- echo "restore of proto.h failed"
- set `wc -c proto.h`;Wc_c=$1
- if test "$Wc_c" != "16291"; then
- echo original size 16291, current size $Wc_c
- fi
- # ============= rcfile.c ==============
- echo "x - extracting rcfile.c (Text)"
- sed 's/^X//' << 'SHAR_EOF' > rcfile.c &&
- X/*
- X * Project : tin - a visual threaded usenet newsreader
- X * Module : rcfile.c
- X * Author : I.Lea
- X * Created : 01-04-91
- X * Updated : 18-08-91
- X * Release : 1.0
- X * Notes :
- X * Copyright : (c) Copyright 1991 by Iain Lea
- X * You may freely copy or redistribute this software,
- X * so long as there is no profit made from its use, sale
- X * trade or reproduction. You may not change this copy-
- X * right notice, and it must be included in any copy made
- X */
- X
- X#include "tin.h"
- X
- X#define COL2 COLS/2
- X
- Xextern char index_file[LEN+1];
- X
- X/*
- X * read_rcfile - read defaults from ~/.tin/tinrc
- X */
- X
- Xint read_rcfile ()
- X{
- X char buf[LEN+1];
- X FILE *fp;
- X
- X if ((fp = fopen (rcfile, "r")) != NULL) {
- X while (fgets (buf, LEN, fp) != NULL) {
- X if (buf[0] != '#') {
- X if (strncmp (buf, "save_archive=", 13) == 0) {
- X save_archive_name = (strncmp (&buf[13], "ON", 2) == 0 ? TRUE : FALSE);
- X } else if (strncmp (buf, "save_separate=", 14) == 0) {
- X save_separate = (strncmp (&buf[14], "ON", 2) == 0 ? TRUE : FALSE);
- X } else if (strncmp (buf, "mark_saved_read=", 16) == 0) {
- X mark_saved_read = (strncmp (&buf[16], "ON", 2) == 0 ? TRUE : FALSE);
- X } else if (strncmp (buf, "kill_articles=", 14) == 0) {
- X kill_articles = (strncmp (&buf[14], "ON", 2) == 0 ? TRUE : FALSE);
- X } else if (strncmp (buf, "show_author=", 12) == 0) {
- X show_author = (strncmp (&buf[12], "ON", 2) == 0 ? TRUE : FALSE);
- X } else if (strncmp (buf, "draw_arrow=", 11) == 0) {
- X draw_arrow_mark = (strncmp (&buf[11], "ON", 2) == 0 ? TRUE : FALSE);
- X } else if (strncmp (buf, "post_process=", 13) == 0) {
- X post_process = (strncmp (&buf[13], "ON", 2) == 0 ? TRUE : FALSE);
- X } else if (strncmp (buf, "print_header=", 13) == 0) {
- X print_header = (strncmp (&buf[14], "ON", 2) == 0 ? TRUE : FALSE);
- X } else if (strncmp (buf, "post_process_type=", 18) == 0) {
- X post_proc_type = atoi (&buf[18]);
- X } else if (strncmp (buf, "sort_article_type=", 18) == 0) {
- X sort_art_type = atoi (&buf[18]);
- X } else if (strncmp (buf, "savedir=", 8) == 0) {
- X strncpy (savedir, &buf[8], LEN);
- X savedir[strlen (savedir) - 1] = '\0';
- X if (savedir[0] == '.' && strlen (savedir) == 1) {
- X#ifdef BSD
- X getwd (buf);
- X#else
- X getcwd (buf, LEN);
- X#endif
- X my_strncpy (savedir, buf, LEN);
- X } /* else if (savedir[0] == '.' && savedir[1] == '.' && strlen (savedir) == 2) {
- X } */
- X } else if (strncmp (buf, "maildir=", 8) == 0) {
- X strncpy (maildir, &buf[8], LEN);
- X maildir[strlen (maildir) - 1] = '\0';
- X } else if (strncmp (buf, "printer=", 8) == 0) {
- X strncpy (printer, &buf[8], LEN);
- X printer[strlen (printer) - 1] = '\0';
- X } else if (strncmp (buf, "spooldir=", 9) == 0) {
- X strncpy (spooldir, &buf[9], LEN);
- X spooldir[strlen (spooldir) - 1] = '\0';
- X } else if (strncmp (buf, "signature=", 10) == 0) {
- X strncpy (signature, &buf[10], LEN);
- X signature[strlen (signature) - 1] = '\0';
- X } else if (strncmp (buf, "sig=", 4) == 0) {
- X strncpy (sig, &buf[4], LEN);
- X sig[strlen (sig) - 1] = '\0';
- SHAR_EOF
- echo "End of tin part 5"
- echo "File rcfile.c is continued in part 6"
- echo "6" > shar3_seq_.tmp
- exit 0
-
- --
- NAME Iain Lea
- EMAIL norisc!iain@estevax.UUCP ...!unido!estevax!norisc!iain
- SNAIL Siemens AG, AUT 922C, Postfach 4848, Nuernberg, Germany
- PHONE +49-911-895-3853, +49-911-895-3877, +49-911-331963
-