List all supported format sequences in the output of "--help".

This commit is contained in:
Andrew Wood
2024-12-08 20:40:05 +00:00
parent fb2e6b4074
commit f495303177
11 changed files with 129 additions and 40 deletions
+9 -5
View File
@@ -1,7 +1,7 @@
msgid ""
msgstr ""
"Report-Msgid-Bugs-To: pv@ivarch.com\n"
"POT-Creation-Date: 2024-12-08 20:11+0000\n"
"POT-Creation-Date: 2024-12-08 20:38+0000\n"
"PO-Revision-Date: 2024-10-13 20:43+0000\n"
"Last-Translator: mmatous <mmatous@users.noreply.translate.codeberg.org>\n"
"Language-Team: Czech <https://translate.codeberg.org/projects/pv/pv/cs/>\n"
@@ -249,18 +249,22 @@ msgstr "ukaž informace o verzi a skonči"
msgid "write debug logs to FILE"
msgstr "zapiš ladící záznamy do SOUBORu"
#: src/main/help.c:450
#: src/main/help.c:451
#, c-format
msgid "Usage: %s [OPTION] [FILE]..."
msgstr "Použití: %s [VOLBY] [SOUBOR]..."
#: src/main/help.c:461
#: src/main/help.c:462
msgid ""
"Concatenate FILE(s), or standard input, to standard output, with monitoring."
msgstr ""
"Spoj SOUBOR(y) nebo standardní vstup na standardního výstup, s monitoringem."
#: src/main/help.c:598
#: src/main/help.c:600
msgid "Supported format sequences:"
msgstr ""
#: src/main/help.c:614
#, c-format
msgid "Please report any bugs to: %s"
msgstr "Prosím, hlašte veškeré chyby na: %s"
@@ -433,7 +437,7 @@ msgstr "b"
msgid "B"
msgstr "B"
#: src/pv/display.c:1602 src/pv/transfer.c:1056
#: src/pv/display.c:1638 src/pv/transfer.c:1056
msgid "buffer allocation failed"
msgstr "selhala alokace vyrovnávací paměti"
+9 -5
View File
@@ -1,7 +1,7 @@
msgid ""
msgstr ""
"Report-Msgid-Bugs-To: pv@ivarch.com\n"
"POT-Creation-Date: 2024-12-08 20:11+0000\n"
"POT-Creation-Date: 2024-12-08 20:38+0000\n"
"PO-Revision-Date: 2024-10-13 20:43+0000\n"
"Last-Translator: fnetX <otto@codeberg.org>\n"
"Language-Team: German <https://translate.codeberg.org/projects/pv/pv/de/>\n"
@@ -266,19 +266,23 @@ msgstr "zeige Versionsinformationen und beende"
msgid "write debug logs to FILE"
msgstr "schreibe Debug-Protokolle in DATEI"
#: src/main/help.c:450
#: src/main/help.c:451
#, c-format
msgid "Usage: %s [OPTION] [FILE]..."
msgstr "Aufruf: %s [OPTION] [DATEI]..."
#: src/main/help.c:461
#: src/main/help.c:462
msgid ""
"Concatenate FILE(s), or standard input, to standard output, with monitoring."
msgstr ""
"Verbindet DATEI(en) oder den Standard-Eingabe-Kanal mit dem Standard-Ausgabe-"
"Kanal und misst den Datenstrom."
#: src/main/help.c:598
#: src/main/help.c:600
msgid "Supported format sequences:"
msgstr ""
#: src/main/help.c:614
#, c-format
msgid "Please report any bugs to: %s"
msgstr "Bitte senden Sie Fehlerberichte an %s"
@@ -456,7 +460,7 @@ msgstr "b"
msgid "B"
msgstr "B"
#: src/pv/display.c:1602 src/pv/transfer.c:1056
#: src/pv/display.c:1638 src/pv/transfer.c:1056
msgid "buffer allocation failed"
msgstr "Speicherzuweisung für den Puffer fehlgeschlagen"
+9 -5
View File
@@ -1,7 +1,7 @@
msgid ""
msgstr ""
"Report-Msgid-Bugs-To: pv@ivarch.com\n"
"POT-Creation-Date: 2024-12-08 20:11+0000\n"
"POT-Creation-Date: 2024-12-08 20:38+0000\n"
"Language: es\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@@ -244,17 +244,21 @@ msgstr ""
msgid "write debug logs to FILE"
msgstr ""
#: src/main/help.c:450
#: src/main/help.c:451
#, c-format
msgid "Usage: %s [OPTION] [FILE]..."
msgstr ""
#: src/main/help.c:461
#: src/main/help.c:462
msgid ""
"Concatenate FILE(s), or standard input, to standard output, with monitoring."
msgstr ""
#: src/main/help.c:598
#: src/main/help.c:600
msgid "Supported format sequences:"
msgstr ""
#: src/main/help.c:614
#, c-format
msgid "Please report any bugs to: %s"
msgstr ""
@@ -425,7 +429,7 @@ msgstr ""
msgid "B"
msgstr ""
#: src/pv/display.c:1602 src/pv/transfer.c:1056
#: src/pv/display.c:1638 src/pv/transfer.c:1056
msgid "buffer allocation failed"
msgstr ""
+9 -5
View File
@@ -1,7 +1,7 @@
msgid ""
msgstr ""
"Report-Msgid-Bugs-To: pv@ivarch.com\n"
"POT-Creation-Date: 2024-12-08 20:11+0000\n"
"POT-Creation-Date: 2024-12-08 20:38+0000\n"
"PO-Revision-Date: 2024-10-12 11:13+0000\n"
"Last-Translator: a-j-wood <a-j-wood@users.noreply.translate.codeberg.org>\n"
"Language-Team: French <https://translate.codeberg.org/projects/pv/pv/fr/>\n"
@@ -267,19 +267,23 @@ msgstr "afficher la version puis quitter"
msgid "write debug logs to FILE"
msgstr "écrire les journaux de déboggage vers FICHIER"
#: src/main/help.c:450
#: src/main/help.c:451
#, c-format
msgid "Usage: %s [OPTION] [FILE]..."
msgstr "Utilisation : %s [OPTIONS] [FICHIER]..."
#: src/main/help.c:461
#: src/main/help.c:462
msgid ""
"Concatenate FILE(s), or standard input, to standard output, with monitoring."
msgstr ""
"Concaténer FICHIER(s), ou l'entrée standard, sur la sortie standard avec "
"monitorage."
#: src/main/help.c:598
#: src/main/help.c:600
msgid "Supported format sequences:"
msgstr ""
#: src/main/help.c:614
#, c-format
msgid "Please report any bugs to: %s"
msgstr "SVP rapporter tous bogues à %s"
@@ -460,7 +464,7 @@ msgstr ""
msgid "B"
msgstr "O"
#: src/pv/display.c:1602 src/pv/transfer.c:1056
#: src/pv/display.c:1638 src/pv/transfer.c:1056
msgid "buffer allocation failed"
msgstr "échec de l'allocation de mémoire tampon"
+9 -5
View File
@@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: pv@ivarch.com\n"
"POT-Creation-Date: 2024-12-08 20:11+0000\n"
"POT-Creation-Date: 2024-12-08 20:38+0000\n"
"PO-Revision-Date: 2024-10-20 14:07+0000\n"
"Last-Translator: coralpink <coralpink@users.noreply.translate.codeberg.org>\n"
"Language-Team: Polish <https://translate.codeberg.org/projects/pv/pv/pl/>\n"
@@ -261,19 +261,23 @@ msgstr "wyświetl informacje o wersji i wyjdź"
msgid "write debug logs to FILE"
msgstr "zapisz logi debugujące do PLIK"
#: src/main/help.c:450
#: src/main/help.c:451
#, c-format
msgid "Usage: %s [OPTION] [FILE]..."
msgstr "Sposób użycia: %s [OPCJA] [PLIK]..."
#: src/main/help.c:461
#: src/main/help.c:462
msgid ""
"Concatenate FILE(s), or standard input, to standard output, with monitoring."
msgstr ""
"Łączenie PLIK(ów) lub wejścia standardowego, do wyjścia standardowego z "
"monitoringiem."
#: src/main/help.c:598
#: src/main/help.c:600
msgid "Supported format sequences:"
msgstr ""
#: src/main/help.c:614
#, c-format
msgid "Please report any bugs to: %s"
msgstr "Proszę przesyłać zgłoszenia błędów do %s"
@@ -451,7 +455,7 @@ msgstr "b"
msgid "B"
msgstr "B"
#: src/pv/display.c:1602 src/pv/transfer.c:1056
#: src/pv/display.c:1638 src/pv/transfer.c:1056
msgid "buffer allocation failed"
msgstr "nie udało się zaalokować bufora"
+9 -5
View File
@@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: pv@ivarch.com\n"
"POT-Creation-Date: 2024-12-08 20:11+0000\n"
"POT-Creation-Date: 2024-12-08 20:38+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -252,19 +252,23 @@ msgstr "exibe a versão e termina"
msgid "write debug logs to FILE"
msgstr ""
#: src/main/help.c:450
#: src/main/help.c:451
#, c-format
msgid "Usage: %s [OPTION] [FILE]..."
msgstr "Uso: %s [OPÇÕES] [ARQUIVOS]..."
#: src/main/help.c:461
#: src/main/help.c:462
msgid ""
"Concatenate FILE(s), or standard input, to standard output, with monitoring."
msgstr ""
"Concatena ARQUIVO(s) ou a entrada padrão e grava na saída padrão, com "
"monitoramento."
#: src/main/help.c:598
#: src/main/help.c:600
msgid "Supported format sequences:"
msgstr ""
#: src/main/help.c:614
#, c-format
msgid "Please report any bugs to: %s"
msgstr "Por favor, reporte quaisquer defeitos para %s"
@@ -439,7 +443,7 @@ msgstr ""
msgid "B"
msgstr ""
#: src/pv/display.c:1602 src/pv/transfer.c:1056
#: src/pv/display.c:1638 src/pv/transfer.c:1056
msgid "buffer allocation failed"
msgstr "erro alocando o buffer"
+9 -5
View File
@@ -1,7 +1,7 @@
msgid ""
msgstr ""
"Report-Msgid-Bugs-To: pv@ivarch.com\n"
"POT-Creation-Date: 2024-12-08 20:11+0000\n"
"POT-Creation-Date: 2024-12-08 20:38+0000\n"
"PO-Revision-Date: 2024-10-22 18:07+0000\n"
"Last-Translator: 0ko <0ko@users.noreply.translate.codeberg.org>\n"
"Language-Team: Russian <https://translate.codeberg.org/projects/pv/pv/ru/>\n"
@@ -251,17 +251,21 @@ msgstr "показать версию программы и завершить
msgid "write debug logs to FILE"
msgstr "вести запись отладочного журнала в ФАЙЛ"
#: src/main/help.c:450
#: src/main/help.c:451
#, c-format
msgid "Usage: %s [OPTION] [FILE]..."
msgstr "Использование: %s [ОПЦИИ] [ФАЙЛ]..."
#: src/main/help.c:461
#: src/main/help.c:462
msgid ""
"Concatenate FILE(s), or standard input, to standard output, with monitoring."
msgstr ""
#: src/main/help.c:598
#: src/main/help.c:600
msgid "Supported format sequences:"
msgstr ""
#: src/main/help.c:614
#, c-format
msgid "Please report any bugs to: %s"
msgstr "Сообщайте о проблемах на: %s"
@@ -434,7 +438,7 @@ msgstr "бит"
msgid "B"
msgstr "байт"
#: src/pv/display.c:1602 src/pv/transfer.c:1056
#: src/pv/display.c:1638 src/pv/transfer.c:1056
msgid "buffer allocation failed"
msgstr "не удалось выделить память для буфера"
+9 -5
View File
@@ -2,7 +2,7 @@ msgid ""
msgstr ""
"Project-Id-Version: pv 1.8.14\n"
"Report-Msgid-Bugs-To: pv@ivarch.com\n"
"POT-Creation-Date: 2024-12-08 20:11+0000\n"
"POT-Creation-Date: 2024-12-08 20:38+0000\n"
"PO-Revision-Date: 2024-10-12 23:51+0000\n"
"Last-Translator: a-j-wood <a-j-wood@users.noreply.translate.codeberg.org>\n"
"Language-Team: Turkish <https://translate.codeberg.org/projects/pv/pv/tr/>\n"
@@ -250,18 +250,22 @@ msgstr "sürüm bilgilerini göster ve çık"
msgid "write debug logs to FILE"
msgstr "Hata ayıklama kayıtlarını DOSYA'ya yaz"
#: src/main/help.c:450
#: src/main/help.c:451
#, c-format
msgid "Usage: %s [OPTION] [FILE]..."
msgstr "Kullanım şekli: %s [AYAR] [DOSYA]..."
#: src/main/help.c:461
#: src/main/help.c:462
msgid ""
"Concatenate FILE(s), or standard input, to standard output, with monitoring."
msgstr ""
"İzleme ile DOSYA(lar)ı veya standart girdiyi standart çıktı ile birleştirin."
#: src/main/help.c:598
#: src/main/help.c:600
msgid "Supported format sequences:"
msgstr ""
#: src/main/help.c:614
#, c-format
msgid "Please report any bugs to: %s"
msgstr "Lütfen hataları şu adrese bildirin: %s"
@@ -435,7 +439,7 @@ msgstr "b"
msgid "B"
msgstr "B"
#: src/pv/display.c:1602 src/pv/transfer.c:1056
#: src/pv/display.c:1638 src/pv/transfer.c:1056
msgid "buffer allocation failed"
msgstr "arabellek tahsisi başarısız oldu"
+5
View File
@@ -275,6 +275,11 @@ extern void pv_sig_fini(pvstate_t);
*/
extern void pv_state_free(/*@only@*/ pvstate_t);
/*
* Return a string listing all supported format sequences.
*/
/*@null@*/ char *pv_format_sequences(void);
#if ! HAVE_SETPROCTITLE
void initproctitle(int, char **);
void setproctitle(const char *, ...);
+16
View File
@@ -434,6 +434,7 @@ void display_help(void)
size_t right_margin = 77;
const char *program_description;
const char *bug_report_note;
char *format_sequences = NULL;
unsigned int terminal_width = 0, terminal_height = 0;
pv_screensize(&terminal_width, &terminal_height);
@@ -593,6 +594,21 @@ void display_help(void)
printf("\n");
}
format_sequences = pv_format_sequences();
if (NULL != format_sequences) {
const char *format_sequence_header;
format_sequence_header = _("Supported format sequences:");
if (NULL != format_sequence_header) {
printf("\n");
display_word_wrap(format_sequence_header, right_margin, 0);
printf("\n");
}
printf("\n ");
display_word_wrap(format_sequences, right_margin, 2);
free(format_sequences);
printf("\n");
}
printf("\n");
bug_report_note = _("Please report any bugs to: %s");
+36
View File
@@ -1329,6 +1329,42 @@ static struct pvdisplay_component_s {
};
/*
* Return a pointer to a malloc()ed string containing a space-separated list
* of all supported format sequences. The caller should free() it.
*/
/*@null@ */
char *pv_format_sequences(void)
{
size_t component_idx, buffer_size, offset;
char *buffer;
buffer_size = 0;
for (component_idx = 0; NULL != format_component[component_idx].match; component_idx++) {
size_t component_sequence_length = strlen(format_component[component_idx].match); /* flawfinder: ignore */
/* flawfinder - static strings, guaranteed null-terminated. */
buffer_size += 2 + component_sequence_length; /* 2 for '%' + ' ' */
}
buffer = malloc(buffer_size + 1);
if (NULL == buffer)
return NULL;
offset = 0;
for (component_idx = 0; NULL != format_component[component_idx].match; component_idx++) {
size_t component_sequence_length = strlen(format_component[component_idx].match); /* flawfinder: ignore - as above */
if (0 != offset)
buffer[offset++] = ' ';
buffer[offset++] = '%';
memmove(buffer + offset, format_component[component_idx].match, component_sequence_length);
offset += component_sequence_length;
}
buffer[offset] = '\0';
return buffer;
}
/*
* Initialise the output format structure, based on the current options.
*/