fix: remove libmp headers

This commit is contained in:
ngn 2024-08-01 19:31:25 +03:00
parent b61eb809f6
commit ea28e9ee1b
4 changed files with 151 additions and 31 deletions

View File

@ -27,7 +27,7 @@ dist/%.o: src/%.c
locale/%.mo: locale/%.po locale/%.mo: locale/%.po
msgfmt $^ -o $@ msgfmt $^ -o $@
locale/%.po: locale/mc.pot locale/%.po: locale/confer.pot
cp $@ $@.old cp $@ $@.old
if msgmerge $@ $^ -o $@ ; then \ if msgmerge $@ $^ -o $@ ; then \
rm $@.old ; \ rm $@.old ; \

View File

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-08-01 04:31+0300\n" "POT-Creation-Date: 2024-08-01 19:30+0300\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -66,6 +66,15 @@ msgstr "Author"
msgid "Keywords" msgid "Keywords"
msgstr "Keywords" msgstr "Keywords"
#: src/ctx.c:15
msgid "Home directory is NULL"
msgstr ""
#: src/ctx.c:21 src/ctx.c:37
#, fuzzy
msgid "Failed to access to the home directory"
msgstr "Failed to open the directory: %s"
#: src/log.c:127 #: src/log.c:127
msgid "y" msgid "y"
msgstr "y" msgstr "y"
@ -103,45 +112,52 @@ msgstr "pull down a configuration"
msgid "build the configuration in the current directory" msgid "build the configuration in the current directory"
msgstr "build the configuration in the current directory" msgstr "build the configuration in the current directory"
#: src/main.c:73 #: src/main.c:78
msgid "Please specify the homedir with " #, fuzzy
msgid "Please specify the home directory with "
msgstr "Please specify the homedir with " msgstr "Please specify the homedir with "
#: src/main.c:84 #: src/main.c:83
#, fuzzy
msgid "Cannot access to the home directory ("
msgstr "Failed to open the directory: %s"
#: src/main.c:97
msgid "Failed to lock, confer is already running" msgid "Failed to lock, confer is already running"
msgstr "Failed to lock, confer is already running" msgstr "Failed to lock, confer is already running"
#: src/main.c:88 #: src/main.c:101
msgid "Failed to lock, are you root?" msgid "Failed to lock, do you have access to the home directory?"
msgstr "Failed to lock, are you root?" msgstr ""
#: src/main.c:100 #: src/main.c:113
msgid "Command not found: " msgid "Command not found: "
msgstr "Command not found: " msgstr "Command not found: "
#: src/main.c:102 #: src/main.c:115
#, c-format #, c-format
msgid "MatterLinux configuration manager (version %s)" msgid "MatterLinux configuration manager (version %s)"
msgstr "MatterLinux configuration manager (version %s)" msgstr "MatterLinux configuration manager (version %s)"
#: src/main.c:103 #: src/main.c:116
msgid "Usage: " msgid "Usage: "
msgstr "Usage: " msgstr "Usage: "
#: src/main.c:105 #: src/main.c:118
msgid "Here is a list of available commands:" msgid "Here is a list of available commands:"
msgstr "Here is a list of available commands:" msgstr "Here is a list of available commands:"
#: src/main.c:111 #: src/main.c:124
msgid "Here is a list of available options:" msgid "Here is a list of available options:"
msgstr "Here is a list of available options:" msgstr "Here is a list of available options:"
#: src/main.c:114 src/main.c:115 #: src/main.c:126 src/main.c:127
#, c-format #, c-format
msgid " " msgid " "
msgstr " " msgstr " "
#: src/main.c:117 #: src/main.c:129
#, fuzzy
msgid "" msgid ""
"Licensed under GPLv3, see https://www.gnu.org/licenses/ for more information" "Licensed under GPLv3, see https://www.gnu.org/licenses/ for more information"
msgstr "" msgstr ""
@ -221,3 +237,109 @@ msgstr "Failed to open \"%s\" for reading"
#, c-format #, c-format
msgid "Failed to open \"%s\" for writing" msgid "Failed to open \"%s\" for writing"
msgstr "Failed to open \"%s\" for writing" msgstr "Failed to open \"%s\" for writing"
#: src/cmd/gen.c:24
msgid "Please specify only a signle directory for the repository"
msgstr ""
#: src/cmd/gen.c:29
msgid "Please specify a directory for the repository"
msgstr ""
#: src/cmd/gen.c:34
#, fuzzy
msgid "Failed to access the directory"
msgstr "Failed to open the directory: %s"
#: src/cmd/gen.c:39
#, fuzzy
msgid "Failed to change directory to the specified directory"
msgstr "Failed to create directory: %s"
#: src/cmd/gen.c:44 src/cmd/pull.c:102
#, fuzzy
msgid "Failed to load the configuration file ("
msgstr "Failed to parse configuration file"
#: src/cmd/gen.c:49 src/cmd/pull.c:107
#, fuzzy
msgid "Loaded repository configuration"
msgstr "Failed to parse configuration file"
#: src/cmd/gen.c:55 src/cmd/pull.c:134
msgid "Copying all the targets"
msgstr ""
#: src/cmd/gen.c:61 src/cmd/pull.c:150
#, fuzzy
msgid "Failed to copy the target:"
msgstr "Failed to open the directory: %s"
#: src/cmd/pull.c:39
msgid "Please specify only a single config name or a URL"
msgstr ""
#: src/cmd/pull.c:44
#, fuzzy
msgid "Please specify a config name or a URL"
msgstr "Please specify the homedir with "
#: src/cmd/pull.c:62
#, fuzzy
msgid "Specified configuration is not found"
msgstr "Configuration file not found"
#: src/cmd/pull.c:65
msgid "Failed to access the URL"
msgstr ""
#: src/cmd/pull.c:81
msgid "Cloning "
msgstr ""
#: src/cmd/pull.c:86
#, fuzzy, c-format
msgid "Failed to clone the %s:"
msgstr "Failed to open the directory: %s"
#: src/cmd/pull.c:97
#, fuzzy, c-format
msgid "Failed to chdir to %s"
msgstr "Failed to create directory: %s"
#: src/cmd/pull.c:110
msgid "Do you want to continue?"
msgstr ""
#: src/cmd/pull.c:116
msgid "Checking all the targets"
msgstr ""
#: src/cmd/pull.c:122
#, fuzzy, c-format
msgid "Failed to access the source for the target \"%s\""
msgstr "Failed to get the location header"
#: src/cmd/pull.c:131
msgid "All the target checks were successful"
msgstr ""
#: src/cmd/pull.c:144
msgid "Install the target?"
msgstr ""
#: src/cmd/pull.c:145
msgid "Skipping target"
msgstr ""
#: src/cmd/pull.c:178
msgid "Installing all the requirements"
msgstr ""
#: src/cmd/pull.c:181
#, fuzzy
msgid "Failed to run the "
msgstr "Failed to init curl"
#~ msgid "Failed to lock, are you root?"
#~ msgstr "Failed to lock, are you root?"

