Changeset dfc07c1 in mainline
- Timestamp:
- 2012-07-17T14:55:21Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- e435537
- Parents:
- f0348c8
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/console/prompt.c
rf0348c8 rdfc07c1 43 43 * @param indev Where to read characters from. 44 44 * @param hints Number of hints that would be displayed. 45 * 45 46 * @return Whether to print all hints. 47 * 46 48 */ 47 49 bool console_prompt_display_all_hints(indev_t *indev, size_t hints) … … 49 51 ASSERT(indev); 50 52 ASSERT(hints > 0); 51 52 printf("Display all %zu possibilities? (y or n) ", hints);53 53 54 printf("Display all %zu possibilities? (y or n) ", hints); 55 54 56 while (true) { 55 57 wchar_t answer = indev_pop_character(indev); 56 57 if ( answer == 'y' || answer == 'Y') {58 printf(" 58 59 if ((answer == 'y') || (answer == 'Y')) { 60 printf("y"); 59 61 return true; 60 62 } 61 62 if ( answer == 'n' || answer == 'N') {63 printf(" 63 64 if ((answer == 'n') || (answer == 'N')) { 65 printf("n"); 64 66 return false; 65 67 } … … 71 73 * When the function returns false, @p display_hints is set to zero. 72 74 * 73 * @param[in] indevWhere to read characters from.75 * @param[in] indev Where to read characters from. 74 76 * @param[out] display_hints How many hints to display. 77 * 75 78 * @return Whether to display more hints. 79 * 76 80 */ 77 81 bool console_prompt_more_hints(indev_t *indev, size_t *display_hints) … … 79 83 ASSERT(indev); 80 84 ASSERT(display_hints != NULL); 81 85 82 86 printf("--More--"); 83 87 while (true) { 84 88 wchar_t continue_showing_hints = indev_pop_character(indev); 85 89 /* Display a full page again? */ 86 if ( continue_showing_hints == 'y'87 || continue_showing_hints == 'Y'88 || continue_showing_hints == ' ') {90 if ((continue_showing_hints == 'y') || 91 (continue_showing_hints == 'Y') || 92 (continue_showing_hints == ' ')) { 89 93 *display_hints = MAX_TAB_HINTS - 1; 90 94 break; 91 95 } 92 96 93 97 /* Stop displaying hints? */ 94 if ( continue_showing_hints == 'n'95 || continue_showing_hints == 'N'96 || continue_showing_hints == 'q'97 || continue_showing_hints == 'Q') {98 if ((continue_showing_hints == 'n') || 99 (continue_showing_hints == 'N') || 100 (continue_showing_hints == 'q') || 101 (continue_showing_hints == 'Q')) { 98 102 *display_hints = 0; 99 103 break; 100 104 } 101 105 102 106 /* Show one more hint? */ 103 107 if (continue_showing_hints == '\n') { … … 106 110 } 107 111 } 108 112 109 113 /* Delete the --More-- option */ 110 114 printf("\r \r"); 111 115 112 116 return *display_hints > 0; 113 117 }
Note:
See TracChangeset
for help on using the changeset viewer.