diff options
author | rodri <rgl@antares-labs.eu> | 2024-09-25 15:29:23 +0000 |
---|---|---|
committer | rodri <rgl@antares-labs.eu> | 2024-09-25 15:29:23 +0000 |
commit | 4742c552904c44bc77604b7cf03ed7b14e2e7ef4 (patch) | |
tree | 99dd2df6bffcf44f62fdec0dba5d2b5f2490146e /obj.c | |
parent | d8d7e5747b363f8400f198c79875456b7f6c5193 (diff) | |
download | libobj-4742c552904c44bc77604b7cf03ed7b14e2e7ef4.tar.gz libobj-4742c552904c44bc77604b7cf03ed7b14e2e7ef4.tar.bz2 libobj-4742c552904c44bc77604b7cf03ed7b14e2e7ef4.zip |
don't write a \n to errstr. survive referring to files in dot.
Diffstat (limited to 'obj.c')
-rw-r--r-- | obj.c | 16 |
1 files changed, 12 insertions, 4 deletions
@@ -29,7 +29,7 @@ error(char *fmt, ...) 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 @@ mterror(char *fmt, ...) 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 @@ objmtlparse(char *file) 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 @@ objmtlparse(char *file) 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 @@ objmtlparse(char *file) 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; |