🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #8961

Re: TIN 1.2 PL2 - missing line numbers

#8961
From: Tom J Parry
Date: Tue, 10 May 1994 02:18
377 lines
11524 bytes
On Mon, 9 May 1994 12:02:45 GMT, Geoff Collis wrote:
> Tom J Parry (parry@yoyo.cc.monash.edu.au) wrote:

> : If your article goes through _any_ INN sight on its way out into the world,
> : it will get a Lines: header added so chances are that by the time most
> : people read your article, there will be a Lines: header. If I can find the
> : Lines: patches I have I will post them but don't hold your breath :-)

> Many thanks to Sean and Tom, for their help.  Unfortunately locally we
> run CNews, and many of the newsgroups are not propagated offsite.  The
> patch hasn't arrived...  I guess Tom can no longer find it!

> If anyone else can supply this patch for TIN 1.22 PL2, then please send
> to me at the above email address. 

I have searched about and eventually found the patches. They are not to
1.22pl2 though. They are to the 251093 beta of 1.23. For this reason you
may find that there is considerable fuzz in the patches. I have attempted
to remove all bits that do not relate to the Lines: header but some may
have slipped through. They won't break anything but they may not go in
cleanly. Have a careful look at any rejects you get and if you can't fix
them, post details or mail them to me.

I have not maintained the Lines: patches in later beta copies that Iain has
sent me since we now have an INN server.

Here are the patches:

diff -u3 tin-1.23b2.orig/inews.c tin-1.23b2.patched/inews.c
--- tin-1.23b2.orig/inews.c	Thu Oct  7 15:45:34 1993
+++ tin-1.23b2.patched/inews.c	Mon Oct 25 22:26:20 1993
@@ -378,14 +378,15 @@
 
 
 int 
-submit_file (name)
+submit_file (name, lines)
 	char *name;
