From ce8e5356a6264d5a3e2403c5dbb387524925a82e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ali=20Furkan=20Y=C4=B1ld=C4=B1z?= Date: Wed, 11 Jan 2023 19:27:06 +0300 Subject: [PATCH] add cecho --- README.md | 2 +- c/cecho.c | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 c/cecho.c diff --git a/README.md b/README.md index 572e9b3..3821481 100644 --- a/README.md +++ b/README.md @@ -9,4 +9,4 @@ All code is licensed under GPL-3.0 unless specified otherwise. | C | Bash | JS | | ---------------------- | :-------------------------: | --- | | [unlink.c](c/unlink.c) | [arshit](shell/bash/arshit) | | -| | | | +| [cecho.c](c/cecho.c) | | | diff --git a/c/cecho.c b/c/cecho.c new file mode 100644 index 0000000..abd963e --- /dev/null +++ b/c/cecho.c @@ -0,0 +1,14 @@ +#include +#include + +int main(int argc, char **argv) { + for (int i = 1; i < argc; i++) { + printf("\033[%dm%s", i % 2, argv[i]); + if (i != argc - 1) + putchar(' '); + } +} + +// Compilation: cc unlink.c -o unlink +// Usage: ./unlink FILES ... +// License: Public Domain