1
1

* popt.h: Adjust poptHelpOptions[] declaration.

* popthelp.c: Replace POPT_ with _ for visible strings.
(singleOptionHelp): Eliminate format array.
(poptHelpOptions): Make const.
(poptPrintHelp): Return width of left column.

* main.c (print_mc_usage): Use width from poptPrintHelp() for "+number".
Этот коммит содержится в:
Andrew V. Samoilov 2002-10-09 15:27:01 +00:00
родитель b9331ba800
Коммит ca70ee44c5
4 изменённых файлов: 30 добавлений и 12 удалений

Просмотреть файл

@ -1,3 +1,21 @@
2002-10-09 Andrew V. Samoilov <sav@bcs.zp.ua>
* popt.h: Adjust poptHelpOptions[] declaration.
* popthelp.c: Replace POPT_ with _ for visible strings.
(singleOptionHelp): Eliminate format array.
(poptHelpOptions): Make const.
(poptPrintHelp): Return width of left column.
* main.c (print_mc_usage): Use width from poptPrintHelp()
for "+number".
2002-10-07 Andrew V. Samoilov <sav@bcs.zp.ua>
* boxes.c (sel_charset_button): Use g_snprintf() instead of
sprintf().
* charsets.c (init_translation_table): Likewise.
2002-10-07 Pavel Roskin <proski@gnu.org>
* view.c: Move call to view_update_bytes_per_line() from

Просмотреть файл

@ -2072,14 +2072,15 @@ init_sigchld (void)
static void
print_mc_usage (poptContext ctx, FILE * stream)
{
int leftColWidth;
fprintf (stream,
_("Usage is:\n\n"
"mc [flags] [this_dir] [other_panel_dir]\n\n"));
/* print help for options */
poptPrintHelp (ctx, stream, 0);
leftColWidth = poptPrintHelp (ctx, stream, 0);
fprintf (stream, " %-19s %s\n", _("+number"),
fprintf (stream, " %-*s %s\n", leftColWidth, _("+number"),
_("Set initial line number for the internal editor"));
fprintf (stream,
_("\n"

Просмотреть файл

@ -68,7 +68,7 @@ struct poptAlias {
char ** argv; /* must be free()able */
};
extern struct poptOption poptHelpOptions[];
extern struct poptOption const poptHelpOptions[];
#define POPT_AUTOHELP { NULL, '\0', POPT_ARG_INCLUDE_TABLE, poptHelpOptions, \
0, "Help options", NULL },
@ -111,7 +111,7 @@ int poptReadDefaultConfig(poptContext con, int useEnv);
int poptParseArgvString(const char * s, int * argcPtr, char *** argvPtr);
const char * poptStrerror(const int error);
void poptSetExecPath(poptContext con, const char * path, int allowAbsolute);
void poptPrintHelp(poptContext con, FILE * f, int flags);
int poptPrintHelp(poptContext con, FILE * f, int flags);
void poptPrintUsage(poptContext con, FILE * f, int flags);
void poptSetOtherOptionHelp(poptContext con, const char * text);
const char * poptGetInvocationName(poptContext con);

Просмотреть файл

@ -26,7 +26,7 @@ static void displayArgs(poptContext con, enum poptCallbackReason foo,
exit(0);
}
struct poptOption poptHelpOptions[] = {
struct poptOption const poptHelpOptions[] = {
{ NULL, '\0', POPT_ARG_CALLBACK, (void *)&displayArgs, '\0', NULL },
{ "help", '?', 0, NULL, '?', N_("Show this help message") },
{ "usage", '\0', 0, NULL, 'u', N_("Display brief usage message") },
@ -57,7 +57,7 @@ static const char * getArgDescrip(const struct poptOption * opt,
if (opt->argDescrip) return POPT_(opt->argDescrip);
if (opt->argDescrip) return D_(translation_domain, opt->argDescrip);
return POPT_("ARG");
return _("ARG");
}
static void singleOptionHelp(FILE * f, int maxLeftCol,
@ -68,7 +68,6 @@ static void singleOptionHelp(FILE * f, int maxLeftCol,
const char * help = D_(translation_domain, opt->descrip);
int helpLength;
const char * ch;
char format[10];
char * left;
const char * argDescrip = getArgDescrip(opt, translation_domain);
@ -102,8 +101,7 @@ static void singleOptionHelp(FILE * f, int maxLeftCol,
while (ch > (help + 1) && isspace(*ch)) ch--;
ch++;
sprintf(format, "%%.%ds\n%%%ds", (int) (ch - help), indentLength);
fprintf(f, format, help, " ");
fprintf(f, "%.*s\n%*s", (int) (ch - help), help, indentLength, " ");
help = ch;
while (isspace(*help) && *help) help++;
helpLength = strlen(help);
@ -178,7 +176,7 @@ static int showHelpIntro(poptContext con, FILE * f) {
int len = 6;
char * fn;
fprintf(f, POPT_("Usage:"));
fprintf(f, _("Usage:"));
if (!(con->flags & POPT_CONTEXT_KEEP_FIRST)) {
fn = con->optionStack->argv[0];
if (strchr(fn, '/')) fn = strchr(fn, '/') + 1;
@ -189,17 +187,18 @@ static int showHelpIntro(poptContext con, FILE * f) {
return len;
}
void poptPrintHelp(poptContext con, FILE * f, int flags) {
int poptPrintHelp(poptContext con, FILE * f, int flags) {
int leftColWidth;
showHelpIntro(con, f);
if (con->otherHelp)
fprintf(f, " %s\n", con->otherHelp);
else
fprintf(f, " %s\n", POPT_("[OPTION...]"));
fprintf(f, " %s\n", _("[OPTION...]"));
leftColWidth = maxArgWidth(con->options, NULL);
singleTableHelp(f, con->options, leftColWidth, NULL);
return leftColWidth;
}
static int singleOptionUsage(FILE * f, int cursor,