|
|
1.1 ! root 1: #include <stdio.h> ! 2: #include "../scsi.h" ! 3: #include "../scsish.h" ! 4: #include "fns.h" ! 5: ! 6: int ! 7: shelfside(char *arg, char *err) ! 8: { ! 9: char *oarg = arg; ! 10: int shelf; ! 11: ! 12: if((*arg < '0') || (*arg > '9')){ ! 13: usage: ! 14: sprintf(err, "shelfside '%s' must be numa or numb", oarg); ! 15: return(-1); ! 16: } ! 17: shelf = 0; ! 18: while((*arg >= '0') && (*arg <= '9')) ! 19: shelf = 10*shelf + *arg++ - '0'; ! 20: shelf <<= 1; ! 21: if(*arg == 'a') ! 22: ; ! 23: else if(*arg == 'b') ! 24: shelf |= 1; ! 25: else ! 26: goto usage; ! 27: if(*++arg) ! 28: goto usage; ! 29: return(shelf); ! 30: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.