home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / sys / sun / admin / 5489 < prev    next >
Encoding:
Internet Message Format  |  1992-08-13  |  16.1 KB

  1. Path: sparky!uunet!mcsun!sunic!dkuug!flshub!phk
  2. From: phk@data.fls.dk (Poul-Henning Kamp)
  3. Newsgroups: comp.sys.sun.admin
  4. Subject: scsiping.c -- retreive SCSI-info from disk
  5. Message-ID: <1992Aug13.105109.920@data.fls.dk>
  6. Date: 13 Aug 92 10:51:09 GMT
  7. Organization: FLS Data A/S, Valby, Copenhagen, Denmark.
  8. Lines: 485
  9.  
  10. Here is my scsiping program,
  11. It runs on my sun's 4.1.2 It might work on yours too.
  12. DO NOT trust the fields all too much, the "standards" are a bit thin yet...
  13.  
  14. enjoy...
  15.  
  16. Poul-Henning Kamp
  17.  
  18. #! /bin/sh
  19. # This is a shell archive.  Remove anything before this line, then unpack
  20. # it by saving it into a file and typing "sh file".  To overwrite existing
  21. # files, type "sh file -c".  You can also feed this as standard input via
  22. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  23. # will see the following message at the end:
  24. #        "End of shell archive."
  25. # Contents:  scsiping.c
  26. # Wrapped by phk@gimli on Thu Aug 13 12:49:00 1992
  27. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  28. if test -f 'scsiping.c' -a "${1}" != "-c" ; then 
  29.   echo shar: Will not clobber existing file \"'scsiping.c'\"
  30. else
  31. echo shar: Extracting \"'scsiping.c'\" \(14506 characters\)
  32. sed "s/^X//" >'scsiping.c' <<'END_OF_FILE'
  33. X#include <stdio.h>
  34. X#include <fcntl.h>
  35. X#include <scsi/impl/types.h>
  36. X#include <scsi/impl/uscsi.h>
  37. X
  38. X#define SUCCESS 0
  39. X
  40. Xunsigned char bdef[8000];
  41. Xunsigned char bsav[8000];
  42. Xunsigned char bcur[8000];
  43. Xunsigned char bchg[8000];
  44. Xint idef,isav,icur,ichg;
  45. Xchar hostname[100];
  46. X
  47. Xmain(argc,argv)
  48. X    int argc;
  49. X    char **argv;
  50. X    {
  51. X    setbuf(stdout,0);
  52. X    gethostname(hostname,100);
  53. X    while(--argc)
  54. X        Do(*++argv);
  55. X    exit(0);
  56. X    }
  57. X
  58. XHexDump(p,l,s)
  59. X    unsigned char *p;
  60. X    int l;
  61. X    char *s;
  62. X    {
  63. X    int i;
  64. X
  65. X    while(l > 0)
  66. X    {
  67. X        printf("%s",s);
  68. X    for(i=0;i<16;i++)
  69. X        {
  70. X        if(i<l)
  71. X        printf("%02x ",p[i]);
  72. X        else
  73. X        printf("   ");
  74. X        }
  75. X    printf("   |");
  76. X    for(i=0;i<16;i++)
  77. X        {
  78. X        if(i<l && p[i] >= ' ' && p[i] <= '~')
  79. X        printf("%c",p[i]);
  80. X        else
  81. X        printf(" ");
  82. X        }
  83. X    printf("|\n");
  84. X    l-=16;
  85. X    p+=16;
  86. X    }
  87. X
  88. X    }
  89. X
  90. XDo(arg)
  91. X    char *arg;
  92. X    {
  93. X    int fd;
  94. X    int i,j;
  95. X    struct uscsi_cmd u,v,w;
  96. X    unsigned char buf[8000],*p,*q,*r;
  97. X    union scsi_cdb cdb;
  98. X    char *s;
  99. X    char f_ven[10];
  100. X    char f_typ[30];
  101. X    char f_rev[30];
  102. X    int f_trks_zone=-1;
  103. X    int f_asect=-1;
  104. X    int f_atrks=-1;
  105. X    int f_ncyl=-1;
  106. X    int f_pcyl=-1;
  107. X    int f_acyl=-1;
  108. X    int f_nhead=-1;
  109. X    int f_nsect=-1;
  110. X    int f_rpm=-1;
  111. X    int f_bpt=-1;
  112. X    int f_mgmt=-1;
  113. X    int f_capacity=-1;
  114. X
  115. X    if((fd=open(arg,O_RDONLY))<SUCCESS)
  116. X    return;
  117. X
  118. X    i=strlen(arg)+strlen(hostname)+1;
  119. X    while(i--)
  120. X    putchar('=');
  121. X    putchar('\n');
  122. X    printf("%s %s\n",hostname,arg);
  123. X    i=strlen(arg)+strlen(hostname)+1;
  124. X    while(i--)
  125. X    putchar('=');
  126. X    putchar('\n');
  127. X    
  128. X    u.uscsi_flags=USCSI_DIAGNOSE|USCSI_ISOLATE|USCSI_READ;
  129. X    u.uscsi_bufaddr=(caddr_t)buf;
  130. X    u.uscsi_buflen=8000;
  131. X    memset(buf,0,8000);
  132. X    cdb.scc_cmd = SCMD_READ_CAPACITY;
  133. X    cdb.scc_lun = 0;
  134. X    u.uscsi_cdb=(caddr_t)&cdb;
  135. X    u.uscsi_cdblen=10;
  136. X    i=ioctl(fd,USCSICMD,&u);
  137. X    if(i != SUCCESS)
  138. X    {
  139. X    fprintf(stderr,"i=%d ",i);
  140. X    perror("ioctl(READ_CAPACITY)");
  141. X    }
  142. X    printf("READ_CAPACITY:\n");
  143. X    printf("    Capacity:               %d\n",
  144. X        f_capacity=1+(buf[0]<<24)+(buf[1]<<16)+(buf[2]<<8)+buf[3]);
  145. X
  146. X    u.uscsi_flags=USCSI_DIAGNOSE|USCSI_ISOLATE|USCSI_READ;
  147. X    u.uscsi_bufaddr=(caddr_t)buf;
  148. X    u.uscsi_buflen=8000;
  149. X    memset(buf,0,8000);
  150. X    cdb.scc_cmd = SCMD_INQUIRY;
  151. X    cdb.scc_lun = 0;
  152. X    cdb.g0_count0=200;
  153. X    u.uscsi_cdb=(caddr_t)&cdb;
  154. X    u.uscsi_cdblen=6;
  155. X    i=ioctl(fd,USCSICMD,&u);
  156. X    if(i != SUCCESS)
  157. X    {
  158. X    fprintf(stderr,"i=%d ",i);
  159. X    perror("ioctl(SCSI_INQUIRY)");
  160. X    }
  161. X    printf("INQUIRY:\n");
  162. X    printf("    Peripheral qualifier:   %d\n",(buf[0]>>5)&7);
  163. X    printf("    Peripheral device-type: %d\n",buf[0]&0x1f);
  164. X    printf("    Device-type modifier:   %d\n",buf[1]&0x7f);
  165. X    printf("    Removable medium:       %d\n",(buf[1]>>7)&0x1);
  166. X    printf("    ISO version:            %d\n",(buf[2]>>6)&0x3);
  167. X    printf("    ECMA version:           %d\n",(buf[2]>>3)&0x7);
  168. X    printf("    ANSI version:           %d\n",(buf[2]>>0)&0x7);
  169. X    printf("    AENC:                   %d\n",(buf[3]>>7)&0x1);
  170. X    printf("    TrmIOP:                 %d\n",(buf[3]>>6)&0x1);
  171. X    printf("    Response data format:   %d\n",(buf[3]>>0)&0xf);
  172. X    printf("    Relative addressing:    %d\n",(buf[7]>>7)&0x1);
  173. X    printf("    Wide bus 32:            %d\n",(buf[7]>>6)&0x1);
  174. X    printf("    Wide bus 16:            %d\n",(buf[7]>>5)&0x1);
  175. X    printf("    Sync transfer:          %d\n",(buf[7]>>4)&0x1);
  176. X    printf("    Linked commands:        %d\n",(buf[7]>>3)&0x1);
  177. X    printf("    Command queing:         %d\n",(buf[7]>>1)&0x1);
  178. X    printf("    Soft reset:             %d\n",(buf[7]>>0)&0x1);
  179. X    printf("    Vendor:                 '%-8.8s'\n",buf+8);
  180. X    printf("    Product:                '%-16.16s'\n",buf+16);
  181. X    printf("    Revision:               '%-4.4s'\n",buf+32);
  182. X    printf("    Comment1:               '%-20.20s'\n",buf+36);
  183. X    printf("    Comment2:               '%-40.40s'\n",buf+56);
  184. X    printf("    Comment3:               '%-40.40s'\n",buf+96);
  185. X    strncpy(f_ven,buf+8,8);
  186. X    for(s=f_ven+8-1;*s==' ';s--)
  187. X        *s=0;
  188. X    strncpy(f_typ,buf+16,16);
  189. X    for(s=f_typ+16-1;*s==' ';s--)
  190. X        *s=0;
  191. X    strncpy(f_rev,buf+32,4);
  192. X    for(s=f_rev+16-1;*s==' ';s--)
  193. X        *s=0;
  194. X
  195. X    for(j=0;j<0x100;j+=0x40)
  196. X    {
  197. X    u.uscsi_flags=USCSI_DIAGNOSE|USCSI_ISOLATE|USCSI_READ;
  198. X    if(j==0x00) u.uscsi_bufaddr=(caddr_t)bcur;
  199. X    if(j==0x40) u.uscsi_bufaddr=(caddr_t)bchg;
  200. X    if(j==0x80) u.uscsi_bufaddr=(caddr_t)bdef;
  201. X    if(j==0xc0) u.uscsi_bufaddr=(caddr_t)bsav;
  202. X    u.uscsi_buflen=8000;
  203. X    memset(u.uscsi_bufaddr,0,8000);
  204. X    cdb.scc_cmd = SCMD_MODE_SENSE;
  205. X    cdb.scc_lun = 0;
  206. X    cdb.g0_addr1=0x3f | j;
  207. X    cdb.g0_count0=255;
  208. X    u.uscsi_cdb=(caddr_t)&cdb;
  209. X    u.uscsi_cdblen=6;
  210. X    i=ioctl(fd,USCSICMD,&u);
  211. X    if(i != SUCCESS)
  212. X        {
  213. X        fprintf(stderr,"i=%d ",i);
  214. X        perror("ioctl(SCSI_MODE_SENSE)");
  215. X        }
  216. X    }
  217. X
  218. X#define IFDIFF(idx,val)    if(bsav[idx] != val || bcur[idx] != val || bchg[idx] != val || bdef[idx] != val)
  219. X#define IFUNEQ(idx)    if(bsav[idx] != bcur[idx] || bsav[idx] != bchg[idx] || bsav[idx] != bdef[idx])
  220. X
  221. X    isav=icur=ichg=idef=0;
  222. X    IFUNEQ(0)
  223. X        { printf("unequal page length in MODE SENSE PAGE\n"); return; }
  224. X        Pphead("*** Mode Sense:");
  225. X    Pp1("Medium Type","%d",1);
  226. X    Pp1("Device-specific","%d",2);
  227. X    Pp1("Length of pages(@8)","%d",3);
  228. X    isav=icur=ichg=idef=4;
  229. X    IFDIFF(3,8)
  230. X        { printf("more than one page in MODE SENSE PAGE\n"); return; }
  231. X    Pp1("Density code","%d",0);
  232. X    Pp3("Number of blocks","%d",1);
  233. X    Pp3("Block length","%d",5);
  234. X    isav=icur=ichg=idef=12;
  235. X    p=bdef+idef;
  236. X    while(p < bdef+*bdef)
  237. X        {
  238. X        isav=icur=ichg=idef=p-bdef;
  239. X        sprintf(buf,"*** Page %02x:",*p&0x3f);
  240. X        Pphead(buf);
  241. X        IFUNEQ(isav+1)
  242. X        { printf("unequal page length in MODE SENSE PAGE\n"); return; }
  243. X        switch(*p & 0x3f)
  244. X        {
  245. X        case 0x03:
  246. X            Pp2("Tracks/zone","%d",2);
  247. X            Pp2("AltSect/zone","%d",4);
  248. X            Pp2("AltTrack/zone","%d",6);
  249. X            Pp2("AltTrack/LU","%d",8);
  250. X            Pp2("Sect/track","%d",10);
  251. X            Pp2("Byte/sect","%d",12);
  252. X            Pp2("InterLeave","%d",14);
  253. X            Pp2("Track skew","%d",16);
  254. X            Pp2("Cyl. skew","%d",18);
  255. X            break;
  256. X        case 0x04:
  257. X            Pp3("Cylinders","%d",2);
  258. X            Pp1("Head","%d",5);
  259. X            Pp3("Precomp cyl","%d",6);
  260. X            Pp3("reduced cyl","%d",9);
  261. X            Pp2("Step rate","%d",12);
  262. X            Pp2("Landing zone","%d",14);
  263. X            Pp1("Rotation offset","%d",18);
  264. X            Pp2("RPM","%d",20);
  265. X            break;
  266. X        }
  267. X        HexDump(bcur+icur,bcur[1+icur]+2,"    curr |");
  268. X        HexDump(bchg+ichg,bchg[1+ichg]+2,"    chg  |");
  269. X        HexDump(bdef+idef,bdef[1+idef]+2,"    def  |");
  270. X        HexDump(bsav+isav,bsav[1+isav]+2,"    save |");
  271. X        p+=p[1]+2;
  272. X        }
  273. X    return;
  274. X    }
  275. X#if 0
  276. X    {
  277. X    {
  278. X#define p2(x) ((p[x]<<8)+p[x+1])
  279. X#define p3(x) ((p[x]<<16)+(p[x+1]<<8)+p[x+2])
  280. X
  281. X    while(p < buf+*buf)
  282. X        {
  283. X        printf("  Page %02x:\n",*p&0x3f);
  284. X        switch(*p & 0x3f)
  285. X        {
  286. X        case 0x01:
  287. X            printf("    AWRE:                   %d\n",p[2]&0x80?1:0);
  288. X            printf("    ARRE:                   %d\n",p[2]&0x40?1:0);
  289. X            printf("    TB:                     %d\n",p[2]&0x20?1:0);
  290. X            printf("    RC:                     %d\n",p[2]&0x10?1:0);
  291. X            printf("    ECC:                    %d\n",p[2]&0x08?1:0);
  292. X            printf("    PER:                    %d\n",p[2]&0x04?1:0);
  293. X            printf("    DTE:                    %d\n",p[2]&0x02?1:0);
  294. X            printf("    DCR:                    %d\n",p[2]&0x01?1:0);
  295. X            printf("    Read retry count:       %d\n",p[3]);
  296. X            printf("    Correction span:        %d\n",p[4]);
  297. X            printf("    Head offset count:      %d\n",p[5]);
  298. X            printf("    Data strobe off. cnt:   %d\n",p[6]);
  299. X            printf("    Write retry count:      %d\n",p[8]);
  300. X            printf("    Recovery time limit:    %d\n",p2(10));
  301. X            break;
  302. X        case 0x02:
  303. X            printf("    Buffer full ratio:      %d\n",p[2]);
  304. X            printf("    Buffer empty ratio:     %d\n",p[3]);
  305. X            printf("    Bus inactivity limit:   %d\n",p2(4));
  306. X            printf("    Disc. time limit:       %d\n",p2(6));
  307. X            printf("    Conn. time limit:       %d\n",p2(8));
  308. X            printf("    Max burst size:         %d\n",p2(10));
  309. X            printf("    DTDC:                   %d\n",p[12]&3);
  310. X            break;
  311. X        case 0x03:
  312. X            printf("    Tracks/zone:            %d\n",
  313. X            f_trks_zone=(p[2]<<8)+p[3]);
  314. X            printf("    AltSect/zone:           %d\n",
  315. X            f_asect=(p[4]<<8)+p[5]);
  316. X            printf("    AltTrack/zone:          %d\n",(p[6]<<8)+p[7]);
  317. X            printf("    AltTrack/LU:            %d\n",
  318. X            f_atrks=(p[8]<<8)+p[9]);
  319. X            printf("    Sect/track:             %d\n",
  320. X            f_nsect=(p[10]<<8)+p[11]);
  321. X            printf("    Byte/sect:              %d\n",(p[12]<<8)+p[13]);
  322. X            printf("    Interleave:             %d\n",(p[14]<<8)+p[15]);
  323. X            printf("    Track skew:             %d\n",(p[16]<<8)+p[17]);
  324. X            printf("    Cylinder skew:          %d\n",(p[18]<<8)+p[19]);
  325. X            printf("    SSEC:                   %d\n",p[20]&0x80?1:0);
  326. X            printf("    HSEC:                   %d\n",p[20]&0x40?1:0);
  327. X            printf("    RMB:                    %d\n",p[20]&0x20?1:0);
  328. X            printf("    SURF:                   %d\n",p[20]&0x10?1:0);
  329. X            break;
  330. X        case 0x04:
  331. X            printf("    Cylinders:              %d\n",
  332. X            f_pcyl=(p[2]<<16)+(p[3]<<8)+p[4]);
  333. X            printf("    Heads:                  %d\n",
  334. X            f_nhead=p[5]);
  335. X            printf("    Write precomp start:    %d\n",p2(6));
  336. X            printf("    Write reduced start:    %d\n",p2(8));
  337. X            printf("    Drive step rate:        %d\n",p2(10));
  338. X            printf("    Landing zone:           %d\n",p2(12));
  339. X            printf("    Rotation pos. lock:     %d\n",(p[17]>>0) & 0x3);
  340. X            printf("    Rotation offset:        %d\n",p[18]);
  341. X            printf("    RPM:                    %d\n",f_rpm=p2(20));
  342. X            break;
  343. X        case 0x07:
  344. X            printf("    ERR:                    %d\n",(p[2]>>3) & 0x1);
  345. X            printf("    PER:                    %d\n",(p[2]>>2) & 0x1);
  346. X            printf("    DTE:                    %d\n",(p[2]>>1) & 0x1);
  347. X            printf("    DCR:                    %d\n",(p[2]>>0) & 0x1);
  348. X            printf("    Verify retry count:     %d\n",p[3]);
  349. X            printf("    Verify retry span:      %d\n",p[4]);
  350. X            printf("    Recovery time limit:    %d\n",p2(10));
  351. X            break;
  352. X        case 0x08:
  353. X            printf("    Write cache enable:     %d\n",(p[2]>>2) & 0x1);
  354. X            printf("    Multiplication factor:  %d\n",(p[2]>>1) & 0x1);
  355. X            printf("    Read cache disable:     %d\n",(p[2]>>0) & 0x1);
  356. X            printf("    Demand rd reten. pri:   %d\n",(p[3]>>4)&0x0f);
  357. X            printf("    Write reten. pri:       %d\n",(p[3]>>0)&0x0f);
  358. X            printf("    Dis. pre-fetch xfer-len:%d\n",p2(4));
  359. X            printf("    Minimum pre-fetch:      %d\n",p2(6));
  360. X            printf("    Maximum pre-fetch:      %d\n",p2(8));
  361. X            printf("    Max pre-fetch-ceil:     %d\n",p2(10));
  362. X            break;
  363. X        case 0x09:
  364. X            printf("    Interface Identifier:   %d\n",p2(2));
  365. X            break;
  366. X        case 0x0a:
  367. X            printf("    RLEC:                   %d\n",p[2] & 0x1);
  368. X            printf("    Queue Alg. modifier:    %d\n",(p[3]>>4) & 0xf);
  369. X            printf("    Queue Err. mgmt:        %d\n",(p[3]>>1) & 0x1);
  370. X            printf("    Disable queing:         %d\n",(p[3]>>0) & 0x1);
  371. X            printf("    EECA:                   %d\n",(p[4]>>7) & 0x1);
  372. X            printf("    RAENP:                  %d\n",(p[4]>>2) & 0x1);
  373. X            printf("    UAAENP:                 %d\n",(p[4]>>1) & 0x1);
  374. X            printf("    EAENP:                  %d\n",(p[4]>>0) & 0x1);
  375. X            printf("    EAN Holdoff:            %d\n",(p[6]<<8)+p[7]);
  376. X            break;
  377. X        case 0x0b:
  378. X            printf("    Medium type 1:          %d\n",p[4]);
  379. X            printf("    Medium type 2:          %d\n",p[5]);
  380. X            printf("    Medium type 3:          %d\n",p[6]);
  381. X            printf("    Medium type 4:          %d\n",p[7]);
  382. X            break;
  383. X        case 0x0c:
  384. X            printf("    Notched drive:          %d\n",(p[2]>>7) & 0x1);
  385. X            printf("    Log/Phys notch:         %d\n",(p[2]>>6) & 0x1);
  386. X            printf("    Max notches:            %d\n",p2(4));
  387. X            printf("    Active notch:           %d\n",p2(6));
  388. X            printf("    Start boundary:         %d\n",p2(8));
  389. X            printf("    End boundary:           %d\n",p2(10));
  390. X            printf("    Pages notched:          0x%04x\n",p2(12));
  391. X            break;
  392. X        default:
  393. X            HexDump(p,p[1]+2);
  394. X            break;
  395. X        }
  396. X        p+=p[1]+2;
  397. X        }
  398. X    }
  399. X    if(f_capacity != -1)
  400. X    {
  401. X    f_ncyl=f_capacity/(f_trks_zone*f_nsect-f_asect);
  402. X    }
  403. X    else
  404. X    {
  405. X    f_ncyl=f_pcyl-f_mgmt-f_atrks/f_nhead;
  406. X    }
  407. X    printf("\014");
  408. X    printf("# Vendor   '%s'\n",f_ven);
  409. X    printf("# Type     '%s'\n",f_typ);
  410. X    printf("# Revision '%s'\n",f_rev);
  411. X    printf("disk_type = \"%s %s (%s)\" \\\n",f_ven,f_typ,f_rev);
  412. X    printf("\t: ctlr = MD21 \\\n");
  413. X    printf("\t: pcyl = %d \\\n",f_pcyl);
  414. X    printf("\t: ncyl = %d \\\n",f_ncyl);
  415. X    printf("\t: nhead = %d \\\n",f_nhead);
  416. X    printf("\t: nsect = %d \\\n",f_nsect);
  417. X    printf("\t: atrks = %d \\\n",f_atrks);
  418. X    printf("\t: asect = %d \\\n",f_asect);
  419. X    printf("\t: trks_zone = %d \\\n",f_trks_zone);
  420. X    printf("\t: rpm = %d \\\n",3600);
  421. X    printf("\t: bpt = %d \n",36000);
  422. X    printf("\n");
  423. X    printf("# One zone = %d cyl\n",f_trks_zone/f_nhead);
  424. X    printf("# One zone = %d blocks\n",(f_trks_zone*f_nsect-f_asect));
  425. X    printf("# One zone = %d kB\n",(f_trks_zone*f_nsect-f_asect)/2);
  426. X    printf("partition = \"%s %s (%s)\" \\\n",f_ven,f_typ,f_rev);
  427. X    printf("\t: disk = \"%s %s (%s)\" \\\n",f_ven,f_typ,f_rev);
  428. X    printf("\t: ctlr = MD21 \\\n");
  429. X    printf("\t: c = 0, %d\n",
  430. X        (f_ncyl*f_nhead)*(f_trks_zone*f_nsect-f_asect)/f_trks_zone);
  431. X    }
  432. X#endif
  433. X
  434. X#define q2(p,x) ((p[x]<<8)+p[x+1])
  435. X#define q3(p,x) ((p[x]<<16)+(p[x+1]<<8)+p[x+2])
  436. XPphead(s)
  437. X    char *s;
  438. X    {
  439. X    printf("\n%-20s",s);
  440. X    printf("%15s","curr");
  441. X    printf("%15s","chg");
  442. X    printf("%15s","def");
  443. X    printf("%15s\n","save");
  444. X    }
  445. X
  446. XPp1(ldr,fmt,idx)
  447. X    char *ldr,*fmt;
  448. X    int idx;
  449. X    {
  450. X    char s[20];
  451. X    printf("%-20s",ldr);
  452. X    sprintf(s,fmt,bcur[idx+icur]); printf("%15s",s);
  453. X    sprintf(s,fmt,bchg[idx+ichg]); printf("%15s",s);
  454. X    sprintf(s,fmt,bdef[idx+idef]); printf("%15s",s);
  455. X    sprintf(s,fmt,bsav[idx+isav]); printf("%15s\n",s);
  456. X    }
  457. X
  458. XPp2(ldr,fmt,idx)
  459. X    char *ldr,*fmt;
  460. X    int idx;
  461. X    {
  462. X    char s[20];
  463. X    printf("%-20s",ldr);
  464. X    sprintf(s,fmt,q2(bcur,idx+icur)); printf("%15s",s);
  465. X    sprintf(s,fmt,q2(bchg,idx+ichg)); printf("%15s",s);
  466. X    sprintf(s,fmt,q2(bdef,idx+idef)); printf("%15s",s);
  467. X    sprintf(s,fmt,q2(bsav,idx+isav)); printf("%15s\n",s);
  468. X    }
  469. X
  470. XPp3(ldr,fmt,idx)
  471. X    char *ldr,*fmt;
  472. X    int idx;
  473. X    {
  474. X    char s[20];
  475. X    printf("%-20s",ldr);
  476. X    sprintf(s,fmt,q3(bcur,idx+icur)); printf("%15s",s);
  477. X    sprintf(s,fmt,q3(bchg,idx+ichg)); printf("%15s",s);
  478. X    sprintf(s,fmt,q3(bdef,idx+idef)); printf("%15s",s);
  479. X    sprintf(s,fmt,q3(bsav,idx+isav)); printf("%15s\n",s);
  480. X    }
  481. X
  482. END_OF_FILE
  483. if test 14506 -ne `wc -c <'scsiping.c'`; then
  484.     echo shar: \"'scsiping.c'\" unpacked with wrong size!
  485. fi
  486. # end of 'scsiping.c'
  487. fi
  488. echo shar: End of shell archive.
  489. exit 0
  490. -- 
  491. phk@data.fls.dk          || If you can't join 'em -- beat 'em !
  492. Poul-Henning Kamp      ||            the Danish foreign minister
  493. FLS DATA A/S          ||
  494. Phone: (+45) 36 18 12 35  ||
  495.