Changeset 72cf064 in mainline for kernel/generic/src/console/prompt.c


Ignore:
Timestamp:
2012-08-13T17:17:04Z (12 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
33fee91
Parents:
f4a8734 (diff), 4820360 (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.
Message:

Merge mainline changes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/console/prompt.c

    rf4a8734 r72cf064  
    4343 * @param indev Where to read characters from.
    4444 * @param hints Number of hints that would be displayed.
     45 *
    4546 * @return Whether to print all hints.
     47 *
    4648 */
    4749bool console_prompt_display_all_hints(indev_t *indev, size_t hints)
     
    4951        ASSERT(indev);
    5052        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       
    5456        while (true) {
    5557                wchar_t answer = indev_pop_character(indev);
    56 
    57                 if (answer == 'y' || answer == 'Y') {
    58                         printf(" y");
     58               
     59                if ((answer == 'y') || (answer == 'Y')) {
     60                        printf("y");
    5961                        return true;
    6062                }
    61 
    62                 if (answer == 'n' || answer == 'N') {
    63                         printf(" n");
     63               
     64                if ((answer == 'n') || (answer == 'N')) {
     65                        printf("n");
    6466                        return false;
    6567                }
     
    7173 * When the function returns false, @p display_hints is set to zero.
    7274 *
    73  * @param[in] indev Where to read characters from.
     75 * @param[in]  indev        Where to read characters from.
    7476 * @param[out] display_hints How many hints to display.
     77 *
    7578 * @return Whether to display more hints.
     79 *
    7680 */
    7781bool console_prompt_more_hints(indev_t *indev, size_t *display_hints)
     
    7983        ASSERT(indev);
    8084        ASSERT(display_hints != NULL);
    81 
     85       
    8286        printf("--More--");
    8387        while (true) {
    8488                wchar_t continue_showing_hints = indev_pop_character(indev);
    8589                /* 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 == ' ')) {
    8993                        *display_hints = MAX_TAB_HINTS - 1;
    9094                        break;
    9195                }
    92 
     96               
    9397                /* 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')) {
    98102                        *display_hints = 0;
    99103                        break;
    100104                }
    101 
     105               
    102106                /* Show one more hint? */
    103107                if (continue_showing_hints == '\n') {
     
    106110                }
    107111        }
    108 
     112       
    109113        /* Delete the --More-- option */
    110114        printf("\r         \r");
    111 
     115       
    112116        return *display_hints > 0;
    113117}
Note: See TracChangeset for help on using the changeset viewer.