From 2eaffceada21810b44e4694f0b40bd2a4ab7868a Mon Sep 17 00:00:00 2001 From: Dave Davenport Date: Sat, 14 Nov 2015 19:59:56 +0100 Subject: [PATCH] Fix printing. --- include/xrmoptions.h | 2 +- source/dialogs/dmenu.c | 22 +++++++++++----------- source/rofi.c | 22 +++++++++++----------- source/xrmoptions.c | 8 ++++---- 4 files changed, 27 insertions(+), 27 deletions(-) diff --git a/include/xrmoptions.h b/include/xrmoptions.h index 7c76b1b8..ab72bec9 100644 --- a/include/xrmoptions.h +++ b/include/xrmoptions.h @@ -52,5 +52,5 @@ void xresource_dump ( void ); */ void config_parser_add_option ( XrmOptionType type, const char *key, void **value, const char *comment ); void print_options ( void ); -void print_help_msg ( const char *option, const char*text, const char *def, int isatty ); +void print_help_msg ( const char *option, const char *type, const char*text, const char *def, int isatty ); #endif diff --git a/source/dialogs/dmenu.c b/source/dialogs/dmenu.c index a1da408e..16a90627 100644 --- a/source/dialogs/dmenu.c +++ b/source/dialogs/dmenu.c @@ -399,15 +399,15 @@ int dmenu_switcher_dialog ( void ) void print_dmenu_options ( void ) { int is_term = isatty ( fileno ( stdout ) ); - print_help_msg ( "-mesg [string]", "Print a small user message under the prompt (uses pango markup)", NULL, is_term ); - print_help_msg ( "-p [string]", "Prompt to display left of entry field", NULL, is_term ); - print_help_msg ( "-selected-row [integer]", "Select row", NULL, is_term ); - print_help_msg ( "-format [string]", "Output format string", "s", is_term ); - print_help_msg ( "-u [list]", "List of row indexes to mark urgent", NULL, is_term ); - print_help_msg ( "-a [list]", "List of row indexes to mark active", NULL, is_term ); - print_help_msg ( "-l [integer] ", "Number of rows to display", NULL, is_term ); - print_help_msg ( "-i", "Set filter to be case insensitive", NULL, is_term ); - print_help_msg ( "-only-match", "Force selection or custom entry", NULL, is_term ); - print_help_msg ( "-no-custom", "Don't accept custom entry", NULL, is_term ); - print_help_msg ( "-select [string]", "Select the first row that matches", NULL, is_term ); + print_help_msg ( "-mesg","[string]", "Print a small user message under the prompt (uses pango markup)", NULL, is_term ); + print_help_msg ( "-p","[string]", "Prompt to display left of entry field", NULL, is_term ); + print_help_msg ( "-selected-row","[integer]", "Select row", NULL, is_term ); + print_help_msg ( "-format","[string]", "Output format string", "s", is_term ); + print_help_msg ( "-u","[list]", "List of row indexes to mark urgent", NULL, is_term ); + print_help_msg ( "-a","[list]", "List of row indexes to mark active", NULL, is_term ); + print_help_msg ( "-l","[integer] ", "Number of rows to display", NULL, is_term ); + print_help_msg ( "-i","", "Set filter to be case insensitive", NULL, is_term ); + print_help_msg ( "-only-match","", "Force selection or custom entry", NULL, is_term ); + print_help_msg ( "-no-custom","", "Don't accept custom entry", NULL, is_term ); + print_help_msg ( "-select","[string]", "Select the first row that matches", NULL, is_term ); } diff --git a/source/rofi.c b/source/rofi.c index 522a38c5..07ee6aba 100644 --- a/source/rofi.c +++ b/source/rofi.c @@ -1834,17 +1834,17 @@ static void handle_keypress ( XEvent *ev ) static void print_main_application_options ( void ) { int is_term = isatty ( fileno ( stdout ) ); - print_help_msg ( "-no-config", "Do not load configuration, use default values.", NULL, is_term ); - print_help_msg ( "-quiet", "Suppress information messages.", NULL, is_term ); - print_help_msg ( "-v,-version", "Print the version number and exit.", NULL, is_term ); - print_help_msg ( "-dmenu", "Start in dmenu mode.", NULL, is_term ); - print_help_msg ( "-display [string]", "X server to contact.", "${DISPLAY}", is_term ); - print_help_msg ( "-h,-help", "This help message.", NULL, is_term ); - print_help_msg ( "-dump-xresources", "Dump the current configuration in Xresources format and exit.", NULL, is_term ); - print_help_msg ( "-e [string]", "Show a dialog displaying the passed message and exit.", NULL, is_term ); - print_help_msg ( "-markup", "Enable pango markup where possible.", NULL, is_term ); - print_help_msg ( "-normal-window", "In dmenu mode, behave as a normal window. (experimental)", NULL, is_term ); - print_help_msg ( "-show [mode]", "Show the mode 'mode' and exit. The mode has to be enabled.", NULL, is_term ); + print_help_msg ( "-no-config","", "Do not load configuration, use default values.", NULL, is_term ); + print_help_msg ( "-quiet","", "Suppress information messages.", NULL, is_term ); + print_help_msg ( "-v,-version","", "Print the version number and exit.", NULL, is_term ); + print_help_msg ( "-dmenu","", "Start in dmenu mode.", NULL, is_term ); + print_help_msg ( "-display","[string]", "X server to contact.", "${DISPLAY}", is_term ); + print_help_msg ( "-h,-help","", "This help message.", NULL, is_term ); + print_help_msg ( "-dump-xresources","", "Dump the current configuration in Xresources format and exit.", NULL, is_term ); + print_help_msg ( "-e","[string]", "Show a dialog displaying the passed message and exit.", NULL, is_term ); + print_help_msg ( "-markup", "","Enable pango markup where possible.", NULL, is_term ); + print_help_msg ( "-normal-window","", "In dmenu mode, behave as a normal window. (experimental)", NULL, is_term ); + print_help_msg ( "-show", "[mode]", "Show the mode 'mode' and exit. The mode has to be enabled.", NULL, is_term ); } static void help ( G_GNUC_UNUSED int argc, char **argv ) { diff --git a/source/xrmoptions.c b/source/xrmoptions.c index a382fa2c..9549e92a 100644 --- a/source/xrmoptions.c +++ b/source/xrmoptions.c @@ -493,17 +493,17 @@ void print_options ( void ) } } -void print_help_msg ( const char *option, const char*text, const char *def, int isatty ) +void print_help_msg ( const char *option, const char *type, const char*text, const char *def, int isatty ) { - int l = 39 - strlen ( option ); + int l = 37 - strlen ( option )-strlen(type); if ( isatty ) { - printf ( "\t%s%s%s %-*c%s\n", color_bold, option, color_reset, l, ' ', text ); + printf ( "\t%s%s%s %s %-*c%s\n", color_bold, option, color_reset,type, l, ' ', text ); if ( def != NULL ) { printf ( "\t\t%s%s%s\n", color_italic, def, color_reset ); } } else{ - printf ( "\t%s %-*c%s\n", option, l, ' ', text ); + printf ( "\t%s %s %-*c%s\n", option, type,l, ' ', text ); if ( def != NULL ) { printf ( "\t\t%s\n", def ); }