summaryrefslogtreecommitdiff
path: root/farbfeld.5
diff options
context:
space:
mode:
authorFRIGN <dev@frign.de>2016-01-05 11:16:11 +0100
committerFRIGN <dev@frign.de>2016-01-05 11:16:43 +0100
commitb669c8642e21850ea561931633ae06e6ba5bf354 (patch)
tree19216b811cc81254e5c450a94e34d835aa7169af /farbfeld.5
parentb52f376a0f18db0dc8b2c8707cf3f41d32fd9a10 (diff)
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 (limited to 'farbfeld.5')
-rw-r--r--farbfeld.514
1 files changed, 8 insertions, 6 deletions
diff --git a/farbfeld.5 b/farbfeld.5
index 2ed3354..62e327a 100644
--- 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