[8778] in Athena Bugs

home help back first fref pref prev next nref lref last post

7.3 rsaix: machtype

daemon@ATHENA.MIT.EDU (Richard Basch)
Thu Dec 26 11:08:27 1991

Date: Thu, 26 Dec 91 11:08:13 -0500
To: bugs@MIT.EDU
From: "Richard Basch" <basch@MIT.EDU>


machtype does not properly detect devices that are not currently
configured but are still defined in the ODM.

Here is a set of patches.

These patches will skip over the unavailable devices, except in verbose
mode, in which case it will print out the device status.

Example:

534% ./machtype -d -M -v
colorgda : Color Graphics Display Adapter (available)
mem2  32 MB : 32 MB Memory Card (available)
mem3  16 MB : 16 MB Memory Card (available)
Total : 49152 K

I discovered the mistake when I had moved around my memory cards and
got:

mem0  16 MB : 16 MB Memory Card
mem1  32 MB : 32 MB Memory Card
mem2  32 MB : 32 MB Memory Card
mem3  16 MB : 16 MB Memory Card
Total : 49152 K

Since then, I have purged my ODM of the old information...

-Richard

*** /tmp/,RCSt1QnIAkZ	Thu Dec 26 11:03:28 1991
--- machtype_rios.c	Thu Dec 26 11:02:25 1991
***************
*** 55,62 ****
--- 55,65 ----
    char *title;
    char *attrib;
    char *value;
+   short status;
  } binding_t;
  
+ char *dev_status[] = { "defined", "available", "stopped" };
+ 
  #define MAXRETURN 50
  
  void handle_odm_error(char *what);
***************
*** 209,217 ****
        if (verbose == 1) {
  	found1 = find_value(found[j].value,"dsp_name",&k);
  	found2 = find_value(found[j].value,"dsp_desc",&k);
! 	printf("%s : %s\n",found1[0].value,found2[0].value);
        } else {
  	found1 = find_value(found[j].value,"dsp_name",&k);
  	printf("%s\n",found1[0].value);
        }
      }
--- 212,222 ----
        if (verbose == 1) {
  	found1 = find_value(found[j].value,"dsp_name",&k);
  	found2 = find_value(found[j].value,"dsp_desc",&k);
! 	printf("%s : %s (%s)\n",
! 	       found1[0].value, found2[0].value, dev_status[found1[j].status]);
        } else {
  	found1 = find_value(found[j].value,"dsp_name",&k);
+ 	if (found1[0].status != AVAILABLE) continue;
  	printf("%s\n",found1[0].value);
        }
      }
***************
*** 235,245 ****
  	size = found1[0].value;
        if (verbose == 1) {
  	if (!strcmp(bootdisk,found[j].name)) {
! 	  printf("%6s %4s : %s (boot)\n",found[j].name,size,found[j].title);
  	} else {
! 	  printf("%6s %4s : %s \n",found[j].name,size,found[j].title);
  	}
        } else {
  	if (!strcmp(bootdisk,found[j].name)) {
  	  printf("%6s %4s boot\n",found[j].name,size);
  	} else {
--- 240,255 ----
  	size = found1[0].value;
        if (verbose == 1) {
  	if (!strcmp(bootdisk,found[j].name)) {
! 	  printf("%6s %4s : %s (boot) (%s)\n",
! 		 found[j].name, size, found[j].title,
! 		 dev_status[found1[0].status]);
  	} else {
! 	  printf("%6s %4s : %s (%s)\n",
! 		 found[j].name, size, found[j].title,
! 		 dev_status[found1[0].status]);
  	}
        } else {
+ 	if (found1[0].status != AVAILABLE) continue;
  	if (!strcmp(bootdisk,found[j].name)) {
  	  printf("%6s %4s boot\n",found[j].name,size);
  	} else {
***************
*** 252,261 ****
      found = find_value("fd","fdtype",&i);
      for (j=0;j<i;j++) {
        if (verbose == 1)
! 	printf("%6s  unk : %s %s\n",found[j].name, found[j].value,
! 	       found[j].title);
!       else
  	printf("%6s  unk %s\n",found[j].name,found[j].value);
      }
    }
  
--- 262,274 ----
      found = find_value("fd","fdtype",&i);
      for (j=0;j<i;j++) {
        if (verbose == 1)
! 	printf("%6s  unk : %s %s (%s)\n",
! 	       found[j].name, found[j].value, found[j].title,
! 	       dev_status[found[j].status]);
!       else {
! 	if (found[j].status != AVAILABLE) continue;
  	printf("%6s  unk %s\n",found[j].name,found[j].value);
+       }
      }
    }
  
***************
*** 268,274 ****
      if (verbose == 1) {
        found = find_value("mem","size",&i);
        for(j=0;j<i;j++)
! 	printf("%s %3s MB : %s\n",found[j].name,found[j].value,found[j].title);
        found = find_value("sys0","realmem",&i);
        printf("Total : %s K\n",found[0].value);
      } else {
--- 281,289 ----
      if (verbose == 1) {
        found = find_value("mem","size",&i);
        for(j=0;j<i;j++)
! 	printf("%s %3s MB : %s (%s)\n",
! 	       found[j].name, found[j].value, found[j].title,
! 	       dev_status[found[j].status]);
        found = find_value("sys0","realmem",&i);
        printf("Total : %s K\n",found[0].value);
      } else {
***************
*** 276,281 ****
--- 291,297 ----
        printf("%s K\n",found[0].value);
      }
    }
+   exit(0);
  }
  
  void
***************
*** 344,349 ****
--- 360,366 ----
      if (!strncmp(stuff[i].T_CuDv->name,name,namelen)) {
        if (attrib[0] == '*') {
  	to_return[*nfound].name = stuff[i].T_CuDv->name;
+ 	to_return[*nfound].status = stuff[i].T_CuDv->status;
  	to_return[*nfound].title = stuff[i].Text;
  	to_return[*nfound].attrib = "*";
  	to_return[*nfound].value = "";
***************
*** 352,357 ****
--- 369,375 ----
  	for(j=0;j<num_at[i];j++) {
  	  if (!strcmp(at_stuff[i][j].attribute,attrib)) {
  	    to_return[*nfound].name = stuff[i].T_CuDv->name;
+ 	    to_return[*nfound].status = stuff[i].T_CuDv->status;
  	    to_return[*nfound].title = stuff[i].Text;
  	    to_return[*nfound].attrib = at_stuff[i][j].attribute;
  	    to_return[*nfound].value = at_stuff[i][j].deflt;

home help back first fref pref prev next nref lref last post