aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThorsten Töpper <atsutane@freethoughts.de>2025-11-11 01:14:17 +0100
committerThorsten Töpper <atsutane@freethoughts.de>2025-11-11 01:14:17 +0100
commit30c37a514d209e299b3f7b95bc77ca7b96eaaed9 (patch)
tree6f9bc78b2abe936672c378c8653d8e7ab5c2bfbc
parent5a611f358080d5e870db907e85fed3dc913a1f91 (diff)
downloadsmall-utils-master.tar.gz
small-utils-master.tar.bz2
strlen: Finally place a wrapper it in a repo...HEADmaster
-rw-r--r--Makefile6
-rw-r--r--src/strlen.c17
2 files changed, 23 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index b379a30..46cdea6 100644
--- a/Makefile
+++ b/Makefile
@@ -75,6 +75,12 @@ out/split_for_sort: out src/split_for_sort.c include/trace_macros.h
out/debug/split_for_sort: out/debug src/split_for_sort.c include/trace_macros.h
${CC} -o $@ ${CFLAGS} ${DEBUG_CFLAGS} src/split_for_sort.c
+out/strlen: out src/strlen.c
+ ${CC} -o $@ ${CFLAGS} ${PROD_CFLAGS} src/strlen.c
+
+out/debug/strlen: out/debug src/strlen.c
+ ${CC} -o $@ ${CFLAGS} ${DEBUG_CFLAGS} src/strlen.c
+
out/tree_based_check: out src/tree_based_check.c \
include/trace_macros.h include/hex_conversion.h
${CC} -o $@ ${CFLAGS} ${PROD_CFLAGS} src/tree_based_check.c
diff --git a/src/strlen.c b/src/strlen.c
new file mode 100644
index 0000000..dd5d073
--- /dev/null
+++ b/src/strlen.c
@@ -0,0 +1,17 @@
+/*
+ * vim:ts=4:sw=4:expandtab
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+int main(int argc, char **argv) {
+ int i;
+ if (argc > 1) {
+ for (i=1; i<argc; i++) {
+ printf("'%s' length %lu\n", argv[i], strlen(argv[i]));
+ }
+ return EXIT_SUCCESS;
+ }
+ return EXIT_FAILURE;
+}