🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: mod.computers.gould
1 messages
1 total messages Started by "David G. Rossiter" Wed, 20 Nov 1985 21:23
size(1) was broken
#5
Author: "David G. Rossiter"
Date: Wed, 20 Nov 1985 21:23
80 lines
2054 bytes
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
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads