[net.sources.bugs] build and access database of paths to systems on map

sohail@terak.UUCP (10/07/84)

Hi,
I have just finished making some changes to the prpath
program sent out by scc!steiny.
Two of these we bug fixes and the last was a hack
(or kludge) to give some sites higher priority than the rest.


Sohail Hussain

uucp:	 ...{decvax,hao,ihnp4,seismo}!noao!terak!sohail
phone:	 602 998 4800
us mail: Terak Corporation, 14151 N 76th street, Scottsdale, AZ 85260
------
bug fix 1.
The mkmls program takes all the MAIL entries for a given machine
and puts them on one line. I think that there must be some limitation
on the line length or the programs buffer size that is being exceed
for sites that pass mail to may system (ie decvax or ihnp4)

The fix I made was, in mkmls.c, to put each of the continuation lines on a line
of its own with the name of the system as the first word. Thus no lines
were concatenated.
This results in more systems being found. I noticed that we went from
~1300 systems to ~1700 systems, ofcourse this exceeds the number of systems
this program was planed for, thus I had to increase the limits in defs.h
*** mkmls.c.old	Sun Oct  7 09:48:43 1984
--- mkmls.c	Sun Oct  7 09:49:32 1984
***************
*** 1,4
! static char *tsccsid = "@(#)mkmls.c	1.1	(Terak Corp)	10/4/84";
  /* mkmls - make map list
     This reads though the argument files, assumed to be usenet
  maps and makes a file with each system and the systems it exchanges

--- 1,4 -----
! static char *tsccsid = "@(#)mkmls.c	1.2	(Terak Corp)	10/5/84";
  /* mkmls - make map list
     This reads though the argument files, assumed to be usenet
  maps and makes a file with each system and the systems it exchanges
***************
*** 42,47
  					write(1,curname,strlen(curname));
  					if(!buf[5])
  					{
  						write(1,"\n",1);
  						state = 0;
  					}

--- 42,48 -----
  					write(1,curname,strlen(curname));
  					if(!buf[5])
  					{
+ 						strcpy(curname,"");
  						write(1,"\n",1);
  						state = 0;
  					}
***************
*** 51,57
  						state = 2;
  					}
  					strcpy(obuf,&buf[6]);
- 					strcpy(curname,"");
  				}
  				break;
  			case 2:

--- 52,57 -----
  						state = 2;
  					}
  					strcpy(obuf,&buf[6]);
  				}
  				break;
  			case 2:
***************
*** 62,68
  					state = 0;
  					break;
  				}
! 				strcat(obuf," ");
  				if(*buf == '\t')
  					strcat(obuf,&buf[1]);
  				else

--- 62,69 -----
  					state = 0;
  					break;
  				}
! 				write(1,obuf,strlen(obuf));
! 				write(1,"\n",1);
  				if(*buf == '\t')
  					strcpy(obuf,&buf[1]);
  				else
***************
*** 64,70
  				}
  				strcat(obuf," ");
  				if(*buf == '\t')
! 					strcat(obuf,&buf[1]);
  				else
  					strcat(obuf,buf);
  				break;

--- 65,71 -----
  				write(1,obuf,strlen(obuf));
  				write(1,"\n",1);
  				if(*buf == '\t')
! 					strcpy(obuf,&buf[1]);
  				else
  					strcpy(obuf,buf);
  				write(1,curname,strlen(curname));
***************
*** 66,72
  				if(*buf == '\t')
  					strcat(obuf,&buf[1]);
  				else
! 					strcat(obuf,buf);
  				break;
  			}
  		}

--- 67,75 -----
  				if(*buf == '\t')
  					strcpy(obuf,&buf[1]);
  				else
! 					strcpy(obuf,buf);
! 				write(1,curname,strlen(curname));
! 				write(1," ",1);
  				break;
  			}
  		}

*** defs.h.old	Sun Oct  7 09:48:41 1984
--- defs.h	Sun Oct  7 09:49:30 1984
***************
*** 1,5
  
! /* @(#)defs.h	1.1	(Terak Corp)	10/5/84 */
  /* definitions 
     Don Steiny	September 	1984
   */

--- 1,5 -----
  
! /* @(#)defs.h	1.2	(Terak Corp)	10/5/84 */
  /* definitions 
     Don Steiny	September 	1984
   */
***************
*** 4,10
     Don Steiny	September 	1984
   */
  #ifndef WIDTH		/* maximum machines == WIDTH * 16 */
