A change to /etc/gettable 4.2bsd
Robert J Goguen
rgoguen at bbn-vax.arpa
Tue Apr 29 03:52:01 AEST 1986
Recently I recieved several complaints from the adminstrator at the NIC
in regards to too many ftp connections retreiving the host table . To help in
cutting down the number of times I pulled over a "new" host table , I modified
the sources to /etc/gettable to allow a command to be sent to the "nicname"
server. The following commands are allowed.
1.) all - this is the default and it gets the entire host table
2.) version - gets the sequential version number
3.) "hname host" - gets the adddres of that particular host
4.) "haddr address" - gets the hostname of that particular address
/etc/gettable is used the exact same way except a "-c" was added to over-ride
the default ALL command .
e.g
/etc/gettable sri-nic -c version
The above command would retreive the current version number from the hostname
server at sri-nic and place it in host.txt. I could then use this current
version number and compare it to my current version number and decide on whether
or not I retreive the host table . Following is a diff on the sources .
diff gettable.new.c gettable.old.c
-------------------------------------------------------------------------------
0a1
>
13a15
> #define QUERY "version\r\n" /* query to hostname server */
30d31
< char QUERY[80] ;
34d34
< strcpy(QUERY,"ALL\r\n");
36,37c36,37
< if (argc < 1 || argc > 4) {
< fprintf(stderr,"usage: gettable host [ file ] [-c command ]\n");
---
> if (argc < 1 || argc > 2) {
> fprintf(stderr, "usage: gettable host [ file ]\n");
45,61c45,46
< while ( argc > 0 )
< { /* parse command line arguements */
< if (( argv[0][0] == '-') && ( argv[0][1] == 'c' ))
< {
< ++argv ;
< --argc ;
< strcpy(QUERY,*argv);
< strcat(QUERY,"\r\n");
< }
< else
< if ( *host == NULL )
< host = *argv ;
< else
< outfile = *argv ;
< ++argv ;
< --argc ;
< }
---
> host = *argv;
> argv++, argc--;
67a53,54
> if (argc > 0)
> outfile = *argv;
More information about the Comp.unix.wizards
mailing list