aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFerass El Hafidi <vitali64pmemail@protonmail.com>2023-01-11 18:05:28 +0100
committerFerass El Hafidi <vitali64pmemail@protonmail.com>2023-01-11 18:05:28 +0100
commit1221595cdd7544627fa051c7bbfa71355163aaf4 (patch)
tree637353e630015196e2d84017dda9b720b6939e24
parentd889bb84d54568f9bdb6e032d1269f30e84df8e5 (diff)
downloadfases-1221595cdd7544627fa051c7bbfa71355163aaf4.tar.gz
fases-1221595cdd7544627fa051c7bbfa71355163aaf4.zip
core/common.*: Move them somewhere else so they can be used by non-POSIX utils
Signed-off-by: Ferass El Hafidi <vitali64pmemail@protonmail.com>
-rw-r--r--Makefile4
-rw-r--r--box.c2
-rw-r--r--common/common.c (renamed from core/common.c)0
-rw-r--r--common/common.h (renamed from core/common.h)0
-rw-r--r--core/Makefile2
-rw-r--r--core/basename.c4
-rw-r--r--core/cat.c6
-rw-r--r--core/chmod.c4
-rw-r--r--core/chown.c6
-rw-r--r--core/dirname.c4
-rw-r--r--core/ed.c6
-rw-r--r--core/head.c6
-rw-r--r--core/link.c6
-rw-r--r--core/ln.c6
-rw-r--r--core/ls.c6
-rw-r--r--core/mkdir.c6
-rw-r--r--core/more.c6
-rw-r--r--core/mv.c6
-rw-r--r--core/printf.c4
-rw-r--r--core/rm.c6
-rw-r--r--core/sleep.c4
-rw-r--r--core/tail.c6
-rw-r--r--core/uname.c6
-rw-r--r--core/unlink.c6
-rw-r--r--core/wc.c6
25 files changed, 59 insertions, 59 deletions
diff --git a/Makefile b/Makefile
index 534a2f7..95964ab 100644
--- a/Makefile
+++ b/Makefile
@@ -38,12 +38,12 @@ genbox:
prepbox:
mkdir -p box_tmp
- for f in ${CORE}; do sed "s/^int main(/int $$(echo "$$f")_main(/" < "core/"$$f".c" | sed "s/\"common/\"core\/common/g" | sed "s/\[_/test_/g" > "box_tmp/"$$f"_box.c"; done
+ for f in ${CORE}; do (sed "s/^int main(/int $$(echo "$$f")_main(/" < "core/"$$f".c" | sed "s/\"..\/common/\"common/g" | sed "s/\[_/test_/g") > "box_tmp/"$$f"_box.c"; done
rm -f "box_tmp/[_box.c"
test ${INCLUDE_EXTRA} == n || for f in ${EXTRA}; do sed "s/^int main(/int $$(echo "$$f")_main(/" < "extras/"$$f".c" | sed "s/printUsage()/$$(echo "$$f")_printUsage()/g" > "box_tmp/"$$f"_box.c"; done
box: box.o
- $(CC) $(CFLAGS) box_tmp/*.c core/common.c box.o -o box
+ $(CC) $(CFLAGS) box_tmp/*.c common/common.c box.o -o box
rm -f version.h
clean:
diff --git a/box.c b/box.c
index 5d2a801..6758d37 100644
--- a/box.c
+++ b/box.c
@@ -120,4 +120,4 @@ int main(int argc, char *argv[]) {
return 0;
}
/* END */
-/* Generated on Fri 6 Jan 19:54:45 CET 2023 */
+/* Generated on Wed 11 Jan 18:03:07 CET 2023 */
diff --git a/core/common.c b/common/common.c
index f9f8f52..f9f8f52 100644
--- a/core/common.c
+++ b/common/common.c
diff --git a/core/common.h b/common/common.h
index 234bd26..234bd26 100644
--- a/core/common.h
+++ b/common/common.h
diff --git a/core/Makefile b/core/Makefile
index 4360c5b..121c7ae 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -39,7 +39,7 @@ config:
@echo "INCLUDE_EXTRA = $(INCLUDE_EXTRA)"
.o:
- [ ! -e $< ] || $(CC) $(CFLAGS) $< common.c -o $@
+ [ ! -e $< ] || $(CC) $(CFLAGS) $< ../common/common.c -o $@
.c.o:
[ ! -e $< ] || $(CC) $(CFLAGS) $(NOLINKER) $< -o $@
diff --git a/core/basename.c b/core/basename.c
index 0d7c0bf..86ec6af 100644
--- a/core/basename.c
+++ b/core/basename.c
@@ -32,10 +32,10 @@
#include <string.h>
#include <libgen.h>
-#define REQ_PRINT_USAGE /* print_usage() from common.h */
+#define REQ_PRINT_USAGE /* print_usage() from ../common/common.h */
#define DESCRIPTION "Return non-directory portion of <string>."
#define OPERANDS "string [suffix]"
-#include "common.h"
+#include "../common/common.h"
int main(int argc, char *argv[]) {
int status;
diff --git a/core/cat.c b/core/cat.c
index 6f857ce..6aa3124 100644
--- a/core/cat.c
+++ b/core/cat.c
@@ -33,12 +33,12 @@
#include <errno.h>
#include <string.h>
-#define REQ_PRINT_USAGE /* Require print_usage() from common.h */
-#define REQ_ERRPRINT /* Require errprint() from common.h */
+#define REQ_PRINT_USAGE /* Require print_usage() from ../common/common.h */
+#define REQ_ERRPRINT /* Require errprint() from ../common/common.h */
#define DESCRIPTION "Concatenate a file to standard output. \
If no file is specified or file is '-', read standard input."
#define OPERANDS "[-u] [file] ..."
-#include "common.h"
+#include "../common/common.h"
int cat(int flides, int unbuffered);
diff --git a/core/chmod.c b/core/chmod.c
index a1898a1..a32ab61 100644
--- a/core/chmod.c
+++ b/core/chmod.c
@@ -32,10 +32,10 @@
#include <stdlib.h>
#include <string.h>
-#define REQ_PRINT_USAGE /* Require print_usage() from common.h */
+#define REQ_PRINT_USAGE /* Require print_usage() from ../common/common.h */
#define DESCRIPTION "Change file modes."
#define OPERANDS "mode file"
-#include "common.h"
+#include "../common/common.h"
int main(int argc, char *const argv[]) {
int argument, i = 0;
diff --git a/core/chown.c b/core/chown.c
index 8ced12e..24cd786 100644
--- a/core/chown.c
+++ b/core/chown.c
@@ -33,11 +33,11 @@
#include <stdlib.h>
#include <string.h>
-#define REQ_PRINT_USAGE /* Require print_usage() from common.h */
-#define REQ_ERRPRINT /* Require errprint() from common.h */
+#define REQ_PRINT_USAGE /* Require print_usage() from ../common/common.h */
+#define REQ_ERRPRINT /* Require errprint() from ../common/common.h */
#define DESCRIPTION "Change file ownership."
#define OPERANDS "owner file"
-#include "common.h"
+#include "../common/common.h"
int main(int argc, char *const argv[]) {
struct passwd *user;
diff --git a/core/dirname.c b/core/dirname.c
index bc2c1e3..cc1c59a 100644
--- a/core/dirname.c
+++ b/core/dirname.c
@@ -32,10 +32,10 @@
#include <string.h>
#include <libgen.h>
-#define REQ_PRINT_USAGE /* Require print_usage() from common.h */
+#define REQ_PRINT_USAGE /* Require print_usage() from ../common/common.h */
#define DESCRIPTION "Return directory portion of <string>."
#define OPERANDS "string"
-#include "common.h"
+#include "../common/common.h"
int main(int argc, char *argv[]) {
char *dirnamestr;
diff --git a/core/ed.c b/core/ed.c
index e5fc8f8..e226064 100644
--- a/core/ed.c
+++ b/core/ed.c
@@ -33,11 +33,11 @@
#include <signal.h>
#include <string.h>
-#define REQ_PRINT_USAGE /* Require print_usage() from common.h */
-#define REQ_ERRPRINT /* Require errprint() from common.h */
+#define REQ_PRINT_USAGE /* Require print_usage() from ../common/common.h */
+#define REQ_ERRPRINT /* Require errprint() from ../common/common.h */
#define DESCRIPTION "Edit text."
#define OPERANDS "[-p prompt]"
-#include "common.h"
+#include "../common/common.h"
void print_error();
size_t c_append(char buffer[4096]);
diff --git a/core/head.c b/core/head.c
index 4c981e8..2bc105c 100644
--- a/core/head.c
+++ b/core/head.c
@@ -34,11 +34,11 @@
#include <string.h>
#include <stdlib.h>
-#define REQ_PRINT_USAGE /* Require print_usage() from common.h */
-#define REQ_ERRPRINT /* Require errprint() from common.h */
+#define REQ_PRINT_USAGE /* Require print_usage() from ../common/common.h */
+#define REQ_ERRPRINT /* Require errprint() from ../common/common.h */
#define DESCRIPTION "Copy file to standard output until <number> lines."
#define OPERANDS "[-n number] [file] ..."
-#include "common.h"
+#include "../common/common.h"
int main(int argc, char *const argv[]) {
int argument, i, lines, lines_printed;
diff --git a/core/link.c b/core/link.c
index 374e474..5f55c66 100644
--- a/core/link.c
+++ b/core/link.c
@@ -30,11 +30,11 @@
#include <stdio.h>
#include <errno.h>
-#define REQ_PRINT_USAGE /* Require print_usage() from common.h */
-#define REQ_ERRPRINT /* Require errprint() from common.h */
+#define REQ_PRINT_USAGE /* Require print_usage() from ../common/common.h */
+#define REQ_ERRPRINT /* Require errprint() from ../common/common.h */
#define DESCRIPTION "Call the link() function."
#define OPERANDS "source dest"
-#include "common.h"
+#include "../common/common.h"
int main(int argc, char *const argv[]) {
if (argc == 1) {
diff --git a/core/ln.c b/core/ln.c
index 28a17ca..3b7432a 100644
--- a/core/ln.c
+++ b/core/ln.c
@@ -31,11 +31,11 @@
#include <errno.h>
#include <string.h>
-#define REQ_PRINT_USAGE /* Require print_usage() from common.h */
-#define REQ_ERRPRINT /* Require errprint() from common.h */
+#define REQ_PRINT_USAGE /* Require print_usage() from ../common/common.h */
+#define REQ_ERRPRINT /* Require errprint() from ../common/common.h */
#define DESCRIPTION "Link files."
#define OPERANDS "[-fs] [-P|-L] source_file target_file"
-#include "common.h"
+#include "../common/common.h"
int getopt(int argc, char *const argv[], const char *optstring);
diff --git a/core/ls.c b/core/ls.c
index 7076243..78d219d 100644
--- a/core/ls.c
+++ b/core/ls.c
@@ -41,12 +41,12 @@
#include <time.h>
#include <sys/ioctl.h>
-#define REQ_PRINT_USAGE /* Require print_usage() from common.h */
-#define REQ_ERRPRINT /* Require errprint() from common.h */
+#define REQ_PRINT_USAGE /* Require print_usage() from ../common/common.h */
+#define REQ_ERRPRINT /* Require errprint() from ../common/common.h */
#define DESCRIPTION "Print <directory>'s contents to standard output.\
If no directory is specified, print the current directory's contents."
#define OPERANDS "[-1aACRimlpgno] [directory]"
-#include "common.h"
+#include "../common/common.h"
char *argv0;
char param[256];
diff --git a/core/mkdir.c b/core/mkdir.c
index 8eb75c2..f8121f5 100644
--- a/core/mkdir.c
+++ b/core/mkdir.c
@@ -32,11 +32,11 @@
#include <errno.h>
#include <string.h>
-#define REQ_PRINT_USAGE /* Require print_usage() from common.h */
-#define REQ_ERRPRINT /* Require errprint() from common.h */
+#define REQ_PRINT_USAGE /* Require print_usage() from ../common/common.h */
+#define REQ_ERRPRINT /* Require errprint() from ../common/common.h */
#define DESCRIPTION "Create directories."
#define OPERANDS "directory ..."
-#include "common.h"
+#include "../common/common.h"
int main(int argc, char *const argv[]) {
int success, argument, i = 0;
diff --git a/core/more.c b/core/more.c
index 2a7eb30..521ee63 100644
--- a/core/more.c
+++ b/core/more.c
@@ -34,11 +34,11 @@
#include <termios.h>
#include <sys/ioctl.h>
-#define REQ_PRINT_USAGE /* Require print_usage() from common.h */
-#define REQ_ERRPRINT /* Require errprint() from common.h */
+#define REQ_PRINT_USAGE /* Require print_usage() from ../common/common.h */
+#define REQ_ERRPRINT /* Require errprint() from ../common/common.h */
#define DESCRIPTION "Display files in a page-by-page basis."
#define OPERANDS "file ..."
-#include "common.h"
+#include "../common/common.h"
int main(int argc, char *const argv[]) {
int i = 0, argument, success, read_file;
diff --git a/core/mv.c b/core/mv.c
index a2eaab4..fe98c79 100644
--- a/core/mv.c
+++ b/core/mv.c
@@ -32,11 +32,11 @@
#include <fcntl.h>
#include <string.h>
-#define REQ_PRINT_USAGE /* Require print_usage() from common.h */
-#define REQ_ERRPRINT /* Require errprint() from common.h */
+#define REQ_PRINT_USAGE /* Require print_usage() from ../common/common.h */
+#define REQ_ERRPRINT /* Require errprint() from ../common/common.h */
#define DESCRIPTION "Move files."
#define OPERANDS "[-if] source dest"
-#include "common.h"
+#include "../common/common.h"
int main(int argc, char *const argv[]) {
int argument, file;
diff --git a/core/printf.c b/core/printf.c
index d005c85..391195e 100644
--- a/core/printf.c
+++ b/core/printf.c
@@ -29,10 +29,10 @@
#include <unistd.h>
#include <stdio.h>
-#define REQ_PRINT_USAGE /* Require print_usage() from common.h */
+#define REQ_PRINT_USAGE /* Require print_usage() from ../common/common.h */
#define DESCRIPTION "Write formatted strings to standard output."
#define OPERANDS "format [string]"
-#include "common.h"
+#include "../common/common.h"
int main(int argc, char *const argv[]) {
if (argc == 1) {
diff --git a/core/rm.c b/core/rm.c
index d1a4e2e..19e16fb 100644
--- a/core/rm.c
+++ b/core/rm.c
@@ -31,11 +31,11 @@
#include <errno.h>
#include <string.h>
-#define REQ_PRINT_USAGE /* Require print_usage() from common.h */
-#define REQ_ERRPRINT /* Require errprint() from common.h */
+#define REQ_PRINT_USAGE /* Require print_usage() from ../common/common.h */
+#define REQ_ERRPRINT /* Require errprint() from ../common/common.h */
#define DESCRIPTION "Remove files."
#define OPERANDS "[-Rr] file ..."
-#include "common.h"
+#include "../common/common.h"
int main(int argc, char *const argv[]) {
int argument, i = 0;
diff --git a/core/sleep.c b/core/sleep.c
index fe7ba6b..1d81875 100644
--- a/core/sleep.c
+++ b/core/sleep.c
@@ -30,10 +30,10 @@
#include <stdlib.h>
#include <unistd.h>
-#define REQ_PRINT_USAGE /* Require print_usage() from common.h */
+#define REQ_PRINT_USAGE /* Require print_usage() from ../common/common.h */
#define DESCRIPTION "Suspend execution for an interval."
#define OPERANDS "time"
-#include "common.h"
+#include "../common/common.h"
int main(int argc, char *argv[]) {
long unsigned int seconds;
diff --git a/core/tail.c b/core/tail.c
index 075eb00..a10a8da 100644
--- a/core/tail.c
+++ b/core/tail.c
@@ -34,11 +34,11 @@
#include <string.h>
#include <stdlib.h>
-#define REQ_PRINT_USAGE /* Require print_usage() from common.h */
-#define REQ_ERRPRINT /* Require errprint() from common.h */
+#define REQ_PRINT_USAGE /* Require print_usage() from ../common/common.h */
+#define REQ_ERRPRINT /* Require errprint() from ../common/common.h */
#define DESCRIPTION "Copy the last part of files."
#define OPERANDS "[-n number] [file] ..."
-#include "common.h"
+#include "../common/common.h"
int main(int argc, char *const argv[]) {
int argument, i = 1, lines, file_lines;
diff --git a/core/uname.c b/core/uname.c
index f4881c6..5c3fb0a 100644
--- a/core/uname.c
+++ b/core/uname.c
@@ -32,11 +32,11 @@
#include <errno.h>
#include <string.h>
-#define REQ_PRINT_USAGE /* Require print_usage() from common.h */
-#define REQ_ERRPRINT /* Require errprint() from common.h */
+#define REQ_PRINT_USAGE /* Require print_usage() from ../common/common.h */
+#define REQ_ERRPRINT /* Require errprint() from ../common/common.h */
#define DESCRIPTION "Return system name."
#define OPERANDS "[-amnrsv]"
-#include "common.h"
+#include "../common/common.h"
int main(int argc, char *const argv[]) {
int argument;
diff --git a/core/unlink.c b/core/unlink.c
index f237c3c..481f38f 100644
--- a/core/unlink.c
+++ b/core/unlink.c
@@ -30,11 +30,11 @@
#include <stdio.h>
#include <errno.h>
-#define REQ_PRINT_USAGE /* Require print_usage() from common.h */
-#define REQ_ERRPRINT /* Require errprint() from common.h */
+#define REQ_PRINT_USAGE /* Require print_usage() from ../common/common.h */
+#define REQ_ERRPRINT /* Require errprint() from ../common/common.h */
#define DESCRIPTION "Call the unlink() function."
#define OPERANDS "file"
-#include "common.h"
+#include "../common/common.h"
int main(int argc, char *const argv[]) {
if (argc != 2) {
diff --git a/core/wc.c b/core/wc.c
index ba03e17..e4d365f 100644
--- a/core/wc.c
+++ b/core/wc.c
@@ -33,11 +33,11 @@
#include <errno.h>
#include <string.h>
-#define REQ_PRINT_USAGE /* Require print_usage() from common.h */
-#define REQ_ERRPRINT /* Require errprint() from common.h */
+#define REQ_PRINT_USAGE /* Require print_usage() from ../common/common.h */
+#define REQ_ERRPRINT /* Require errprint() from ../common/common.h */
#define DESCRIPTION "Word, line, and byte/character count."
#define OPERANDS "[-clwm] [file...]"
-#include "common.h"
+#include "../common/common.h"
int main(int argc, char *const argv[]) {
int argument, length;