summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2025-10-13 16:26:53 -0400
committerIan Moffett <ian@osmora.org>2025-10-13 16:26:53 -0400
commitdcd3ac08cf9982a23c02d93118d5fd50657af30e (patch)
treefa373d5c50aaa85aa81987420d1aa82047e0d86c /src
parent248ff808e2f75611d8d73e7aabfac4bee96ebac5 (diff)
cmd: Add initial 'fetch' command
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'src')
-rw-r--r--src/cmd/Makefile3
-rw-r--r--src/cmd/fetch/Makefile18
-rw-r--r--src/cmd/fetch/fetch.c58
3 files changed, 79 insertions, 0 deletions
diff --git a/src/cmd/Makefile b/src/cmd/Makefile
index d7906a9..b01e6e7 100644
--- a/src/cmd/Makefile
+++ b/src/cmd/Makefile
@@ -12,9 +12,12 @@ all:
LIBC_DIR=$(shell pwd)/../$(LIBC_DIR)
cd reboot/; make LDSCRIPT=$(LDSCRIPT) CC=$(CC) AS=$(AS) LD=$(LD) SYSROOT=$(SYSROOT) \
LIBC_DIR=$(shell pwd)/../$(LIBC_DIR)
+ cd fetch/; make LDSCRIPT=$(LDSCRIPT) CC=$(CC) AS=$(AS) LD=$(LD) SYSROOT=$(SYSROOT) \
+ LIBC_DIR=$(shell pwd)/../$(LIBC_DIR)
.PHONY: clean
clean:
cd init/; make clean
cd hush/; make clean
cd reboot/; make clean
+ cd fetch/; make clean
diff --git a/src/cmd/fetch/Makefile b/src/cmd/fetch/Makefile
new file mode 100644
index 0000000..bcc5da2
--- /dev/null
+++ b/src/cmd/fetch/Makefile
@@ -0,0 +1,18 @@
+include ../../data/build/user.mk
+
+CFILES = $(shell find . -name "*.c")
+CFILES = $(shell find . -name "*.c")
+CFLAGS = -L$(LIBC_DIR) -lc $(INTERNAL_CFLAGS) \
+ -L../../lib/libwidget -lwidget -L../../lib/libc/ -lc \
+ -I../../lib/libwidget/include/
+OBJECTS = $(CFILES:%.c=%.o)
+
+$(SYSROOT)/usr/bin/fetch: $(OBJECTS)
+ $(LD) $(OBJECTS) -o $@ $(CFLAGS)
+
+%.o: %.c
+ $(CC) $(INTERNAL_CFLAGS) -c $(CFLAGS) $< -o $@
+
+.PHONY: clean
+clean:
+ rm -f *.o *.d
diff --git a/src/cmd/fetch/fetch.c b/src/cmd/fetch/fetch.c
new file mode 100644
index 0000000..65cbf84
--- /dev/null
+++ b/src/cmd/fetch/fetch.c
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2025 Ian Marco Moffett and L5 engineers
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the project nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <stdio.h>
+
+/*
+ * XXX: Some stuff is hardcoded for now, but will
+ * be changed
+ */
+#define ASCII_ART \
+ " ____ \n" \
+ " | \\__\\ user: sv\n" \
+ " | /\\ \\ OS: L5\n" \
+ " \\ R. \\ \\ arch: %s\n" \
+ " \\ I. \\ \\\n"
+
+static char *
+get_arch_str(void)
+{
+#if defined(__x86_64__)
+ return "amd64";
+#else
+ return "unknown";
+#endif
+}
+
+int
+main(void)
+{
+ printf(ASCII_ART, get_arch_str());
+ return 0;
+}