[hackers] [farbfeld] farbfeld.5: exit() -> return || FRIGN
commit b669c8642e21850ea561931633ae06e6ba5bf354
Author: FRIGN <dev_AT_frign.de>
AuthorDate: Tue Jan 5 11:16:11 2016 +0100
Commit: FRIGN <dev_AT_frign.de>
CommitDate: Tue Jan 5 11:16:43 2016 +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!
diff --git a/farbfeld.5 b/farbfeld.5
index 2ed3354..62e327a 100644
--- a/farbfeld.5
+++ b/farbfeld.5
_AT_@ -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++) {
_AT_@ -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]);
_AT_@ -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
Received on Tue Jan 05 2016 - 11:17:21 CET
This archive was generated by hypermail 2.3.0
: Tue Jan 05 2016 - 11:24:14 CET