🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.bugs.uucp
Article #35

inefficient calloks in gnsys

#35
From: utzoohenry
Date: Thu, 10 Jun 1982 19:28
40 lines
1677 bytes
The gnsys() routine in uucico calls callok() on every file it finds
when looking for callable systems.  Not only is it inefficient to
call callok() once per file rather than once per system, but it can
produce a revolting number of log messages from callok when a system
with a lot of traffic waiting is uncallable.  It is not hard to fix
this, by maintaining a list of unavailable systems.  Here is a diff on
gnsys.c;  beware that line numbers may not match the V7 distribution,
so don't apply this blindly.

32,33c32,36
< 	char sysname[NAMESIZE], filename[NAMESIZE];
< 	FILE *fp;
---
> 	char *unavail[LSIZE];
> 	int nunavail = 0;
> 	char sysname[NAMESIZE], filename[NAMESIZE];
> 	FILE *fp;
> 	extern char *calloc();
56,57c59,72
< 			if (callok(sysname) == 0)
< 				nitem = srchst(sysname, list, nitem);
---
> 			for (i = 0; i < nunavail; i++)
> 				if (strcmp(sysname, unavail[i]) == 0)
> 					break;
> 			if (i < nunavail)
> 				continue;
> 			if (callok(sysname) == 0)
> 				nitem = srchst(sysname, list, nitem);
> 			else if (nunavail < LSIZE) {
> 				p1 = calloc((unsigned)strlen(sysname)+1, sizeof(char));
> 				if (p1 != NULL) {
> 					strcpy(p1, sysname);
> 					unavail[nunavail++] = p1;
> 				}
> 			}
60a76,78	/* just before the fclose -- HS */
> 		for (i = 0; i < nunavail; i++)
> 			if (unavail[i] != NULL)
> 				free(unavail[i]);
Technical Details
Message-ID: <bnews.utzoo.2141>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
From: utzoo!henry
Newsgroups: net.bugs.uucp
Title: inefficient calloks in gnsys 
Article-I.D.: utzoo.2141
Posted: Thu Jun 10 19:28:37 1982
Received: Thu Jun 10 19:28:37 1982
Subject: inefficient calloks in gnsys
Date: Thu, 10 Jun 1982 19:28:37 +0000
Message-ID: <bnews.utzoo.2141>