rossiter@GVAX.CS.CORNELL.EDU ("David G. Rossiter") (11/21/85)
Reference:/usr/src/bin/size/size.c Problem: The size(1) command didn't work right: it always returned an error status of -1. Solution: Here's the context diff: *** size.c.old Wed Nov 20 16:15:28 1985 --- size.c Wed Nov 20 15:52:37 1985 *************** *** 4,9 **** --- 4,11 ---- * size */ + /* return the correct status on exit -- dgr cucs 19851120 */ + #include <stdio.h> #include <a.out.h> *************** *** 15,20 **** --- 17,23 ---- struct exec buf; long sum; int gorp,i; + int err = 0; FILE *f; if (argc==1) { *************** *** 27,32 **** --- 30,36 ---- ++argv; if ((f = fopen(*argv, "r"))==NULL) { printf("size: %s not found\n", *argv); + err++; continue; } if (fread((char *)&buf, sizeof(buf), 1, f) != 1 || *************** *** 33,38 **** --- 37,43 ---- N_BADMAG(buf)) { printf("size: %s not an object file\n", *argv); fclose(f); + err++; continue; } if (header == 0) { *************** *** 47,50 **** --- 52,56 ---- printf("\n"); fclose(f); } + exit(err); } ------- and here's an ed(1) script to effect the change: 49a exit(err); . 35a err++; . 29a err++; . 17a int err = 0; . 6a /* return the correct status on exit -- dgr cucs 19851120 */ . ------- then 'make all ; make install' in /usr/src/bin/size