! #define WIDTH 96	/* 96 * 16 == 1536 systems in matrix */
  #endif
  /* macros to test and set bit
   */

--- 4,10 -----
     Don Steiny	September 	1984
   */
  #ifndef WIDTH		/* maximum machines == WIDTH * 16 */
! #define WIDTH 192	/* 192 * 16 == 3072 systems in matrix */
  #endif
  /* macros to test and set bit
   */

================================
bug fix #2
This is a minor bug in mkalpath that does not treat a '_' as
a valid character in a path name. 
This effects only about 4 systems, causing okc_5a to show up
as okc and 5a.

NOTE: The fix for west 44 can be removed if you fix the entry
for ic-cs in the eur.gb file of the map

It is easyly overcome by the following
*** mkalpath.old	Sun Oct  7 09:48:42 1984
--- mkalpath	Sun Oct  7 09:49:32 1984
***************
*** 7,14
  : make file of system/mail pairs
  echo run this as root.;
  echo 'making system/mail data file from map files'
! : fix for west 44, not sure why it did this or if it still does
! $LIBDIR/mkmls $MAPDIR/*.* | sort -u | sed 's/west 44/west44/'| grep ' ' > MACH;
  echo 'making index of system names'
! tr -cs '\@A-Za-z0-9-' '\012' < MACH | sort -u > MAIL;
  echo 'making alpath file'

--- 7,13 -----
  : make file of system/mail pairs
  echo run this as root.;
  echo 'making system/mail data file from map files'
! $LIBDIR/mkmls $MAPDIR/$FILES | sort -u | grep ' ' > MACH;
  echo 'making index of system names'
! tr -cs '\@A-Za-z_0-9-' '\012' < MACH | sort -u > MAIL;
  echo 'making alpath file'
===============================
Finally the kludge to give some sites more importance than
the rest. 
This was done by changing the names of the desired site to
upper case in the MACH file and then changing back to lower
case in the alpath file.
(I know this is a hack, but to quote a new tv series 'it works
for me'. )

*** mkalpath.old	Sun Oct  7 09:48:42 1984
--- mkalpath	Sun Oct  7 09:49:32 1984
***************
*** 7,14
  : make file of system/mail pairs
  echo run this as root.;
  echo 'making system/mail data file from map files'
! : fix for west 44, not sure why it did this or if it still does
! $LIBDIR/mkmls $MAPDIR/*.* | sort -u | sed 's/west 44/west44/'| grep ' ' > MACH;
  echo 'making index of system names'
  tr -cs '\@A-Za-z_0-9-' '\012' < MACH | sort -u > MAIL;
  echo 'making alpath file'

--- 7,13 -----
  : make file of system/mail pairs
  echo run this as root.;
  echo 'making system/mail data file from map files'
! $LIBDIR/mkmls $MAPDIR/$FILES | sort -u | sed -f $LIBDIR/MACH.sed | grep ' ' > MACH;
  echo 'making index of system names'
  tr -cs '\@A-Za-z_0-9-' '\012' < MACH | sort -u > MAIL;
  echo 'making alpath file'
***************
*** 12,18
  echo 'making index of system names'
  tr -cs '\@A-Za-z_0-9-' '\012' < MACH | sort -u > MAIL;
  echo 'making alpath file'
! $LIBDIR/findp > alpath;
  echo 'making data base of paths'
  $LIBDIR/creatdb alpath;

--- 11,17 -----
  echo 'making index of system names'
  tr -cs '\@A-Za-z_0-9-' '\012' < MACH | sort -u > MAIL;
  echo 'making alpath file'
! $LIBDIR/findp | sed -f $LIBDIR/alpath.sed > alpath;
  echo 'making data base of paths'
  $LIBDIR/creatdb alpath;
  --------------------- MACH.sed ---------------------------

s/decvax/DECVAX/
s/hao/HAO/g
s/seismo/SEISMO/
s/ihnp4/IHNP4/
  --------------------- alpath.sed -------------------------

s/DECVAX/decvax/g
s/HAO/hao/g
s/SEISMO/seismo/g
s/IHNP4/ihnp4/g
-- 
Sohail Hussain

uucp:	 ...{decvax,hao,ihnp4,seismo}!noao!terak!sohail
phone:	 602 998 4800
us mail: Terak Corporation, 14151 N 76th street, Scottsdale, AZ 85260