From 7eed71d9b2fe412478a22d4dce625f8ef1ef8815 Mon Sep 17 00:00:00 2001 From: Your Name Date: Fri, 13 Oct 2023 15:34:16 +0300 Subject: [PATCH] mk --- Makefile | 8 ++++---- {src => coreutils}/cat.c | 0 {src => coreutils}/chroot.c | 0 {src => coreutils}/echo.c | 0 {src => coreutils}/env.c | 0 {src => coreutils}/false.c | 0 {src => coreutils}/getloadavg.c | 0 {src => coreutils}/ln.c | 0 {src => coreutils}/ls.c | 3 ++- {src => coreutils}/mkdir.c | 0 {src => coreutils}/mkfifo.c | 0 {src => coreutils}/mknod.c | 0 {src => coreutils}/mv.c | 0 {src => coreutils}/printenv.c | 0 {src => coreutils}/pwd.c | 0 {src => coreutils}/rm.c | 0 {src => coreutils}/sync.c | 0 {src => coreutils}/touch.c | 0 {src => coreutils}/true.c | 0 {src => coreutils}/tty.c | 0 {src => coreutils}/uname.c | 0 {src => coreutils}/wc.c | 0 {src => coreutils}/whoami.c | 0 {src => coreutils}/yes.c | 0 24 files changed, 6 insertions(+), 5 deletions(-) rename {src => coreutils}/cat.c (100%) rename {src => coreutils}/chroot.c (100%) rename {src => coreutils}/echo.c (100%) rename {src => coreutils}/env.c (100%) rename {src => coreutils}/false.c (100%) rename {src => coreutils}/getloadavg.c (100%) rename {src => coreutils}/ln.c (100%) rename {src => coreutils}/ls.c (96%) rename {src => coreutils}/mkdir.c (100%) rename {src => coreutils}/mkfifo.c (100%) rename {src => coreutils}/mknod.c (100%) rename {src => coreutils}/mv.c (100%) rename {src => coreutils}/printenv.c (100%) rename {src => coreutils}/pwd.c (100%) rename {src => coreutils}/rm.c (100%) rename {src => coreutils}/sync.c (100%) rename {src => coreutils}/touch.c (100%) rename {src => coreutils}/true.c (100%) rename {src => coreutils}/tty.c (100%) rename {src => coreutils}/uname.c (100%) rename {src => coreutils}/wc.c (100%) rename {src => coreutils}/whoami.c (100%) rename {src => coreutils}/yes.c (100%) diff --git a/Makefile b/Makefile index fcde905..0658197 100644 --- a/Makefile +++ b/Makefile @@ -1,11 +1,11 @@ -C_SOURCES:=$(wildcard src/*.c) -C_TARGETS:=$(patsubst src/%.c,bin/%,$(C_SOURCES)) -TARGETS:=$(C_TARGETS) $(S_TARGETS) +C_SOURCES:=$(wildcard coreutils/*.c) +C_TARGETS:=$(patsubst coreutils/%.c,bin/%,$(C_SOURCES)) +TARGETS:=$(C_TARGETS) CFLAGS:=-s -Os -pedantic -Wall -Wextra all: bin $(TARGETS) -bin/%: src/%.c +bin/%: coreutils/%.c $(CC) $(CFLAGS) -o $@ $< clean: diff --git a/src/cat.c b/coreutils/cat.c similarity index 100% rename from src/cat.c rename to coreutils/cat.c diff --git a/src/chroot.c b/coreutils/chroot.c similarity index 100% rename from src/chroot.c rename to coreutils/chroot.c diff --git a/src/echo.c b/coreutils/echo.c similarity index 100% rename from src/echo.c rename to coreutils/echo.c diff --git a/src/env.c b/coreutils/env.c similarity index 100% rename from src/env.c rename to coreutils/env.c diff --git a/src/false.c b/coreutils/false.c similarity index 100% rename from src/false.c rename to coreutils/false.c diff --git a/src/getloadavg.c b/coreutils/getloadavg.c similarity index 100% rename from src/getloadavg.c rename to coreutils/getloadavg.c diff --git a/src/ln.c b/coreutils/ln.c similarity index 100% rename from src/ln.c rename to coreutils/ln.c diff --git a/src/ls.c b/coreutils/ls.c similarity index 96% rename from src/ls.c rename to coreutils/ls.c index b1ec5c0..34f6880 100644 --- a/src/ls.c +++ b/coreutils/ls.c @@ -34,10 +34,11 @@ int list(const char *path, int flag, int label) { if (ep->d_name[0] == '.' && !flag) continue; - puts(ep->d_name); + printf("%s ", ep->d_name); } closedir(dp); + printf("\n"); return 0; } diff --git a/src/mkdir.c b/coreutils/mkdir.c similarity index 100% rename from src/mkdir.c rename to coreutils/mkdir.c diff --git a/src/mkfifo.c b/coreutils/mkfifo.c similarity index 100% rename from src/mkfifo.c rename to coreutils/mkfifo.c diff --git a/src/mknod.c b/coreutils/mknod.c similarity index 100% rename from src/mknod.c rename to coreutils/mknod.c diff --git a/src/mv.c b/coreutils/mv.c similarity index 100% rename from src/mv.c rename to coreutils/mv.c diff --git a/src/printenv.c b/coreutils/printenv.c similarity index 100% rename from src/printenv.c rename to coreutils/printenv.c diff --git a/src/pwd.c b/coreutils/pwd.c similarity index 100% rename from src/pwd.c rename to coreutils/pwd.c diff --git a/src/rm.c b/coreutils/rm.c similarity index 100% rename from src/rm.c rename to coreutils/rm.c diff --git a/src/sync.c b/coreutils/sync.c similarity index 100% rename from src/sync.c rename to coreutils/sync.c diff --git a/src/touch.c b/coreutils/touch.c similarity index 100% rename from src/touch.c rename to coreutils/touch.c diff --git a/src/true.c b/coreutils/true.c similarity index 100% rename from src/true.c rename to coreutils/true.c diff --git a/src/tty.c b/coreutils/tty.c similarity index 100% rename from src/tty.c rename to coreutils/tty.c diff --git a/src/uname.c b/coreutils/uname.c similarity index 100% rename from src/uname.c rename to coreutils/uname.c diff --git a/src/wc.c b/coreutils/wc.c similarity index 100% rename from src/wc.c rename to coreutils/wc.c diff --git a/src/whoami.c b/coreutils/whoami.c similarity index 100% rename from src/whoami.c rename to coreutils/whoami.c diff --git a/src/yes.c b/coreutils/yes.c similarity index 100% rename from src/yes.c rename to coreutils/yes.c