Changeset 552b69f in mainline for uspace/lib/ui/src/ui.c
- Timestamp:
- 2021-11-03T20:56:59Z (4 years ago)
- Branches:
- master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 1aa8c86
- Parents:
- ec8a1bf
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/ui/src/ui.c
rec8a1bf r552b69f 69 69 const char *cp; 70 70 71 if (ospec == UI_DISPLAY_DEFAULT) {72 *ws = ui_ws_display;73 *osvc = DISPLAY_DEFAULT;74 return;75 }76 77 71 cp = ospec; 78 72 while (isalpha(*cp)) … … 86 80 } else if (str_lcmp(ospec, "null@", str_length("null@")) == 0) { 87 81 *ws = ui_ws_null; 82 } else if (str_lcmp(ospec, "@", str_length("@")) == 0) { 83 *ws = ui_ws_any; 88 84 } else { 89 85 *ws = ui_ws_unknown; … … 123 119 ui_ospec_parse(ospec, &ws, &osvc); 124 120 125 if (ws == ui_ws_display) { 126 rc = display_open(osvc, &display); 121 if (ws == ui_ws_display || ws == ui_ws_any) { 122 rc = display_open(osvc != NULL ? osvc : DISPLAY_DEFAULT, 123 &display); 127 124 if (rc != EOK) 128 return rc;125 goto disp_fail; 129 126 130 127 rc = ui_create_disp(display, &ui); 131 128 if (rc != EOK) { 132 129 display_close(display); 133 return rc; 134 } 135 } else if (ws == ui_ws_console) { 130 goto disp_fail; 131 } 132 133 ui->myoutput = true; 134 *rui = ui; 135 return EOK; 136 } 137 138 disp_fail: 139 if (ws == ui_ws_console || ws == ui_ws_any) { 136 140 console = console_init(stdin, stdout); 137 141 if (console == NULL) 138 return EIO;142 goto cons_fail; 139 143 140 144 rc = console_get_size(console, &cols, &rows); 141 145 if (rc != EOK) { 142 146 console_done(console); 143 return rc;147 goto cons_fail; 144 148 } 145 149 … … 150 154 if (rc != EOK) { 151 155 console_done(console); 152 return rc;156 goto cons_fail; 153 157 } 154 158 … … 157 161 ui_destroy(ui); 158 162 console_done(console); 159 return rc;163 goto cons_fail; 160 164 } 161 165 … … 167 171 168 172 (void) ui_paint(ui); 169 } else if (ws == ui_ws_null) { 173 ui->myoutput = true; 174 *rui = ui; 175 return EOK; 176 } 177 178 cons_fail: 179 if (ws == ui_ws_null) { 170 180 rc = ui_create_disp(NULL, &ui); 171 181 if (rc != EOK) 172 182 return rc; 173 } else { 174 return EINVAL;175 }176 177 ui->myoutput = true;178 *rui = ui; 179 return E OK;183 184 ui->myoutput = true; 185 *rui = ui; 186 return EOK; 187 } 188 189 return EINVAL; 180 190 } 181 191
Note:
See TracChangeset
for help on using the changeset viewer.