Don't fork off to call system for help, about

This commit is contained in:
K. Lange 2018-08-12 13:24:34 +09:00
parent 74cf97ebc2
commit db9e401354
3 changed files with 20 additions and 35 deletions

View File

@ -190,24 +190,18 @@ static void _menu_action_up(struct MenuEntry * entry) {
static void _menu_action_help(struct MenuEntry * entry) {
/* show help documentation */
if (!fork()) {
system("help-browser file-browser.trt");
exit(0);
}
system("help-browser file-browser.trt &");
redraw_window();
}
static void _menu_action_about(struct MenuEntry * entry) {
/* Show About dialog */
if (!fork()) {
char about_cmd[1024] = "\0";
strcat(about_cmd, "about \"About File Browser\" /usr/share/icons/48/folder.bmp \"ToaruOS File Browser\" \"(C) 2018 K. Lange\n-\nPart of ToaruOS, which is free software\nreleased under the NCSA/University of Illinois\nlicense.\n-\n%https://toaruos.org\n%https://gitlab.com/toaruos\" ");
char coords[100];
sprintf(coords, "%d %d", (int)main_window->x + (int)main_window->width / 2, (int)main_window->y + (int)main_window->height / 2);
sprintf(coords, "%d %d &", (int)main_window->x + (int)main_window->width / 2, (int)main_window->y + (int)main_window->height / 2);
strcat(about_cmd, coords);
system(about_cmd);
exit(0);
}
redraw_window();
}

View File

@ -106,15 +106,12 @@ static void _menu_action_forward(struct MenuEntry * entry) {
static void _menu_action_about(struct MenuEntry * entry) {
/* Show About dialog */
if (!fork()) {
char about_cmd[1024] = "\0";
strcat(about_cmd, "about \"About Help Browser\" /usr/share/icons/48/help.bmp \"ToaruOS Help Browser\" \"(C) 2018 K. Lange\n-\nPart of ToaruOS, which is free software\nreleased under the NCSA/University of Illinois\nlicense.\n-\n%https://toaruos.org\n%https://gitlab.com/toarus\" ");
char coords[100];
sprintf(coords, "%d %d", (int)main_window->x + (int)main_window->width / 2, (int)main_window->y + (int)main_window->height / 2);
sprintf(coords, "%d %d &", (int)main_window->x + (int)main_window->width / 2, (int)main_window->y + (int)main_window->height / 2);
strcat(about_cmd, coords);
system(about_cmd);
exit(0);
}
redraw_window();
}

View File

@ -1764,23 +1764,17 @@ void _menu_action_toggle_sdf(struct MenuEntry * self) {
}
void _menu_action_show_about(struct MenuEntry * self) {
if (!fork()) {
char about_cmd[1024] = "\0";
strcat(about_cmd, "about \"About Terminal\" /usr/share/icons/48/utilities-terminal.bmp \"ToaruOS Terminal\" \"(C) 2013-2018 K. Lange\n-\nPart of ToaruOS, which is free software\nreleased under the NCSA/University of Illinois\nlicense.\n-\n%https://toaruos.org\n%https://gitlab.com/toaruos\" ");
char coords[100];
sprintf(coords, "%d %d", (int)window->x + (int)window->width / 2, (int)window->y + (int)window->height / 2);
sprintf(coords, "%d %d &", (int)window->x + (int)window->width / 2, (int)window->y + (int)window->height / 2);
strcat(about_cmd, coords);
system(about_cmd);
exit(0);
}
render_decors();
}
void _menu_action_show_help(struct MenuEntry * self) {
if (!fork()) {
system("help-browser terminal.trt");
exit(0);
}
system("help-browser terminal.trt &");
render_decors();
}