Changeset 97d3d9d in mainline for uspace/app/display-cfg/display-cfg.c
- Timestamp:
- 2023-04-20T18:43:15Z (17 months ago)
- Branches:
- master, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- cdf5361
- Parents:
- 37087c8
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/display-cfg/display-cfg.c
r37087c8 r97d3d9d 36 36 #include <stdio.h> 37 37 #include <stdlib.h> 38 #include <str.h>39 38 #include <ui/fixed.h> 40 39 #include <ui/resource.h> … … 69 68 * @return EOK on success or an error code 70 69 */ 71 static errno_t display_cfg_create(const char *display_spec, 72 display_cfg_t **rdcfg) 70 errno_t display_cfg_create(const char *display_spec, display_cfg_t **rdcfg) 73 71 { 74 72 ui_t *ui = NULL; … … 179 177 * @param dcfg Display configuration dialog 180 178 */ 181 staticvoid display_cfg_destroy(display_cfg_t *dcfg)179 void display_cfg_destroy(display_cfg_t *dcfg) 182 180 { 183 181 ui_window_destroy(dcfg->window); … … 185 183 } 186 184 187 static void print_syntax(void)188 {189 printf("Syntax: display-cfg [-d <display-spec>]\n");190 }191 192 int main(int argc, char *argv[])193 {194 const char *display_spec = UI_ANY_DEFAULT;195 display_cfg_t *dcfg;196 errno_t rc;197 int i;198 199 i = 1;200 while (i < argc && argv[i][0] == '-') {201 if (str_cmp(argv[i], "-d") == 0) {202 ++i;203 if (i >= argc) {204 printf("Argument missing.\n");205 print_syntax();206 return 1;207 }208 209 display_spec = argv[i++];210 } else {211 printf("Invalid option '%s'.\n", argv[i]);212 print_syntax();213 return 1;214 }215 }216 217 if (i < argc) {218 print_syntax();219 return 1;220 }221 222 rc = display_cfg_create(display_spec, &dcfg);223 if (rc != EOK)224 return 1;225 226 ui_run(dcfg->ui);227 display_cfg_destroy(dcfg);228 229 return 0;230 }231 232 185 /** @} 233 186 */
Note:
See TracChangeset
for help on using the changeset viewer.