|
|
| version 1.3, 2003/11/03 19:31:43 | version 1.4, 2004/03/13 21:08:38 |
|---|---|
| Line 122 static void usage(void); | Line 122 static void usage(void); |
| * overhauled at Silicon Graphics | * overhauled at Silicon Graphics |
| */ | */ |
| int | int |
| main(argc, argv) | main(int argc, char *argv[]) |
| int argc; | |
| char *argv[]; | |
| { | { |
| int on; | int on; |
| int ret; | int ret; |
| Line 134 main(argc, argv) | Line 132 main(argc, argv) |
| char buf[BUFSIZ], *cp, *cplim; | char buf[BUFSIZ], *cp, *cplim; |
| struct ifconf ifc; | struct ifconf ifc; |
| struct ifreq ifreq, ifreqf, *ifr; | struct ifreq ifreq, ifreqf, *ifr; |
| register struct netinfo *ntp; | struct netinfo *ntp; |
| struct netinfo *ntip; | struct netinfo *ntip; |
| struct netinfo *savefromnet; | struct netinfo *savefromnet; |
| struct netent *nentp; | struct netent *nentp; |
| Line 529 main(argc, argv) | Line 527 main(argc, argv) |
| } | } |
| static void | static void |
| usage() | usage(void) |
| { | { |
| #ifdef sgi | #ifdef sgi |
| fprintf(stderr, "%s\n%s\n", | fprintf(stderr, "%s\n%s\n", |
| "usage: timed [-dtM] [-i net|-n net] [-F host1 host2 ...]", | "usage: timed [-dtM] [-i net|-n net] [-F host1 host2 ...]", |
| Line 551 usage() | Line 550 usage() |
| * suppress an upstart, untrustworthy, self-appointed master | * suppress an upstart, untrustworthy, self-appointed master |
| */ | */ |
| void | void |
| suppress(addr, name,net) | suppress(struct sockaddr_in *addr, char *name, struct netinfo *net) |
| struct sockaddr_in *addr; | |
| char *name; | |
| struct netinfo *net; | |
| { | { |
| struct sockaddr_in tgt; | struct sockaddr_in tgt; |
| char tname[MAXHOSTNAMELEN]; | char tname[MAXHOSTNAMELEN]; |
| Line 579 suppress(addr, name,net) | Line 575 suppress(addr, name,net) |
| } | } |
| void | void |
| lookformaster(ntp) | lookformaster(struct netinfo *ntp) |
| struct netinfo *ntp; | |
| { | { |
| struct tsp resp, conflict, *answer; | struct tsp resp, conflict, *answer; |
| struct timeval ntime; | struct timeval ntime; |
| Line 679 lookformaster(ntp) | Line 674 lookformaster(ntp) |
| * networks; | * networks; |
| */ | */ |
| void | void |
| setstatus() | setstatus(void) |
| { | { |
| struct netinfo *ntp; | struct netinfo *ntp; |
| Line 732 setstatus() | Line 727 setstatus() |
| } | } |
| void | void |
| makeslave(net) | makeslave(struct netinfo *net) |
| struct netinfo *net; | |
| { | { |
| register struct netinfo *ntp; | struct netinfo *ntp; |
| for (ntp = nettab; ntp != NULL; ntp = ntp->next) { | for (ntp = nettab; ntp != NULL; ntp = ntp->next) { |
| if (ntp->status == SLAVE && ntp != net) | if (ntp->status == SLAVE && ntp != net) |
| Line 748 makeslave(net) | Line 742 makeslave(net) |
| * Try to become master over ignored nets.. | * Try to become master over ignored nets.. |
| */ | */ |
| static void | static void |
| checkignorednets() | checkignorednets(void) |
| { | { |
| register struct netinfo *ntp; | struct netinfo *ntp; |
| for (ntp = nettab; ntp != NULL; ntp = ntp->next) { | for (ntp = nettab; ntp != NULL; ntp = ntp->next) { |
| if (!Mflag && ntp->status == SLAVE) | if (!Mflag && ntp->status == SLAVE) |
| Line 770 checkignorednets() | Line 764 checkignorednets() |
| * Take a hint about for a good network. | * Take a hint about for a good network. |
| */ | */ |
| static void | static void |
| pickslavenet(ntp) | pickslavenet(struct netinfo *ntp) |
| struct netinfo *ntp; | |
| { | { |
| if (slavenet != 0 && slavenet->status == SLAVE) { | if (slavenet != 0 && slavenet->status == SLAVE) { |
| makeslave(slavenet); /* prune extras */ | makeslave(slavenet); /* prune extras */ |
| return; | return; |
| Line 791 pickslavenet(ntp) | Line 785 pickslavenet(ntp) |
| * returns a random number in the range [inf, sup] | * returns a random number in the range [inf, sup] |
| */ | */ |
| long | long |
| casual(inf, sup) | casual(long inf, long sup) |
| long inf, sup; | |
| { | { |
| double value; | double value; |
| Line 801 casual(inf, sup) | Line 794 casual(inf, sup) |
| } | } |
| char * | char * |
| date() | date(void) |
| { | { |
| #ifdef sgi | #ifdef sgi |
| struct timeval tv; | struct timeval tv; |
| Line 821 date() | Line 814 date() |
| } | } |
| void | void |
| addnetname(name) | addnetname(char *name) |
| char *name; | |
| { | { |
| register struct nets **netlist = &nets; | struct nets **netlist = &nets; |
| while (*netlist) | while (*netlist) |
| netlist = &((*netlist)->next); | netlist = &((*netlist)->next); |
| Line 837 addnetname(name) | Line 829 addnetname(name) |
| /* note a host as trustworthy */ | /* note a host as trustworthy */ |
| static void | static void |
| add_good_host(name, perm) | add_good_host(char *name, |
| char *name; | int perm) /* 1=not part of the netgroup */ |
| int perm; /* 1=not part of the netgroup */ | |
| { | { |
| register struct goodhost *ghp; | struct goodhost *ghp; |
| register struct hostent *hentp; | struct hostent *hentp; |
| ghp = (struct goodhost*)malloc(sizeof(*ghp)); | ghp = (struct goodhost*)malloc(sizeof(*ghp)); |
| if (!ghp) { | if (!ghp) { |
| Line 865 add_good_host(name, perm) | Line 856 add_good_host(name, perm) |
| /* update our image of the net-group of trustworthy hosts | /* update our image of the net-group of trustworthy hosts |
| */ | */ |
| void | void |
| get_goodgroup(force) | get_goodgroup(int force) |
| int force; | |
| { | { |
| # define NG_DELAY (30*60*CLK_TCK) /* 30 minutes */ | # define NG_DELAY (30*60*CLK_TCK) /* 30 minutes */ |
| static unsigned long last_update = -NG_DELAY; | static unsigned long last_update = -NG_DELAY; |
| Line 934 get_goodgroup(force) | Line 924 get_goodgroup(force) |
| /* see if a machine is trustworthy | /* see if a machine is trustworthy |
| */ | */ |
| int /* 1=trust hp to change our date */ | int /* 1=trust hp to change our date */ |
| good_host_name(name) | good_host_name(char *name) |
| char *name; | |
| { | { |
| register struct goodhost *ghp = goodhosts; | struct goodhost *ghp = goodhosts; |
| register char c; | char c; |
| if (!ghp || !Mflag) /* trust everyone if no one named */ | if (!ghp || !Mflag) /* trust everyone if no one named */ |
| return 1; | return 1; |