changelog shortlog tags branches files raw gz bz2 help

Mercurial > hg > plan9front / changeset: libdisk: back out last change

changeset 6817: 5b18d18ae709
parent 6816: 33a523cfc084
child 6818: 40cf1430fdc5
author: cinap_lenrek@felloff.net
date: Sat, 13 Oct 2018 00:07:46 +0200
files: sys/src/libdisk/proto.c
description: libdisk: back out last change
     1.1--- a/sys/src/libdisk/proto.c
     1.2+++ b/sys/src/libdisk/proto.c
     1.3@@ -486,9 +486,9 @@ skipdir(Mkaux *mkaux)
     1.4 	level = mkaux->indent;
     1.5 	for(;;){
     1.6 		mkaux->indent = 0;
     1.7+		p = Brdline(mkaux->b, '\n');
     1.8 		mkaux->lineno++;
     1.9-		p = Brdline(mkaux->b, '\n');
    1.10-		if(p == nil || p[Blinelen(mkaux->b)-1] != '\n'){
    1.11+		if(!p){
    1.12 			mkaux->indent = -1;
    1.13 			return;
    1.14 		}
    1.15@@ -517,37 +517,38 @@ getfile(Mkaux *mkaux, File *old)
    1.16 	int c;
    1.17 
    1.18 	if(mkaux->indent < 0)
    1.19-		return nil;
    1.20+		return 0;
    1.21 loop:
    1.22 	mkaux->indent = 0;
    1.23+	p = Brdline(mkaux->b, '\n');
    1.24 	mkaux->lineno++;
    1.25-	p = Brdline(mkaux->b, '\n');
    1.26-	s = &p[Blinelen(mkaux->b)-1];
    1.27-	if(p == nil || *s != '\n'){
    1.28+	if(!p){
    1.29 		mkaux->indent = -1;
    1.30-		return nil;
    1.31+		return 0;
    1.32 	}
    1.33-	*s = 0;
    1.34-	while((c = *p++) != 0)
    1.35+	while((c = *p++) != '\n')
    1.36 		if(c == ' ')
    1.37 			mkaux->indent++;
    1.38 		else if(c == '\t')
    1.39 			mkaux->indent += 8;
    1.40 		else
    1.41 			break;
    1.42-	if(c == 0 || c == '#')
    1.43+	if(c == '\n' || c == '#')
    1.44 		goto loop;
    1.45 	p--;
    1.46 	popopt(mkaux);
    1.47+	*strchr(p, '\n') = 0;
    1.48 	if(s = strchr(p, '=')){
    1.49 		*s++ = 0;
    1.50 		setopt(mkaux, p, s);
    1.51 		goto loop;
    1.52-	}
    1.53+	}else
    1.54+		p[strlen(p)] = '\n';
    1.55 	f = emalloc(mkaux, sizeof *f);
    1.56 	p = getname(mkaux, p, &elem);
    1.57 	if(p == nil)
    1.58 		return nil;
    1.59+
    1.60 	f->new = mkpath(mkaux, old->new, elem);
    1.61 	free(elem);
    1.62 	f->elem = utfrrune(f->new, L'/') + 1;
    1.63@@ -567,7 +568,7 @@ loop:
    1.64 	f->old = getpath(mkaux, p);
    1.65 	if(f->old && strcmp(f->old, "-") == 0){
    1.66 		free(f->old);
    1.67-		f->old = nil;
    1.68+		f->old = 0;
    1.69 	}
    1.70 	setname(mkaux, &mkaux->oldfile, f);
    1.71 
    1.72@@ -583,10 +584,10 @@ getpath(Mkaux *mkaux, char *p)
    1.73 	while((c = *p) == ' ' || c == '\t')
    1.74 		p++;
    1.75 	q = p;
    1.76-	while((c = *q) != 0 && c != ' ' && c != '\t')
    1.77+	while((c = *q) != '\n' && c != ' ' && c != '\t')
    1.78 		q++;
    1.79 	if(q == p)
    1.80-		return nil;
    1.81+		return 0;
    1.82 	n = q - p;
    1.83 	new = emalloc(mkaux, n + 1);
    1.84 	memcpy(new, p, n);
    1.85@@ -604,7 +605,7 @@ getname(Mkaux *mkaux, char *p, char **bu
    1.86 		p++;
    1.87 
    1.88 	start = p;
    1.89-	while((c = *p) != 0 && c != ' ' && c != '\t')
    1.90+	while((c = *p) != '\n' && c != ' ' && c != '\t')
    1.91 		p++;
    1.92 
    1.93 	*buf = malloc(p+2-start);	/* +2: need at least 2 bytes; might strcpy "-" into buf */
    1.94@@ -616,7 +617,7 @@ getname(Mkaux *mkaux, char *p, char **bu
    1.95 
    1.96 	if(**buf == '$'){
    1.97 		s = getenv(*buf+1);
    1.98-		if(s == nil){
    1.99+		if(s == 0){
   1.100 			warn(mkaux, "can't read environment variable %s", *buf+1);
   1.101 			skipdir(mkaux);
   1.102 			free(*buf);