diff --git a/build.sh b/build.sh index 65c3515..9ed22bb 100755 --- a/build.sh +++ b/build.sh @@ -1,6 +1,6 @@ #!/bin/bash PROJECT_DIR=$(pwd) -CFLAGS="-Wall -Wextra -I$PROJECT_DIR -I$PROJECT_DIR/include/libmu -lm" +CFLAGS="-pedantic -s -Os -Wall -Wextra -I$PROJECT_DIR -I$PROJECT_DIR/include/libmu -lm" projects="console-tools coreutils sysutils sysutils-linux findutils networking miscutils shell loginutils procps" CC=cc diff --git a/src/coreutils/ls/ls.c b/src/coreutils/ls/ls.c index df54ba8..81797b7 100644 --- a/src/coreutils/ls/ls.c +++ b/src/coreutils/ls/ls.c @@ -25,6 +25,7 @@ unsigned int R_flag; unsigned int d_flag; unsigned int L_flag; unsigned int h_flag; +unsigned int i_flag; unsigned int p_flag; struct d_node { @@ -187,14 +188,16 @@ int print(const struct d_node *node) { color = LS_EXE_COLOR; } + int ret = 0; + if (i_flag) + ret += printf("%7ju ", (uintmax_t)node->stats.st_ino); /* Output */ if (c_flag && p_flag) printf("%s", color); - int ret = 0; if (!l_flag) - ret = printf("%s%c ", node->name, (F_flag) ? suf : 0); + ret += printf("%s%c ", node->name, (F_flag) ? suf : 0); if (l_flag) { putchar(ind); @@ -214,10 +217,10 @@ int print(const struct d_node *node) { char *gr_name = (gr != 0) ? gr->gr_name : "nobody"; char *pw_name = (pw != 0) ? pw->pw_name : "nobody"; if (h_flag) - ret = printf(" %s %s %6s %s %s%c", pw_name, gr_name, mu_humansize(node->stats.st_size), date, node->name, (F_flag) ? suf : 0); + ret += printf(" %s %s %6s %s %s%c", pw_name, gr_name, mu_humansize(node->stats.st_size), date, node->name, (F_flag) ? suf : 0); else - ret = printf(" %s %s %10jd %s %s%c", pw_name, gr_name, (uintmax_t)node->stats.st_size, date, node->name, (F_flag) ? suf : 0); + ret += printf(" %s %s %10jd %s %s%c", pw_name, gr_name, (uintmax_t)node->stats.st_size, date, node->name, (F_flag) ? suf : 0); } if (c_flag && p_flag) @@ -235,6 +238,9 @@ void col_print(struct d_node **node, size_t files, struct winsize w) { /* Calc */ maxlen += 3; + if (i_flag) + maxlen += 10; + size_t ncols = w.ws_col / maxlen; size_t nrows = files; if (ncols > 1) { @@ -315,7 +321,7 @@ int ls(const char *dir_name, int label, struct winsize w) { int main(int argc, char **argv) { int opt; - while ((opt = getopt(argc, argv, "1alFcRdLh")) != -1) { + while ((opt = getopt(argc, argv, "1alFcRdLhi")) != -1) { switch (opt) { case '1': O_flag = 1; @@ -355,8 +361,12 @@ int main(int argc, char **argv) { h_flag = 1; break; + case 'i': + i_flag = 1; + break; + default: - printf("ls [dir1 dir2...]\n\t[-a Show hidden files]\n\t[-l Use a long listing format]\n\t[-F Append indicator to names]\n\t[-c Color mode] [-R Recursive]\n\t[-1 One column] [-d Print only dir names]\n\t[-L Follow symlinks]\n\t[-h Sizes in human readable format]\n"); + printf("ls [dir1 dir2...]\n\t[-a Show hidden files]\n\t[-l Use a long listing format]\n\t[-F Append indicator to names]\n\t[-c Color mode] [-R Recursive]\n\t[-1 One column] [-d Print only dir names]\n\t[-L Follow symlinks]\n\t[-h Sizes in human readable format]\n\t[-i Listen inodes]\n"); return 0; } } diff --git a/src/sysutils/mount/mount.c b/src/sysutils/mount/mount.c index b508a16..474cd6a 100644 --- a/src/sysutils/mount/mount.c +++ b/src/sysutils/mount/mount.c @@ -11,9 +11,6 @@ int do_mount(const char *src, const char *dst, const char *fs_type, unsigned lon #if defined(__linux__) int ret = mount(src, dst, fs_type, opt, NULL); -#elif defined(__plainos__) - int ret = mount(src, dst, fs_type, opt); - #else int ret = -1;