static void print_option_string(struct nh_option_desc *option, char *buf) { const char *opttxt; char *valstr = get_display_string(option); switch (settings.optstyle) { case OPTSTYLE_DESC: opttxt = option->helptxt; if (!opttxt || strlen(opttxt) < 2) opttxt = option->name; snprintf(buf, BUFSZ, "%.*s\t[%s]", COLS - 21, opttxt, valstr); break; case OPTSTYLE_NAME: snprintf(buf, BUFSZ, "%.*s\t[%s]", COLS - 21, option->name, valstr); break; default: case OPTSTYLE_FULL: snprintf(buf, BUFSZ, "%s\t[%s]\t%.*s", option->name, valstr, COLS - 42, option->helptxt); break; } free(valstr); }
static void print_option_string(struct nh_option_desc *option, char *buf) { char fmt[16]; const char *opttxt; const char *valstr = get_display_string(option); switch (settings.optstyle) { case OPTSTYLE_DESC: opttxt = option->helptxt; if (!opttxt || strlen(opttxt) < 2) opttxt = option->name; sprintf(fmt, "%%.%ds\t[%%s]", COLS - 21); snprintf(buf, BUFSZ, fmt, opttxt, valstr); break; case OPTSTYLE_NAME: sprintf(fmt, "%%.%ds\t[%%s]", COLS - 21); snprintf(buf, BUFSZ, fmt, option->name, valstr); break; default: case OPTSTYLE_FULL: sprintf(fmt, "%%s\t[%%s]\t%%.%ds", COLS - 42); snprintf(buf, BUFSZ, fmt, option->name, valstr, option->helptxt); break; } }
static void open_vis(visualizer_t * v) { char * display_string = get_display_string(v); bg_visualizer_open_id(v->visualizer, &v->audio_format, v->ov_info, display_string); free(display_string); v->vis_open = 1; }