Changeset fd11144 in mainline for uspace/app/vlaunch/vlaunch.c
- Timestamp:
- 2020-07-04T21:52:35Z (4 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- fc4abca
- Parents:
- e79a025
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/vlaunch/vlaunch.c
re79a025 rfd11144 37 37 #include <stdio.h> 38 38 #include <stdlib.h> 39 #include <str.h> 39 40 #include <task.h> 40 41 #include <str_error.h> … … 58 59 #define LOGO_HEIGHT 66 59 60 60 static char * winreg = NULL;61 static char *display_svc = DISPLAY_DEFAULT; 61 62 62 63 static int app_launch(const char *app) 63 64 { 64 printf("%s: Spawning %s %s \n", NAME, app, winreg); 65 65 errno_t rc; 66 66 task_id_t id; 67 67 task_wait_t wait; 68 errno_t rc = task_spawnl(&id, &wait, app, app, winreg, NULL); 68 69 if (display_svc != DISPLAY_DEFAULT) { 70 printf("%s: Spawning %s -d %s\n", NAME, app, display_svc); 71 rc = task_spawnl(&id, &wait, app, app, "-d", display_svc, NULL); 72 } else { 73 printf("%s: Spawning %s\n", NAME, app); 74 rc = task_spawnl(&id, &wait, app, app, NULL); 75 } 76 69 77 if (rc != EOK) { 70 78 printf("%s: Error spawning %s %s (%s)\n", NAME, app, 71 winreg, str_error(rc)); 79 display_svc != DISPLAY_DEFAULT ? display_svc : 80 "<default>", str_error(rc)); 72 81 return -1; 73 82 } … … 91 100 } 92 101 102 static void print_syntax(void) 103 { 104 printf("Syntax: %s [-d <display>]\n", NAME); 105 } 106 93 107 int main(int argc, char *argv[]) 94 108 { 95 if (argc < 2) { 96 printf("Compositor server not specified.\n"); 97 return 1; 109 int i; 110 111 i = 1; 112 while (i < argc) { 113 if (str_cmp(argv[i], "-d") == 0) { 114 ++i; 115 if (i >= argc) { 116 printf("Argument missing.\n"); 117 print_syntax(); 118 return 1; 119 } 120 121 display_svc = argv[i++]; 122 } else { 123 printf("Invalid option '%s'.\n", argv[i]); 124 print_syntax(); 125 return 1; 126 } 98 127 } 99 128 … … 104 133 } 105 134 106 winreg = argv[1]; 107 window_t *main_window = window_open(argv[1], NULL, 135 window_t *main_window = window_open(display_svc, NULL, 108 136 WINDOW_MAIN | WINDOW_DECORATED | WINDOW_RESIZEABLE, "vlaunch"); 109 137 if (!main_window) {
Note:
See TracChangeset
for help on using the changeset viewer.