Browse Source

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

K. Lange 2 years ago
parent
commit
db9e401354
3 changed files with 20 additions and 35 deletions
  1. 7 13
      apps/file-browser.c
  2. 6 9
      apps/help-browser.c
  3. 7 13
      apps/terminal.c

+ 7 - 13
apps/file-browser.c

@@ -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);
-		strcat(about_cmd, coords);
-		system(about_cmd);
-		exit(0);
-	}
+	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);
+	strcat(about_cmd, coords);
+	system(about_cmd);
 	redraw_window();
 }
 

+ 6 - 9
apps/help-browser.c

@@ -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);
-		strcat(about_cmd, coords);
-		system(about_cmd);
-		exit(0);
-	}
+	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);
+	strcat(about_cmd, coords);
+	system(about_cmd);
 	redraw_window();
 }
 

+ 7 - 13
apps/terminal.c

@@ -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);
-		strcat(about_cmd, coords);
-		system(about_cmd);
-		exit(0);
-	}
+	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);
+	strcat(about_cmd, coords);
+	system(about_cmd);
 	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();
 }