Changeset 7e38970d in mainline for uspace/app/terminal/main.c
- Timestamp:
- 2020-12-07T00:08:37Z (4 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 25f26600
- Parents:
- 7a873f0 (diff), 8596474 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/terminal/main.c
r7a873f0 r7e38970d 1 1 /* 2 2 * Copyright (c) 2020 Jiri Svoboda 3 * Copyright (c) 2012 Petr Koupy4 3 * All rights reserved. 5 4 * … … 28 27 */ 29 28 30 /** @addtogroup vterm29 /** @addtogroup terminal 31 30 * @{ 32 31 */ … … 34 33 */ 35 34 36 #include <stdbool.h>37 35 #include <stdio.h> 38 #include <io/pixel.h>39 36 #include <task.h> 40 #include < window.h>41 #include <terminal.h>37 #include <ui/ui.h> 38 #include "terminal.h" 42 39 43 #define NAME " vterm"40 #define NAME "terminal" 44 41 42 /** Print syntax. */ 45 43 static void print_syntax(void) 46 44 { 47 printf("Syntax: %s [-d <display>]\n", NAME); 45 printf("Syntax: %s [<options>]\n", NAME); 46 printf("\t-d <display-spec> Use the specified display\n"); 47 printf("\t-topleft] Place window to the top-left corner of " 48 "the screen\n"); 48 49 } 49 50 50 51 int main(int argc, char *argv[]) 51 52 { 52 const char *display_svc = DISPLAY_DEFAULT; 53 const char *display_spec = UI_DISPLAY_DEFAULT; 54 terminal_t *terminal = NULL; 55 terminal_flags_t flags = 0; 56 errno_t rc; 53 57 int i; 54 58 55 59 i = 1; 56 while (i < argc ) {60 while (i < argc && argv[i][0] == '-') { 57 61 if (str_cmp(argv[i], "-d") == 0) { 58 62 ++i; … … 63 67 } 64 68 65 display_svc = argv[i++]; 69 display_spec = argv[i++]; 70 } else if (str_cmp(argv[i], "-topleft") == 0) { 71 ++i; 72 flags |= tf_topleft; 66 73 } else { 67 74 printf("Invalid option '%s'.\n", argv[i]); … … 71 78 } 72 79 73 window_t *main_window = window_open(display_svc, NULL, 74 WINDOW_MAIN | WINDOW_DECORATED, "vterm"); 75 if (!main_window) { 76 printf("%s: Cannot open main window.\n", NAME); 77 return 2; 80 if (i < argc) { 81 print_syntax(); 82 return 1; 78 83 } 79 84 80 window_resize(main_window, 0, 0, 648, 508, WINDOW_PLACEMENT_TOP | 81 WINDOW_PLACEMENT_LEFT); 82 terminal_t *terminal_widget = 83 create_terminal(window_root(main_window), NULL, 640, 480); 84 if (!terminal_widget) { 85 window_close(main_window); 86 printf("%s: Cannot create widgets.\n", NAME); 87 return 3; 88 } 85 rc = terminal_create(display_spec, 640, 480, flags, &terminal); 86 if (rc != EOK) 87 return 1; 89 88 90 window_exec(main_window);91 89 task_retval(0); 92 90 async_manager(); 93 94 91 return 0; 95 92 }
Note:
See TracChangeset
for help on using the changeset viewer.