From 128213b19cc038d57f55d53583439b9e69cc2574 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Thu, 21 May 2015 23:36:41 +0100 Subject: [PATCH] printenv: remove stdio --- Applications/util/printenv.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Applications/util/printenv.c b/Applications/util/printenv.c index ee6e8059..fe54c891 100644 --- a/Applications/util/printenv.c +++ b/Applications/util/printenv.c @@ -2,12 +2,19 @@ * Copyright (c) 1993 by David I. Bell * Permission is granted to use, distribute, or modify this source, * provided that this copyright notice remains intact. + * + * Stdio usage removed Alan Cox 2015 */ #include #include #include +void writesnl(const char *p) +{ + write(1, p, strlen(p)); + write(1, "\n", 1); +} int main(int argc, char *argv[]) { @@ -19,7 +26,7 @@ int main(int argc, char *argv[]) if (argc == 1) { while (*env) - printf("%s\n", *env++); + writesnl(*env++); return 0; } @@ -27,7 +34,7 @@ int main(int argc, char *argv[]) while (*env) { if ((strlen(*env) > len) && (env[0][len] == '=') && (memcmp(argv[1], *env, len) == 0)) { - printf("%s\n", &env[0][len + 1]); + writesnl(&env[0][len + 1]); return 0; } env++; -- 2.34.1