View File

@ -1,5 +1,4 @@
#pragma once #pragma once
#include <libmp/all.h>
#include <stdbool.h> #include <stdbool.h>
#include "args.h" #include "args.h"

View File

@ -20,9 +20,8 @@
*/ */
// clang-format on // clang-format on
#include <libmp/util.h>
#include <locale.h> #include <locale.h>
#include <signal.h> #include <signal.h>
#include <stdbool.h> #include <stdbool.h>
@ -42,10 +41,10 @@
ctx_t ctx; ctx_t ctx;
void handler(int sig){ void handler(int sig) {
unlock(ctx.lock_path); unlock(ctx.lock_path);
printf("\e[?25h\n"); printf("\e[?25h\n");
if(SIGSEGV == sig) if (SIGSEGV == sig)
error(_("Program received a segfault")); error(_("Program received a segfault"));
exit(1); exit(1);
} }
@ -59,28 +58,29 @@ int main(int argc, char *argv[]) {
textdomain("confer"); textdomain("confer");
cmd_t commands[] = { cmd_t commands[] = {
{.name = "pull", .lock = true, .desc = _("pull down a configuration"), .func = cmd_pull }, {.name = "pull", .lock = true, .desc = _("pull down a configuration"), .func = cmd_pull},
{.name = "gen", .lock = false, .desc = _("build the configuration in the current directory"), .func = cmd_gen }, {.name = "gen", .lock = false, .desc = _("build the configuration in the current directory"), .func = cmd_gen },
}; };
args_t *args = NULL; args_t *args = NULL;
char *homedir = NULL; char *homedir = NULL;
bool ret = false; bool ret = false;
args = args_parse(argc, argv); args = args_parse(argc, argv);
if (args->count <= 0 || args->list[0].name != NULL) if (args->count <= 0 || args->list[0].name != NULL)
goto help; goto help;
if((homedir = args_get_string(args, "home")) == NULL) if ((homedir = args_get_string(args, "home")) == NULL)
homedir = getenv("HOME"); homedir = getenv("HOME");
if(!ctx_init(&ctx, homedir)){ if (!ctx_init(&ctx, homedir)) {
switch (errno) { switch (errno) {
case HomedirInvalid: case HomedirInvalid:
error(_("Please specify the home directory with "FG_BOLD"--home"FG_RESET" option or specify the "FG_BOLD"HOME"FG_RESET" environment variable")); error(_("Please specify the home directory with " FG_BOLD "--home" FG_RESET " option or specify the " FG_BOLD
"HOME" FG_RESET " environment variable"));
break; break;
case HomedirAccessFail: case HomedirAccessFail:
error(_("Cannot access to the home directory ("FG_BOLD"%s"FG_RESET")"), homedir); error(_("Cannot access to the home directory (" FG_BOLD "%s" FG_RESET ")"), homedir);
break; break;
} }
@ -123,8 +123,7 @@ help:
info(_("Here is a list of available options:")); info(_("Here is a list of available options:"));
printf( printf(_(" " FG_BOLD "--yes" FG_RESET ":\t skip the confirmation\n"));
_(" " FG_BOLD "--yes" FG_RESET ":\t skip the confirmation\n"));
printf(_(" " FG_BOLD "--home" FG_RESET ":\t path to your home directory\n\n")); printf(_(" " FG_BOLD "--home" FG_RESET ":\t path to your home directory\n\n"));
info(_("Licensed under GPLv3, see https://www.gnu.org/licenses/ for more information")); info(_("Licensed under GPLv3, see https://www.gnu.org/licenses/ for more information"));