commit 45bfdb155cb0db8ac5b23f8cd2ce24f49b4f69e9
parent 88656994c907d224d596f8ceee63105fbc54000a
Author: vx-clutch <[email protected]>
Date: Sun, 24 Aug 2025 18:36:56 -0400
bulk changes
Diffstat:
5 files changed, 73 insertions(+), 10 deletions(-)
diff --git a/Makefile b/Makefile
@@ -31,7 +31,7 @@ install: $(YAIT)
cp $(YAIT) $(PREFIX)
uninstall:
- $(RM) $(DESTDIR)$(PREFIX)/bin/yait
+ $(RM) $(PREFIX)yait
clean:
$(RM) -r bin
diff --git a/src/create_project.c b/src/create_project.c
@@ -10,6 +10,7 @@
#include <stdlib.h>
#include <time.h>
#include <unistd.h>
+#include <sys/stat.h>
#include <stdio.h>
#include <ctype.h>
@@ -66,10 +67,18 @@ int create_project(manifest_t manifest)
flast = true;
cfprintf("doc/WHATNEXT", what_next);
+ fprintf(stderr, "Changing permissions 1");
+ if (chmod("configure", 0755) == -1) {
+ fprintf(stderr, "\n");
+ perror("chmod");
+ return 1;
+ }
+ fprintf(stderr, ", done.\n");
+
main_source = "src/main.c";
break;
case FASM:
- snprintf(buffer, BUFSIZ, "%s.txt", manifest.project);
+ snprintf(buffer, BUFSIZ, "%s.TXT", manifest.project);
for (int i = 0; buffer[i] != '\0'; ++i)
buffer[i] = toupper((unsigned char)buffer[i]);
cfprintf(
@@ -83,6 +92,14 @@ int create_project(manifest_t manifest)
"#!/bin/sh\n\ncc SOURCE/main.c -o %s",
manifest.project);
+ fprintf(stderr, "Changing permissions 1");
+ if (chmod("TOOLS/build.sh", 0755) == -1) {
+ fprintf(stderr, "\n");
+ perror("chmod");
+ return 1;
+ }
+ fprintf(stderr, ", done.\n");
+
main_source = "SOURCE/main.c";
break;
case GNU:
@@ -146,16 +163,31 @@ int create_project(manifest_t manifest)
abort();
}
- if (manifest.libraries.ncurses)
+ if (manifest.libraries.ncurses) {
+ fprintf(stderr, "Pulling ncurses");
system("git submodule add --quiet https://github.com/mirror/ncurses");
- if (manifest.libraries.raylib)
+ fprintf(stderr, ", done.\n");
+ }
+ if (manifest.libraries.raylib) {
+ fprintf(stderr, "Pulling raylib");
system("git submodule add --quiet https://github.com/raysan5/raylib");
- if (manifest.libraries.stb)
+ fprintf(stderr, ", done.\n");
+ }
+ if (manifest.libraries.stb) {
+ fprintf(stderr, "Pulling stb");
system("git submodule add --quiet https://github.com/nothings/stb");
- if (manifest.libraries.uthash)
+ fprintf(stderr, ", done.\n");
+ }
+ if (manifest.libraries.uthash) {
+ fprintf(stderr, "Pulling uthash");
system("git submodule add --quiet https://github.com/troydhanson/uthash");
- if (manifest.libraries.linenoise)
+ fprintf(stderr, ", done.\n");
+ }
+ if (manifest.libraries.linenoise) {
+ fprintf(stderr, "Pulling linenoise");
system("git submodule add --quiet https://github.com/antirez/linenoise");
+ fprintf(stderr, ", done.\n");
+ }
switch (manifest.licence) {
case MIT:
@@ -174,6 +206,12 @@ int create_project(manifest_t manifest)
abort();
}
+ if (!manifest.flags.git) {
+ fprintf(stderr, "Initializing git reposity");
+ system("git init --quiet");
+ fprintf(stderr, ", done.\n");
+ }
+
if (manifest.flags.editor) {
snprintf(buffer, BUFSIZ, "nvim %s", main_source);
system(buffer);
diff --git a/src/main.c b/src/main.c
@@ -115,7 +115,7 @@ static int parse_arguments(manifest_t *conf, int argc, char **argv)
}
if (optind >= argc) {
- fputs("error: missing required positional argument", stderr);
+ fputs("error: missing required positional argument\n", stderr);
return 1;
}
conf->project = str_dup(argv[optind]);
@@ -165,7 +165,7 @@ int main(int argc, char **argv)
.name = "author",
.editor = "nano",
.licence = UNL,
- .style = SIMPLE,
+ .style = POSIX,
.libraries.ncurses = false,
.libraries.raylib = false,
diff --git a/src/posix_contents.h b/src/posix_contents.h
@@ -44,13 +44,14 @@ char *configure =
line ("trycc () { test -z \"$CC\" && cmdexists \"$1\" && CC=$1 ; }")
line ()
line ("prefix=/usr/bin/")
- line ("CFLAGS=\"-Wall -Wextra -O2\"")
+ line ("CFLAGS=\"-Wall -Wextra -O2 --std=c23 -Wpedantic\"")
line ("LDFLAGS=")
line ("CC=")
line ()
line ("for arg ; do")
line ("case \"$arg\" in")
line ("--help|h) usage ;;")
+ line ("--prefix=*) prefix=${arg#*=} ;;")
line ("CFLAGS=*) CFLAGS=${arg#*=} ;;")
line ("LDFLAGS=*) LDFLAGS=${arg#*=} ;;")
line ("esac")
diff --git a/tools/new-doc b/tools/new-doc
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+name=$1
+
+cat <<EOF > doc/$name
+ Yb dP db 88 888888
+ YbdP dPYb 88 88
+ 8P dP__Yb 88 88
+ dP dP""""Yb 88 88
+
+ yait manual
+
+$name
+$(printf '%*s\n' "${#name}" '' | tr ' ' '#')
+
+
+EOF
+
+if [ "$EDITOR" = "nvim" ]; then
+ nvim +'normal! Gi' doc/$name
+ exit 0
+fi
+
+$EDITOR doc/$name