From 03e32e472ebd42bc26227c87042499b786687730 Mon Sep 17 00:00:00 2001 From: Ayabusa Date: Sun, 7 Jun 2026 21:01:54 +0200 Subject: [PATCH] Error message --- Makefile | 9 ++++++--- src/cli.c | 32 ++++++++++++++++++++++++++++++++ src/cli.h | 17 +++++++++++++++++ src/cli.o | Bin 0 -> 5312 bytes src/main.c | 4 +++- 5 files changed, 58 insertions(+), 4 deletions(-) create mode 100644 src/cli.c create mode 100644 src/cli.h create mode 100644 src/cli.o diff --git a/Makefile b/Makefile index ee48c6d..262a9eb 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ CFLAGS = -Wall -Wextra -g LIBS = -lcurl -SRC = src/main.c src/cpu.c src/downloader.c -OBJ = build/main.o build/cpu.o build/downloader.o +SRC = src/main.c src/cpu.c src/downloader.c src/cli.c +OBJ = build/main.o build/cpu.o build/downloader.o src/cli.o RES = build/Thoryum all: setup $(OBJ) build @@ -16,10 +16,13 @@ build/cpu.o: src/cpu.c build/downloader.o: src/downloader.c $(CC) $(CFLAGS) -c $^ -o $@ $(LIBS) +build/cli.o: src/cli.c + $(CC) $(CFLAGS) -c $^ -o $@ $(LIBS) + setup: mkdir -p build -run: +run: ./$(RES) debug: diff --git a/src/cli.c b/src/cli.c new file mode 100644 index 0000000..56b8552 --- /dev/null +++ b/src/cli.c @@ -0,0 +1,32 @@ +#include "cli.h" +#include +#include + +struct ctx *init_ctx(int argc, char **argv) { + struct ctx *ctx = malloc(sizeof(struct ctx)); + +} + +void print_help() { + printf( + "Usage: thoryum [options]\n" + "Thoryum is an install helper, and update wrapper for the Thorium browser.\n" + "\n" + "Options:\n" + " -h, --help\n" + " Print this help message.\n" + "\n" + " -l, --location \n" + " Install Thorium to a specific path, default is '/usr/bin'.\n" + "\n" + " -y, --yes\n" + " Do not ask for confirmation and apply the install directly.\n" + "\n" + " -u [DO NOT USE !!!]\n" + " This is used internally to check updates for an existing install,\n" + " it should not be invoked by the user.\n" + "\n" + "For bug report or question, please send me an email at :\n" + "contact[at]ayabusa[dot]dev ;)\n" + ); +} diff --git a/src/cli.h b/src/cli.h new file mode 100644 index 0000000..4893224 --- /dev/null +++ b/src/cli.h @@ -0,0 +1,17 @@ +#ifndef CLI_H +#define CLI_H + +enum mode { + HELP, + UPDATE, + NORMAL, +}; + +struct ctx { + enum mode mode; + char *install_loc; +}; + +void print_help(); + +#endif diff --git a/src/cli.o b/src/cli.o new file mode 100644 index 0000000000000000000000000000000000000000..48003b7777b9555d0cbfecaf0564d75a669010d6 GIT binary patch literal 5312 zcmbVQU2Ggz6}~g$wKqHdOWZn5Q^+-HaZ-6^U7eKWEOJ^|zKTJz*LKBQn?m+vNy_er$KVD2Iz|KbvI#8vE?O*OqVm zbNS^D`HdGpT)vV2{deOa{{VHCZ!F!p`R+Sio!3eQ`bR0fx$zETYpK@|^E_+DNhfdd z^|+k{ag=UURuvMY+>3Y+rI{CoyeY!ANM-=4^SoX6GQqDUUK=pJ6(`_Ea5N0SRV|6H zr6O@Fl`DnM`3mPwbA~$(dI1J$B?+Po>>v!Hyd_ec5mB4gdJ$FQ^yq%AE6ldH^ugYck zakLdAts*Qg6;>E_Oms>EbJ8Sa=w243cq}1m9IU$#HXgFHk9L4Tp0Z2si?yy zW+I7T8^Kk~{ig7*s!dE~SlDN=6Qo%XHE6?Ul%F8uX*15lx}0ZCfP6c?3O;Maw7@^^ z^b>FfwY5dRhVxRkXYy>0%7GuZUfLJu>9Ha$oCK##m1<}csP6z8zAF{@+~w;kg15yQoO&_>8aryu{ z8YwZe3|ya8n{i82RYj_Hmqr50iC23~JSe?^j`=o5$yzFo^OU zrxE4V*<;lp^1~cXP%08rMBi~!Qr9uO~}uO0LKSO7Mi8e z@$Z`FMh4eG0Wg%EMj?(57OD9llq9isQ3#S{-)xe)bK@>TF+?s z1%<{xR2y=v~wO<9mpN`k2p0kOBI9(RJ}<#XqXyv|d-kbH$(3aGL)a4X1qi zl7@d@@x6JD^ZbFrDL&2rM+&Dr*VoIH+=Lz}1S^Ut}J0YiY{dBrX^!tqb^Buo*;KG3dy#SF0sr8`RKPL5UYN1e)$*a90X4fp|1T zcvJFz+-eE9$6fdVC0w}L;Hv<>5)==YtP9@@@cS_9D8Hh)xs`Y=dQoZNpR(s*hkHx; zMs60>K>vVL=}KzsAdE0S7rRI?cw7F?fS=F`$NL#=@ywC%qZJAB6LGr75kq>Z=6Q~xt%=V=qxSoSy=^xMBOz6e0? zDL=S>ct#YT_V3Gp={^BsgXk1Ue$yAjg6|pQa08xx_Cx9tJ*w&Jx?cl%zxlsETo{r) z&L2}kpa1iK=|0i&go?k7Ob_Y0A;|j0FRP3HBV~*6@vBLXkM}S7q)PJDtiKm|Ii2o%FP*qEF zM)sT(RZsgz@VhWTpSpcnDPn%~l5YQd5cWI2JL>%CT=4wxn~m%#|NF(pc+V=ulWM{E n{nao35YuZ1+TTV2&~(vtTYdlbf~24QVfDfE=dNWj(Cz;R%KUl- literal 0 HcmV?d00001 diff --git a/src/main.c b/src/main.c index 3f9f76f..62bafe9 100644 --- a/src/main.c +++ b/src/main.c @@ -6,6 +6,7 @@ #include #include "cpu.h" #include "downloader.h" +#include "cli.h" #define SED_PATCH "s/WMClass=thorium/WMClass=thorium-browser/g" #define DESKTOP_FILE "thorium-portable.desktop" @@ -45,5 +46,6 @@ int main() { fclose(file); */ //printf("Latest version url : '%s,'\n",DL_get_latest_version_url("AVX.zip")); - patch_desktop_file("."); + //patch_desktop_file("."); + print_help(); } -- 2.43.0