+	int   lines;
 {
 	char buf[LEN];
 	char *cp = buf;
 	int ret_code;
 
-	insert_x_headers (name);
+	insert_x_headers (name, lines);
 
 	if (read_news_via_nntp && use_builtin_inews) {
 #ifdef DEBUG
diff -u3 tin-1.23b2.orig/post.c tin-1.23b2.patched/post.c
--- tin-1.23b2.orig/post.c	Mon Oct 25 22:23:55 1993
+++ tin-1.23b2.patched/post.c	Tue Nov  2 21:27:52 1993
@@ -154,8 +154,9 @@
  */
 
 int 
-check_article_to_be_posted (article)
+check_article_to_be_posted (article, lines)
 	char *article;
+	int  *lines;
 {
 	char *ngptrs[NGLIMIT];
 	char line[LEN], *cp, *cp2;
@@ -166,17 +167,18 @@
 	int errors = 0;
 	int found_newsgroups_line = FALSE;
 	int found_subject_line = FALSE;
+	int got_long_line = FALSE;
 	int init = TRUE;
 	int ngcnt = 0;
 	int nglens[NGLIMIT];
-	int oldraw;	/* save previous raw state */
+	int oldraw;	/* To save previous raw status */
 
 	if ((fp = fopen (article, "r")) == (FILE *) 0) {
 		perror_message (txt_cannot_open, article);
 		return FALSE;
 	}
 
-	oldraw = RawState();	/* save state */
+	oldraw = RawState(); /* save state */
 
 	while (fgets (line, sizeof (line), fp) != NULL) {
 		cnt++;
@@ -196,6 +198,7 @@
 		}
 		if ((len == 0) && (cnt >= 2)) {
 			end_of_header = TRUE;
+			*lines = 0;
 			break;
 		}
 		/* 
@@ -284,6 +287,7 @@
 	 * 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) {
@@ -297,11 +301,12 @@
 				col++;
 			}
 		}
-		if (col > MAX_COL) {
+		if (col > MAX_COL && !got_long_line) {
 			setup_check_article_screen (&init);
 			fprintf (stderr, txt_warn_art_line_too_long, MAX_COL, cnt, line);
 			fflush (stderr);
-			break;
+			got_long_line = TRUE;
+			/*break;*/
 		}
 	}
 	if (! end_of_header) {
@@ -367,11 +373,13 @@
 {
 	FILE *fp;
 	char ch, *ptr;
	char ch_default = 'p';
 	char group[PATH_LEN];
 	char subj[PATH_LEN];
 	char buf[LEN], tmp[LEN];
-	int i, done = FALSE;
+	char mail_to[LEN];
+	char prompt[LEN];
+	int ret_code, i, done = FALSE, lines;
 
 	if (! can_post) {
 		info_message (txt_cannot_post);
@@ -511,14 +519,14 @@
 		switch (ch) {
 		case 'e':
 			invoke_editor (article, start_line_offset);
-			while (! check_article_to_be_posted (article)) {
+			while (! check_article_to_be_posted (article, &lines)) {
 				do {
 					sprintf (msg, "%s%c", txt_bad_article, 'e');
 					wait_message (msg);
 					MoveCursor (cLINES, (int) strlen (txt_bad_article));
 					if ((ch = (char) ReadCh ()) == CR)
 						ch = 'e';
				} while (! strchr ("eq\033", ch));
 				if (ch == 'e') {
 					invoke_editor (article, start_line_offset);
 				} else {
@@ -540,9 +549,9 @@
 			invoke_ispell (article);
 			break;
 
 		case 'p':
 			wait_message (txt_posting);
-			if (submit_file (article)) {
+			if (submit_file (article, lines)) {
 				Raw (FALSE);
 				info_message (txt_art_posted);
 				reread_active_for_posted_arts = TRUE;		
@@ -551,6 +575,7 @@
 				rename_file (article, dead_article);
 				Raw (FALSE);
 				error_message (txt_art_rejected, dead_article);
+				ReadCh();
 				return;
 			}
 		}
@@ -593,10 +618,12 @@
 {
 	FILE *fp;
 	char ch;
	char ch_default = 'p';
 	char subj[LEN];
 	char buf[LEN];
-	int i, redraw_screen = FALSE;
+	char mail_to[LEN];
+	char prompt[LEN];
+	int ret_code, i, redraw_screen = FALSE, lines, n;
 
 	if (! can_post) {
 		info_message (txt_cannot_post);
@@ -614,7 +641,12 @@
 	*posted = FALSE;
 	start_line_offset = 6;
 
-	if (active[my_group[cur_groupnum]].moderated == 'm') {
+	n = find_group_index (group);
+
+	/* We should not have n==-1 here. Someone should have checked the group */
+	assert (n != -1);
+
+	if (active[n].moderated == 'm') {
 		sprintf (msg, txt_group_is_moderated, group);
 		if (! prompt_yn (cLINES, msg, 'y')) {
 			clear_message ();
@@ -680,7 +712,7 @@
 		switch (ch) {
 		case 'e':
 			invoke_editor (article, start_line_offset);
-			while (! check_article_to_be_posted (article)) {
+			while (! check_article_to_be_posted (article, &lines)) {
 				do {
 					sprintf (msg, "%s%c", txt_bad_article, 'e');
 					wait_message (msg);
@@ -710,9 +743,9 @@
 			invoke_ispell (article);
 			break;
 
 		case 'p':
 			wait_message (txt_posting);
-			if (submit_file (article)) {
+			if (submit_file (article, lines)) {
 				info_message (txt_art_posted);
 				*posted = TRUE;
 				reread_active_for_posted_arts = TRUE;		
@@ -721,7 +769,7 @@
 				rename_file (article, dead_article);
 				sprintf (buf, txt_art_rejected, dead_article);
 				info_message (buf);
-				sleep (3);
+				ReadCh();
 				return (redraw_screen);
 			}
 		}
@@ -758,9 +806,12 @@
 {
 	FILE *fp;
 	char ch, *ptr;
	char ch_default = 'p';
 	char buf[LEN];
+	char mail_to[LEN];
+	char prompt[LEN];
 	int i;
+	int lines;
 	int ret_code = POSTED_NONE;
 	
 	/*
@@ -876,7 +927,7 @@
 		switch (ch) {
 		case 'e':
 			invoke_editor (article, start_line_offset);
-			while (! check_article_to_be_posted (article)) {
+			while (! check_article_to_be_posted (article, &lines)) {
 				do {
 					sprintf (msg, "%s%c", txt_bad_article, 'e');
 					wait_message (msg);
@@ -907,9 +959,9 @@
 			ret_code = POSTED_REDRAW;
 			break;
 			
 		case 'p':
 			wait_message (txt_posting);
-			if (submit_file (article)) {
+			if (submit_file (article, lines)) {
 				info_message (txt_art_posted);
 				ret_code = POSTED_OK;
 				reread_active_for_posted_arts = TRUE;		
@@ -918,7 +985,7 @@
 				rename_file (article, dead_article);
 				sprintf (buf, txt_art_rejected, dead_article);
 				info_message (buf);
-				sleep (3);
+				ReadCh();
 				return (ret_code);
 			}
 		}
@@ -1324,7 +1435,7 @@
 			find_mail_header (HEADER_TO, nam, mail_to);
 			sprintf (msg, txt_mailing_to, mail_to);
 			wait_message (msg);
-			insert_x_headers (nam);
+			insert_x_headers (nam, 0);
 #ifdef M_UNIX
 			sprintf (buf, "%s \"%s\" < %s", mailer, mail_to, nam);
 #else
@@ -1553,7 +1664,7 @@
 
 		case 'd':
 			wait_message (txt_deleting_art);
-			if (submit_file (delete)) {
+			if (submit_file (delete, 0)) {
 				info_message (txt_art_deleted);
 				goto delete_article_done;
 			} else {
@@ -1582,8 +1693,10 @@
 {
 	char buf[LEN];
 	char ch;
	char ch_default = 'p';
 	FILE *fp;
+ 	char mail_to[LEN];
+ 	char prompt[LEN];
 	int i, ret_code = POSTED_NONE;
 	
 	start_line_offset = 4;
@@ -1606,10 +1719,12 @@
 		fprintf (fp, "Reply-To: %s\n", reply_to);
 		start_line_offset++;
 	}
-	if (*note_h_distrib) {
+	if (*note_h_distrib)
 		fprintf (fp, "Distribution: %s\n", note_h_distrib);
-		start_line_offset++;
-	}
+	else
+		fprintf (fp, "Distribution: %s\n", my_distribution);
+
+	start_line_offset++;
 
 	fprintf (fp, "\n[ Article crossposted from %s ]", note_h_newsgroups);
 	get_author (FALSE, respnum, buf);
@@ -1631,13 +1746,17 @@
 			MoveCursor (cLINES, (int) strlen (msg)-1);
 			if ((ch = (char) ReadCh ()) == CR)
 				ch = ch_default;
		} while (! strchr ("epq\033", ch));
 		switch (ch) {
 		case 'e':
 			invoke_editor (article, start_line_offset);
 			ret_code = POSTED_REDRAW;
 			break;
 
+		case 'i':
+			invoke_ispell (article);
+			break;
+
 		case 'q':
 		case ESC:
 			if (unlink_article)
@@ -1647,7 +1780,7 @@
 
 		case 'p':
 			wait_message (txt_crosspost_an_article);
-			if (submit_file (article)) {
+			if (submit_file (article, 0)) {
 				info_message (txt_art_posted);
 				ret_code = POSTED_OK;
 				reread_active_for_posted_arts = TRUE;		
@@ -1675,8 +1808,9 @@
 
 
 void 
-insert_x_headers (infile)
-	char *infile;
+insert_x_headers (infile, lines)
+  	char *infile;
+ 	int   lines;
 {
 	char line[LEN];
 	char outfile[PATH_LEN];
@@ -1688,6 +1822,9 @@
 		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);
diff -u3 tin-1.23b2.orig/select.c tin-1.23b2.patched/select.c
--- tin-1.23b2.orig/select.c	Mon Oct 25 22:23:57 1993
+++ tin-1.23b2.patched/select.c	Tue Nov  2 21:29:02 1993
@@ -613,6 +613,11 @@
 						if (buf[0] == '\0')
 							break;
 						strcpy (post_group, buf);
+						if (find_group_index (post_group) == -1) {
+							sprintf (msg, txt_not_in_active_file, post_group);
+							info_message (msg);
+							break;
+						}
 					} else {
 						strcpy (post_group, active[my_group[cur_groupnum]].name);
 					}

-- 
Tom J Parry.
Your reality is a figment of my imagination.
Technical Details
Message-ID: <2qmqth$2jo@harbinger.cc.monash.edu.au>
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!bga.com!news.sprintlink.net!hookup!swrinde!emory!europa.eng.gtefsd.com!howland.reston.ans.net!news.cac.psu.edu!news.pop.psu.edu!psuvax1!news.cc.swarthmore.edu!netnews.upenn.edu!msuinfo!harbinger.cc.monash.edu.au!yoyo.cc.monash.edu.au!parry
References: <Cp0xsK.51I@ukpsshp1.serigate.philips.nl> <Cp127v.Lo3@butch.lmsc.lockheed.com> <2pt36m$6vb@harbinger.cc.monash.edu.au> <CpJAsM.BM7@ukpsshp1.serigate.philips.nl>

Show Full Headers
Complete Article Headers
Message-ID: <2qmqth$2jo@harbinger.cc.monash.edu.au>
Subject: Re: TIN 1.2 PL2 - missing line numbers
Date: Tue, 10 May 1994 02:18:25 +0000
From: parry@yoyo.cc.monash.edu.au (Tom J Parry)
References: <Cp0xsK.51I@ukpsshp1.serigate.philips.nl> <Cp127v.Lo3@butch.lmsc.lockheed.com> <2pt36m$6vb@harbinger.cc.monash.edu.au> <CpJAsM.BM7@ukpsshp1.serigate.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!bga.com!news.sprintlink.net!hookup!swrinde!emory!europa.eng.gtefsd.com!howland.reston.ans.net!news.cac.psu.edu!news.pop.psu.edu!psuvax1!news.cc.swarthmore.edu!netnews.upenn.edu!msuinfo!harbinger.cc.monash.edu.au!yoyo.cc.monash.edu.au!parry
Newsgroups: news.software.readers
Organization: Monash University
Lines: 377
Distribution: world
NNTP-Posting-Host: yoyo.cc.monash.edu.au
Originator: parry@yoyo.cc.monash.edu.au