🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.bugs.2bsd
Article #198

f77 source file overwrite fix

#198
From: eric j. haug
Date: Tue, 05 Feb 1985 00:09
33 lines
1499 bytes
Subject:  f77 overwrites source files
Index:	src/cmd/f77 / driver.c 2.9bsd

Description:
	f77 does not check to see if the user would overwrite his source
	file.
Repeat-By:
	f77 -o f.f f.f
Fix:
	Change the code to check the last two characters of the target. And
	complain if it is one of "cefros".

Somewhere in main() where the variables are declared add
int dotpos;
Then in the switch looking for case 'o' add the following:

	aoutname = *++argv;
	--argc;
	/* non portable hack -- dotpos is an int */
	if ((dotpos = dotchar(aoutname)) != NO ) {
		if (dotpos == 'f' || dotpos == 'c' ||
			dotpos == 's' || dotpos == 'r' ||
			dotpos == 'e' || dotpos == 'o') {
			fprintf(diagfile,
				"It does not seem sensible to name the output %s\n",
					aoutname);
			done(1);
		}
	}
	break;

There are a few extra lines included in the above, to indicate context.
Sorry i did not choose to fix the other character with integer comparisons.
Technical Details
Message-ID: <108@slu70.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!cbosgd!ihnp4!mgnetp!we53!busch!wucs!slu70!ejh

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.2 9/18/84; site slu70.UUCP
Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!cbosgd!ihnp4!mgnetp!we53!busch!wucs!slu70!ejh
From: ejh@slu70.UUCP (eric j. haug)
Newsgroups: net.bugs.2bsd
Subject: f77 source file overwrite fix
Message-ID: <108@slu70.UUCP>
Date: Mon, 4-Feb-85 19:09:41 EST
Article-I.D.: slu70.108
Posted: Mon Feb  4 19:09:41 1985
Date-Received: Thu, 7-Feb-85 04:01:29 EST
Distribution: net
Organization: Saint Louis Univ.,St. L.,MO.
Lines: 33