new: segfault handler

This commit is contained in:
ngn 2024-05-04 22:36:57 +03:00
parent c439f30820
commit 070af11bb6
2 changed files with 26 additions and 13 deletions

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-05-04 22:30+0300\n"
"POT-Creation-Date: 2024-05-04 22:36+0300\n"
"PO-Revision-Date: 2024-05-01 13:34+0300\n"
"Last-Translator: <ngn@ngn.tf>\n"
"Language-Team: Turkish <gnome-turk@gnome.org>\n"
@ -115,47 +115,51 @@ msgstr ""
msgid "Please answer with y/n"
msgstr ""
#: src/main.c:72
#: src/main.c:62
msgid "Program received a segfault"
msgstr ""
#: src/main.c:81
#, c-format
msgid "Failed to access paths (%s)"
msgstr ""
#: src/main.c:80
#: src/main.c:89
msgid "Failed to lock, mc is already running"
msgstr ""
#: src/main.c:83
#: src/main.c:92
msgid "Failed to lock, did you mess up your directory permissions?"
msgstr ""
#: src/main.c:92
#: src/main.c:101
#, c-format
msgid "%s: command failed"
msgstr ""
#: src/main.c:96
#: src/main.c:105
#, c-format
msgid "%s: command successful"
msgstr ""
#: src/main.c:100
#: src/main.c:109
#, c-format
msgid "MatterLinux Configuration Manager (%s)"
msgstr ""
#: src/main.c:101
#: src/main.c:110
msgid "Different operations are done using different commands\n"
msgstr ""
#: src/main.c:104
#: src/main.c:113
msgid "pull down a configuration"
msgstr ""
#: src/main.c:107
#: src/main.c:116
msgid "build the configuration in the current directory"
msgstr ""
#: src/main.c:109
#: src/main.c:118
msgid ""
"Licensed under GPLv3, see <https://www.gnu.org/licenses/> for more "
"information"

View File

@ -50,14 +50,23 @@ struct CmdMap cmdmap[] = {
{.name = "mc-gen", .lock = false, .func = gen_cmd },
};
void handler(int sig){
void handler_int(int sig){
unlock();
printf("\e[?25h");
exit(1);
}
void handler_seg(int sig){
unlock();
printf("\e[?25h");
error(_("Program received a segfault"));
exit(1);
}
int main(int argc, char *argv[]) {
signal(SIGINT, handler);
signal(SIGINT, handler_int);
signal(SIGSEGV, handler_seg);
setbuf(stdout, NULL);
setlocale(LC_ALL, "");
textdomain("mc");