/************************************************************************** * * * this routine reads from the back-up memory the last number of the * * tcp/ip address used from the CPU to regognize "who" it is, i.e. in * * which balcony it is located. * * GdA 15/3/92 * * 28/3/93 : changed ADDRESS * * 01/3/01 : -> gethostname * * (old: get_config_diskless.c)* **************************************************************************/ /* main() { int tcp_ip_nr, cpu_nr; char *hv_config[3]; if (get_config( &tcp_ip_nr, &cpu_nr, hv_config) != 0){ printf (" error in get_config \n"); exit (0); } printf (" tcp_ip_nr %d, cpu_nr %d, hv_config %s\n", tcp_ip_nr, cpu_nr, hv_config[cpu_nr]); } */ int get_config(tcp_ip_nr, cpu_nr, hv_config) int *tcp_ip_nr, *cpu_nr; char *hv_config[3]; { char *hv_config0 = "hv_config0"; char *hv_config1 = "hv_config1"; char *hv_config2 = "hv_config2"; char *p, byte; char myname[100]; int i; int nr = 0; hv_config[0] = hv_config0; hv_config[1] = hv_config1; hv_config[2] = hv_config2; gethostname(myname, 100); /* printf(" hostname %s\n", myname); */ if (!strcmp(myname, "os9b1")) nr = 121; else if (!strcmp(myname, "os9b2")) nr = 122; else if (!strcmp(myname, "os9bmu1")) nr = 55; else nr = 0; *tcp_ip_nr = nr; if ( *tcp_ip_nr == 55 ) *cpu_nr = 0; else if ( *tcp_ip_nr == 121 ) *cpu_nr = 1; else if ( *tcp_ip_nr == 122 ) *cpu_nr = 2; else { exit(_errmsg(0, " wrong tcp/ip number read from backup memory : %d\n", *tcp_ip_nr)); } return 0; }