diff --git a/TODO b/TODO index eb123b1..5336dad 100644 --- a/TODO +++ b/TODO @@ -1,7 +1,6 @@ With "micro-" prefix *Todo: -*echo tail expr uniq @@ -54,7 +53,7 @@ Modutils (linux only): Findutils: grep find - *xargs (-r flag) + Shell: rc - run command (1 2 3 ~ | <> <<>> & * " parsing) (sig handler) @@ -63,3 +62,4 @@ Init: BUGS: ls (unicode strlen, -l flag col) + xargs (getopt with glibc) diff --git a/config.h b/config.h index 2053327..e462d79 100644 --- a/config.h +++ b/config.h @@ -31,6 +31,8 @@ /* Max args (xargs) */ #define NARGS 1024 + +/* Arg size (xargs) */ #define ARG_SIZE 1024 /* Default cmd (xargs) */ diff --git a/coreutils/cat.c b/coreutils/cat.c index 30528a9..33da0b5 100644 --- a/coreutils/cat.c +++ b/coreutils/cat.c @@ -19,7 +19,10 @@ int cat(const char *path) { char buf[BUF_SIZE + 1]; off_t len = 0; while ((len = read(fd, buf, sizeof(buf))) > 0) - write(STDOUT_FILENO, buf, len); + if (write(STDOUT_FILENO, buf, len) != len) { + fprintf(stderr, "cat: %s\n", strerror(errno)); + return 1; + } if (strcmp(path, "-")) close(fd); diff --git a/coreutils/chroot.c b/coreutils/chroot.c index 99a5910..93d08b6 100644 --- a/coreutils/chroot.c +++ b/coreutils/chroot.c @@ -15,7 +15,7 @@ int main(const int argc, char **argv) { return 1; } - chdir("/"); + (void)chdir("/"); if (execvp(argv[2], argv + 2) < 0) { fprintf(stderr, "chroot: %s\n", strerror(errno)); return 1; diff --git a/coreutils/shred.c b/coreutils/shred.c index 235b402..70c7116 100644 --- a/coreutils/shred.c +++ b/coreutils/shred.c @@ -26,7 +26,7 @@ int shred(int rand_fd, int fd) { } for (unsigned int n = 0; n < n_loops; n++) { - read(rand_fd, buf, size); + (void)read(rand_fd, buf, size); fsync(fd); } diff --git a/coreutils/tee.c b/coreutils/tee.c index fbf2403..3146854 100644 --- a/coreutils/tee.c +++ b/coreutils/tee.c @@ -42,10 +42,10 @@ int main(int argc, char **argv) { char buf[BUF_SIZE + 1]; off_t bytes = 0; while ((bytes = read(STDIN_FILENO, buf, sizeof(buf)))) { - write(STDOUT_FILENO, buf, bytes); + (void)write(STDOUT_FILENO, buf, bytes); if (argc > 0) - write(fd, buf, bytes); + (void)write(fd, buf, bytes); } if (argc > 0) diff --git a/sysutils/nologin.c b/loginutils/nologin.c similarity index 100% rename from sysutils/nologin.c rename to loginutils/nologin.c diff --git a/sysutils-linux/dmesg.c b/sysutils-linux/dmesg.c index 9e79c98..f353da2 100644 --- a/sysutils-linux/dmesg.c +++ b/sysutils-linux/dmesg.c @@ -57,7 +57,7 @@ int main(int argc, char **argv) { /* Print */ - write(STDOUT_FILENO, buf, n); + (void)write(STDOUT_FILENO, buf, n); putchar('\n'); free(buf);