Article View: news.software.readers
Article #9548TIN 1.22 PL2 - adding Lines to header
From: Collis dr. G.V.
Date: Tue, 14 Jun 1994 13:19
Date: Tue, 14 Jun 1994 13:19
416 lines
12770 bytes
12770 bytes
A few weeks ago I posted a question about missing "Lines:" from an
article header when posted with TIN 1.22 PL2.
Many thanks to Tom Parry (parry@yoyo.cc.monash.edu.au) who gave me the
original fix to add line numbers. This worked for posting and
follow-ups, but not for cross-posting. So I've added a further patch to
fix cross-posting, you can probably detect my clumsy hack!
The differences are as follows:
-------------------------------------------------------------------------------
user@somehost$ diff -c proto.h.orig proto.h
*** proto.h.orig Sat Sep 25 16:30:06 1993
--- proto.h Tue Jun 14 14:52:07 1994
***************
*** 115,121 ****
extern void get_host_name(char *host_name);
extern void get_user_info(char *user_name, char *full_name);
extern void get_from_name(char *user_name, char *host_name, char *full_name, char *from_name);
! extern int submit_file(char *name);
/* init.c */
extern void init_selfinfo(void);
extern void set_tindir(void);
--- 115,121 ----
extern void get_host_name(char *host_name);
extern void get_user_info(char *user_name, char *full_name);
extern void get_from_name(char *user_name, char *host_name, char *full_name, char *from_name);
! extern int submit_file(char *name, int lines);
/* init.c */
extern void init_selfinfo(void);
extern void set_tindir(void);
***************
*** 276,282 ****
/* post.c */
extern int user_posted_messages(void);
extern void update_art_posted_file(char *group, int action, char *subj);
! extern int check_article_to_be_posted(char *article);
extern void setup_check_article_screen(int *init);
extern void quick_post_article(void);
extern int post_article(char *group, int *posted);
--- 276,282 ----
/* post.c */
extern int user_posted_messages(void);
extern void update_art_posted_file(char *group, int action, char *subj);
! extern int check_article_to_be_posted(char *article, int *lines);
extern void setup_check_article_screen(int *init);
extern void quick_post_article(void);
extern int post_article(char *group, int *posted);
***************
*** 287,293 ****
extern void find_mail_header(int header, char *file, char *value);
extern int delete_article(char *group, int respnum);
extern int crosspost_article(char *group, int respnum);
! extern void insert_x_headers(char *infile);
extern void find_reply_to_addr(int respnum, char *from_addr);
extern void reread_active_after_posting(void);
/* prompt.c */
--- 287,293 ----
extern void find_mail_header(int header, char *file, char *value);
extern int delete_article(char *group, int respnum);
extern int crosspost_article(char *group, int respnum);
! extern void insert_x_headers(char *infile, int lines);
extern void find_reply_to_addr(int respnum, char *from_addr);
extern void reread_active_after_posting(void);
/* prompt.c */
-------------------------------------------------------------------------------
user@somehost$ diff -c inews.c.orig inews.c
*** inews.c.orig Sat Sep 25 16:30:13 1993
--- inews.c Tue Jun 14 14:51:39 1994
***************
*** 378,391 ****
int
! submit_file (name)
char *name;
{
char buf[LEN];
char *cp = buf;
int ret_code = FALSE;
! insert_x_headers (name);
if (read_news_via_nntp && use_builtin_inews) {
#ifdef DEBUG
--- 378,392 ----
int
! submit_file (name, lines)
char *name;
+ int lines;
{
char buf[LEN];
char *cp = buf;
int ret_code = FALSE;
! insert_x_headers (name, lines);
if (read_news_via_nntp && use_builtin_inews) {
#ifdef DEBUG
-------------------------------------------------------------------------------
user@somehost$ diff -c post.c.orig post.c
*** post.c.orig Sat Sep 25 16:30:24 1993
--- post.c Tue Jun 14 14:51:14 1994
***************
*** 154,161 ****
*/
int
! check_article_to_be_posted (article)
char *article;
{
char *ngptrs[NGLIMIT];
char line[LEN], *cp, *cp2;
--- 154,162 ----
*/
int
! check_article_to_be_posted (article, lines)
char *article;
+ int *lines;
{
char *ngptrs[NGLIMIT];
char line[LEN], *cp, *cp2;
***************
*** 196,201 ****
--- 197,203 ----
}
if ((len == 0) && (cnt >= 2)) {
end_of_header = TRUE;
+ *lines = 0;
break;
}
/*
***************
*** 284,289 ****
--- 286,292 ----
* Check the body of the article for long lines
*/
while (fgets (line, sizeof (line), fp)) {
+ (*lines)++;
cnt++;
cp = strrchr (line, '\n');
if (cp != (char *) 0) {
***************
*** 371,377 ****
char group[PATH_LEN];
char subj[PATH_LEN];
char buf[LEN], tmp[LEN];
! int i, done = FALSE;
if (! can_post) {
info_message (txt_cannot_post);
--- 374,380 ----
char group[PATH_LEN];
char subj[PATH_LEN];
char buf[LEN], tmp[LEN];
! int i, done = FALSE, lines;
if (! can_post) {
info_message (txt_cannot_post);
***************
*** 512,518 ****
switch (ch) {
case 'e':
invoke_editor (article, start_line_offset);
! while (! check_article_to_be_posted (article)) {
do {
sprintf (msg, "%s%c", txt_bad_article, 'e');
wait_message (msg);
--- 515,521 ----
switch (ch) {
case 'e':
invoke_editor (article, start_line_offset);
! while (! check_article_to_be_posted (article, &lines)) {
do {
sprintf (msg, "%s%c", txt_bad_article, 'e');
wait_message (msg);
***************
*** 543,549 ****
case 'p':
wait_message (txt_posting);
! if (submit_file (article)) {
Raw (FALSE);
info_message (txt_art_posted);
reread_active_for_posted_arts = TRUE;
--- 546,552 ----
case 'p':
wait_message (txt_posting);
! if (submit_file (article, lines)) {
Raw (FALSE);
info_message (txt_art_posted);
reread_active_for_posted_arts = TRUE;
***************
*** 597,603 ****
char ch_default = 'p';
char subj[LEN];
char buf[LEN];
! int i, redraw_screen = FALSE;
if (! can_post) {
info_message (txt_cannot_post);
--- 600,606 ----
char ch_default = 'p';
char subj[LEN];
char buf[LEN];
! int i, redraw_screen = FALSE, lines;
if (! can_post) {
info_message (txt_cannot_post);
***************
*** 681,687 ****
switch (ch) {
case 'e':
invoke_editor (article, start_line_offset);
! while (! check_article_to_be_posted (article)) {
do {
sprintf (msg, "%s%c", txt_bad_article, 'e');
wait_message (msg);
--- 684,690 ----
switch (ch) {
case 'e':
invoke_editor (article, start_line_offset);
! while (! check_article_to_be_posted (article, &lines)) {
do {
sprintf (msg, "%s%c", txt_bad_article, 'e');
wait_message (msg);
***************
*** 713,719 ****
case 'p':
wait_message (txt_posting);
! if (submit_file (article)) {
info_message (txt_art_posted);
*posted = TRUE;
reread_active_for_posted_arts = TRUE;
--- 716,722 ----
case 'p':
wait_message (txt_posting);
! if (submit_file (article, lines)) {
info_message (txt_art_posted);
*posted = TRUE;
reread_active_for_posted_arts = TRUE;
***************
*** 762,767 ****
--- 765,771 ----
char ch_default = 'p';
char buf[LEN];
int i;
+ int lines;
int ret_code = POSTED_NONE;
/*
***************
*** 877,883 ****
switch (ch) {
case 'e':
invoke_editor (article, start_line_offset);
! while (! check_article_to_be_posted (article)) {
do {
sprintf (msg, "%s%c", txt_bad_article, 'e');
wait_message (msg);
--- 881,887 ----
switch (ch) {
case 'e':
invoke_editor (article, start_line_offset);
! while (! check_article_to_be_posted (article, &lines)) {
do {
sprintf (msg, "%s%c", txt_bad_article, 'e');
wait_message (msg);
***************
*** 910,916 ****
case 'p':
wait_message (txt_posting);
! if (submit_file (article)) {
info_message (txt_art_posted);
ret_code = POSTED_OK;
reread_active_for_posted_arts = TRUE;
--- 914,920 ----
case 'p':
wait_message (txt_posting);
! if (submit_file (article, lines)) {
info_message (txt_art_posted);
ret_code = POSTED_OK;
reread_active_for_posted_arts = TRUE;
***************
*** 1313,1319 ****
find_mail_header (HEADER_TO, nam, mail_to);
sprintf (msg, txt_mailing_to, mail_to);
wait_message (msg);
! insert_x_headers (nam);
#ifdef M_UNIX
sprintf (buf, "%s \"%s\" < %s", mailer, mail_to, nam);
#else
--- 1317,1323 ----
find_mail_header (HEADER_TO, nam, mail_to);
sprintf (msg, txt_mailing_to, mail_to);
wait_message (msg);
! insert_x_headers (nam, 0);
#ifdef M_UNIX
sprintf (buf, "%s \"%s\" < %s", mailer, mail_to, nam);
#else
***************
*** 1543,1549 ****
case 'd':
wait_message (txt_deleting_art);
! if (submit_file (delete)) {
info_message (txt_art_deleted);
goto delete_article_done;
} else {
--- 1547,1553 ----
case 'd':
wait_message (txt_deleting_art);
! if (submit_file (delete, 0)) {
info_message (txt_art_deleted);
goto delete_article_done;
} else {
***************
*** 1571,1582 ****
--- 1575,1589 ----
int respnum;
{
char buf[LEN];
+ char line[LEN];
char ch;
char ch_default = 'p';
FILE *fp;
int i, ret_code = POSTED_NONE;
+ int lines;
start_line_offset = 4;
+ lines = 0;
if ((fp = fopen (article, "w")) == NULL) {
perror_message (txt_cannot_open, article);
***************
*** 1587,1592 ****
--- 1594,1607 ----
fprintf (fp, "Subject: %s\n", eat_re (note_h_subj));
fprintf (fp, "Newsgroups: %s\n", group);
+ /* count the number of lines in the article */
+ fseek (note_fp, note_mark[0], 0);
+ while (fgets (line, sizeof (line), note_fp)) {
+ lines++;
+ }
+ fprintf (fp, "Lines: %d\n", lines);
+ start_line_offset++;
+
i = find_group_index (group);
if (i >= 0 && active[i].attribute.organization != (char *) 0) {
fprintf (fp, "Organization: %s\n", active[i].attribute.organization);
***************
*** 1637,1643 ****
case 'p':
wait_message (txt_crosspost_an_article);
! if (submit_file (article)) {
info_message (txt_art_posted);
ret_code = POSTED_OK;
reread_active_for_posted_arts = TRUE;
--- 1652,1658 ----
case 'p':
wait_message (txt_crosspost_an_article);
! if (submit_file (article, 0)) {
info_message (txt_art_posted);
ret_code = POSTED_OK;
reread_active_for_posted_arts = TRUE;
***************
*** 1665,1672 ****
void
! insert_x_headers (infile)
char *infile;
{
char line[LEN];
char outfile[PATH_LEN];
--- 1680,1688 ----
void
! insert_x_headers (infile, lines)
char *infile;
+ int lines;
{
char line[LEN];
char outfile[PATH_LEN];
***************
*** 1678,1683 ****
--- 1694,1702 ----
if ((fp_out = fopen (outfile, "w")) != NULL) {
while (fgets (line, sizeof (line), fp_in) != NULL) {
if (! gotit && line[0] == '\n') {
+ if (lines) {
+ fprintf (fp_out, "Lines: %d\n", lines);
+ }
if (active[my_group[cur_groupnum]].type == GROUP_TYPE_MAIL) {
fprintf (fp_out, "X-Mailer: TIN [version %s PL%s]\n\n",
VERSION, PATCHLEVEL);
--
Geoff Collis, CSSG, Philips Semiconductors, Southampton, U.K.
email: collis@hpcssg.serigate.philips.nl (seri : collis@hpcssg)
tel : +31-40-744091 (NatLab) or +44 703 316360 (Southampton)
Technical Details
Message-ID:
<1994Jun14.131917.29886@prl.philips.nl>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!archive!mbox2nntp-news.software.readers.mbox.zip!nntp.gmd.de!Germany.EU.net!EU.net!sun4nl!relay.philips.nl!prle!collisShow Full Headers
Complete Article Headers
Message-ID: <1994Jun14.131917.29886@prl.philips.nl> Subject: TIN 1.22 PL2 - adding Lines to header Date: Tue, 14 Jun 1994 13:19:17 GMT From: collis@prl.philips.nl (Collis dr. G.V.) Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!archive!mbox2nntp-news.software.readers.mbox.zip!nntp.gmd.de!Germany.EU.net!EU.net!sun4nl!relay.philips.nl!prle!collis Newsgroups: news.software.readers Lines: 11 Sender: news@prl.philips.nl (USENET News System) Organization: Philips Research Laboratories Eindhoven, Netherlands X-Newsreader: TIN [version 1.2 PL2]