From c908b952f07361aa11f5c4c839959947a80d7963 Mon Sep 17 00:00:00 2001 From: Your Name Date: Sat, 3 Feb 2024 18:36:30 +0300 Subject: [PATCH] some fixes --- src/coreutils/dd/dd.c | 1 - src/coreutils/printenv/printenv.c | 16 ++++------------ src/loginutils/login/login.c | 2 +- 3 files changed, 5 insertions(+), 14 deletions(-) diff --git a/src/coreutils/dd/dd.c b/src/coreutils/dd/dd.c index b750469..95244a5 100644 --- a/src/coreutils/dd/dd.c +++ b/src/coreutils/dd/dd.c @@ -89,7 +89,6 @@ int main(int argc, char **argv) { off_t skip = 0; off_t seek = 0; - off_t count = -1; off_t bs = 0; off_t ibs = 512; diff --git a/src/coreutils/printenv/printenv.c b/src/coreutils/printenv/printenv.c index 8dd6565..79a595d 100644 --- a/src/coreutils/printenv/printenv.c +++ b/src/coreutils/printenv/printenv.c @@ -2,7 +2,6 @@ #include #include #include -char n_flag = '\n'; int printvars(int len, char **names) { int ret = 0; @@ -14,7 +13,7 @@ int printvars(int len, char **names) { continue; } - printf("%s%c", val, n_flag); + printf("%s\n", val); } return ret; @@ -23,15 +22,8 @@ int printvars(int len, char **names) { int main(int argc, char **argv, const char **envp) { int opt; while ((opt = getopt(argc, argv, "0")) != -1) { - switch (opt) { - case '0': - n_flag = '\0'; - break; - - default: - printf("printenv [var1 var2...]\n\t[-0 end each output line with NUL]\n"); - return 0; - } + printf("printenv [var1 var2...]\n"); + return 0; } argv += optind; @@ -39,7 +31,7 @@ int main(int argc, char **argv, const char **envp) { if (argc == 0) while (*envp) - printf("%s%c", *envp++, n_flag); + printf("%s\n", *envp++); else return printvars(argc, argv); diff --git a/src/loginutils/login/login.c b/src/loginutils/login/login.c index f548623..44123de 100644 --- a/src/loginutils/login/login.c +++ b/src/loginutils/login/login.c @@ -30,7 +30,7 @@ int hide_input(int fd, int flag) { } void login(const struct passwd *pw) { - char *shell = pw->pw_shell[0] == '\0' ? "/bin/sh" : pw->pw_shell; + char *shell = (pw->pw_shell[0] == '\0') ? "/bin/sh" : pw->pw_shell; setenv("HOME", pw->pw_dir, 1); setenv("SHELL", shell, 1);