ref: 4742c552904c44bc77604b7cf03ed7b14e2e7ef4
parent: d8d7e5747b363f8400f198c79875456b7f6c5193
author: rodri <rgl@antares-labs.eu>
date: Wed Sep 25 11:29:23 EDT 2024
don't write a \n to errstr. survive referring to files in dot.
--- a/obj.c
+++ b/obj.c
@@ -29,7 +29,7 @@
bp = seprint(buf, buf + sizeof buf, "%s:%lud ", curline.file, curline.lineno);
vseprint(bp, buf + sizeof buf, fmt, va);
va_end(va);
- werrstr("%s\n", buf);
+ werrstr("%s", buf);
}
static void
@@ -42,7 +42,7 @@
bp = seprint(buf, buf + sizeof buf, "%s:%lud ", curmtline.file, curmtline.lineno);
vseprint(bp, buf + sizeof buf, fmt, va);
va_end(va);
- werrstr("%s\n", buf);
+ werrstr("%s", buf);
}
static void *
@@ -382,6 +382,8 @@
if((p = strrchr(curline.file, '/')) != nil)
snprint(buf, sizeof buf, "%.*s/%s", (int)(p-curline.file), curline.file, file);
+ else
+ snprint(buf, sizeof buf, "%s", file);
bin = Bopen(buf, OREAD);
if(bin == nil)
@@ -510,7 +512,10 @@
mterror("no material found");
goto error;
}
- snprint(buf, sizeof buf, "%.*s/%s", (int)(p-curline.file), curline.file, f[1]);
+ if(p != nil)
+ snprint(buf, sizeof buf, "%.*s/%s", (int)(p-curline.file), curline.file, f[1]);
+ else
+ snprint(buf, sizeof buf, "%s", f[1]);
if((m->map_Kd = readimagefile(buf)) == nil){
mterror("readimagefile: %r");
goto error;
@@ -524,7 +529,10 @@
mterror("no material found");
goto error;
}
- snprint(buf, sizeof buf, "%.*s/%s", (int)(p-curline.file), curline.file, f[1]);
+ if(p != nil)
+ snprint(buf, sizeof buf, "%.*s/%s", (int)(p-curline.file), curline.file, f[1]);
+ else
+ snprint(buf, sizeof buf, "%s", f[1]);
if((m->norm = readimagefile(buf)) == nil){
mterror("readimagefile: %r");
goto error;