changelog shortlog tags branches changeset file revisions annotate raw help

Mercurial > hg > plan9front / sys/src/cmd/7l/obj.c

revision 4275: d1102fefd6c1
parent 0: eaccc3e8d226
     1.1--- a/sys/src/cmd/7l/obj.c
     1.2+++ b/sys/src/cmd/7l/obj.c
     1.3@@ -253,11 +253,9 @@ objfile(char *file)
     1.4 
     1.5 	if(file[0] == '-' && file[1] == 'l') {
     1.6 		if(debug['9'])
     1.7-			sprint(name, "/%s/lib/lib", thestring);
     1.8+			snprint(name, sizeof name, "/%s/lib/lib%s.a", thestring, file+2);
     1.9 		else
    1.10-			sprint(name, "/usr/%clib/lib", thechar);
    1.11-		strcat(name, file+2);
    1.12-		strcat(name, ".a");
    1.13+			snprint(name, sizeof name, "/usr/%clib/lib%s.a", thechar, file+2);
    1.14 		file = name;
    1.15 	}
    1.16 	if(debug['v'])
    1.17@@ -317,7 +315,7 @@ objfile(char *file)
    1.18 			s = lookup(e+5, 0);
    1.19 			if(s->type != SXREF)
    1.20 				continue;
    1.21-			sprint(pname, "%s(%s)", file, s->name);
    1.22+			snprint(pname, sizeof pname, "%s(%s)", file, s->name);
    1.23 			if(debug['v'])
    1.24 				Bprint(&bso, "%5.2f library: %s\n", cputime(), pname);
    1.25 			Bflush(&bso);
    1.26@@ -464,17 +462,17 @@ addlib(char *obj)
    1.27 		return;
    1.28 
    1.29 	if(histfrog[0]->name[1] == '/') {
    1.30-		sprint(name, "");
    1.31+		name[0] = 0;
    1.32 		i = 1;
    1.33 	} else
    1.34 	if(histfrog[0]->name[1] == '.') {
    1.35-		sprint(name, ".");
    1.36+		snprint(name, sizeof name, ".");
    1.37 		i = 0;
    1.38 	} else {
    1.39 		if(debug['9'])
    1.40-			sprint(name, "/%s/lib", thestring);
    1.41+			snprint(name, sizeof name, "/%s/lib", thestring);
    1.42 		else
    1.43-			sprint(name, "/usr/%clib", thechar);
    1.44+			snprint(name, sizeof name, "/usr/%clib", thechar);
    1.45 		i = 0;
    1.46 	}
    1.47 
    1.48@@ -878,7 +876,7 @@ loop:
    1.49 
    1.50 		if(p->from.type == D_FCONST) {
    1.51 			/* size sb 9 max */
    1.52-			sprint(literal, "$%lux", ieeedtof(p->from.ieee));
    1.53+			snprint(literal, sizeof literal, "$%lux", ieeedtof(p->from.ieee));
    1.54 			s = lookup(literal, 0);
    1.55 			if(s->type == 0) {
    1.56 				s->type = SBSS;
    1.57@@ -907,7 +905,7 @@ loop:
    1.58 
    1.59 		if(p->from.type == D_FCONST) {
    1.60 			/* size sb 18 max */
    1.61-			sprint(literal, "$%lux.%lux",
    1.62+			snprint(literal, sizeof literal, "$%lux.%lux",
    1.63 				p->from.ieee->l, p->from.ieee->h);
    1.64 			s = lookup(literal, 0);
    1.65 			if(s->type == 0) {