Separate log and output streams
This commit is contained in:
+5
-10
@@ -2,23 +2,18 @@
|
||||
#include "src/lib/util.h"
|
||||
#include "src/user/syscall.h"
|
||||
|
||||
#define BLOCK_SIZE 65536
|
||||
|
||||
#define PRINT_S(s) write(1, s, sizeof(s) - 1);
|
||||
#define PRINT_D(s) write(1, s, string_length(s));
|
||||
|
||||
exit_code_t main(uint64_t argc, const char **argv) {
|
||||
if (argc < 2) {
|
||||
PRINT_S("rm: requires one or more arguments\n");
|
||||
ERR_S("rm: requires one or more arguments\n");
|
||||
return EXIT_CODE_GENERAL_FAILURE;
|
||||
}
|
||||
|
||||
uint64_t code = EXIT_CODE_OK;
|
||||
for (uint64_t i = 1; i < argc; i++) {
|
||||
exit_code_t c = remove(argv[i]);
|
||||
if (c != EXIT_CODE_OK) {
|
||||
PRINT_S("rm: coult not remove file\n");
|
||||
code = c;
|
||||
uint64_t removed = remove(argv[i]);
|
||||
if (removed == (uint64_t)-1) {
|
||||
ERR_S("rm: could not remove file\n");
|
||||
code = EXIT_CODE_GENERAL_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user