commit b669c8642e21850ea561931633ae06e6ba5bf354
parent b52f376a0f18db0dc8b2c8707cf3f41d32fd9a10
Author: FRIGN <dev@frign.de>
Date: Tue, 5 Jan 2016 11:16:11 +0100
farbfeld.5: exit() -> return
Now that we're in main, we don't need to exit().
Also, we should return 0 at the end, thanks Hiltjo!
Diffstat:
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/farbfeld.5 b/farbfeld.5
@@ -64,23 +64,23 @@ main(int argc, char *argv[])
if (argc > 1) {
fprintf(stderr, "usage: %s\\n", argv[0]);
- exit(1);
+ return 1;
}
if (fread(hdr, 1, sizeof(hdr), stdin) != sizeof(hdr)) {
fprintf(stderr, "incomplete header\\n");
- exit(1);
+ return 1;
}
if (memcmp("farbfeld", hdr, strlen("farbfeld"))) {
fprintf(stderr, "invalid magic\\n");
- exit(1);
+ return 1;
}
width = ntohl(*((uint32_t *)(hdr + 8)));
height = ntohl(*((uint32_t *)(hdr + 12)));
if (fwrite(hdr, 1, sizeof(hdr), stdout) != sizeof(hdr)) {
fprintf(stderr, "write error\\n");
- exit(1);
+ return 1;
}
for (i = 0; i < height; i++) {
@@ -88,7 +88,7 @@ main(int argc, char *argv[])
if (fread(rgba, sizeof(uint16_t), 4,
stdin) != 4) {
fprintf(stderr, "unexpected EOF\\n");
- exit(1);
+ return 1;
}
for (k = 0; k < 4; k++) {
rgba[k] = ntohs(rgba[k]);
@@ -105,10 +105,12 @@ main(int argc, char *argv[])
if (fwrite(rgba, sizeof(uint16_t), 4,
stdout) != 4) {
fprintf(stderr, "write error\\n");
- exit(1);
+ return 1;
}
}
}
+
+ return 0;
}
.Ed
.Sh SEE ALSO