diff --git a/configure.ac b/configure.ac index 87bec80..6e6b6ef 100644 --- a/configure.ac +++ b/configure.ac @@ -33,6 +33,7 @@ AC_CHECK_FUNCS([setitimer]) AC_CHECK_FUNCS([setproctitle]) AC_CHECK_HEADERS([getopt.h]) AC_CHECK_HEADERS([limits.h]) +AC_CHECK_HEADERS([langinfo.h]) AC_CHECK_HEADERS([wctype.h]) AC_CHECK_HEADERS([termios.h]) AC_CHECK_HEADERS([libgen.h]) diff --git a/po/cs.po b/po/cs.po index 15847de..e51891d 100644 --- a/po/cs.po +++ b/po/cs.po @@ -1,7 +1,7 @@ msgid "" msgstr "" "Report-Msgid-Bugs-To: pv@ivarch.com\n" -"POT-Creation-Date: 2024-12-09 21:44+0000\n" +"POT-Creation-Date: 2024-12-09 23:15+0000\n" "PO-Revision-Date: 2024-10-13 20:43+0000\n" "Last-Translator: mmatous \n" "Language-Team: Czech \n" @@ -269,11 +269,11 @@ msgstr "" msgid "Please report any bugs to: %s" msgstr "Prosím, hlašte veškeré chyby na: %s" -#: src/main/main.c:230 +#: src/main/main.c:232 msgid "(input)" msgstr "(vstup)" -#: src/main/main.c:319 +#: src/main/main.c:328 msgid "state allocation failed" msgstr "selhala alokace stavu" @@ -407,7 +407,7 @@ msgstr "yzafpnum kMGTPEZY" msgid "yzafpnum KMGTPEZY" msgstr "yzafpnum KMGTPEZY" -#: src/pv/display.c:890 src/pv/transfer.c:1056 +#: src/pv/display.c:891 src/pv/transfer.c:1056 msgid "buffer allocation failed" msgstr "selhala alokace vyrovnávací paměti" @@ -490,7 +490,7 @@ msgstr "pid" msgid "history structure allocation failed" msgstr "selhala alokace struktury historie" -#: src/pv/state.c:572 src/pv/state.c:583 +#: src/pv/state.c:576 src/pv/state.c:587 msgid "file list allocation failed" msgstr "selhala alokace seznamu souborů" diff --git a/po/de.po b/po/de.po index c513ebc..eafef4d 100644 --- a/po/de.po +++ b/po/de.po @@ -1,7 +1,7 @@ msgid "" msgstr "" "Report-Msgid-Bugs-To: pv@ivarch.com\n" -"POT-Creation-Date: 2024-12-09 21:44+0000\n" +"POT-Creation-Date: 2024-12-09 23:15+0000\n" "PO-Revision-Date: 2024-10-13 20:43+0000\n" "Last-Translator: fnetX \n" "Language-Team: German \n" @@ -287,11 +287,11 @@ msgstr "" msgid "Please report any bugs to: %s" msgstr "Bitte senden Sie Fehlerberichte an %s" -#: src/main/main.c:230 +#: src/main/main.c:232 msgid "(input)" msgstr "(eingabe)" -#: src/main/main.c:319 +#: src/main/main.c:328 msgid "state allocation failed" msgstr "Speicherzuweisung für `state' fehlgeschlagen" @@ -430,7 +430,7 @@ msgstr "yzafpnµm kMGTPEZY" msgid "yzafpnum KMGTPEZY" msgstr "yzafpnµm KMGTPEZY" -#: src/pv/display.c:890 src/pv/transfer.c:1056 +#: src/pv/display.c:891 src/pv/transfer.c:1056 msgid "buffer allocation failed" msgstr "Speicherzuweisung für den Puffer fehlgeschlagen" @@ -514,7 +514,7 @@ msgstr "pid" msgid "history structure allocation failed" msgstr "Speicherzuweisung für `history' fehlgeschlagen" -#: src/pv/state.c:572 src/pv/state.c:583 +#: src/pv/state.c:576 src/pv/state.c:587 msgid "file list allocation failed" msgstr "Speicherzuweisung für die Dateiliste fehlgeschlagen" diff --git a/po/es.po b/po/es.po index f1093cd..63e2b70 100644 --- a/po/es.po +++ b/po/es.po @@ -1,7 +1,7 @@ msgid "" msgstr "" "Report-Msgid-Bugs-To: pv@ivarch.com\n" -"POT-Creation-Date: 2024-12-09 21:44+0000\n" +"POT-Creation-Date: 2024-12-09 23:15+0000\n" "Language: es\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -263,11 +263,11 @@ msgstr "" msgid "Please report any bugs to: %s" msgstr "" -#: src/main/main.c:230 +#: src/main/main.c:232 msgid "(input)" msgstr "" -#: src/main/main.c:319 +#: src/main/main.c:328 msgid "state allocation failed" msgstr "" @@ -399,7 +399,7 @@ msgstr "" msgid "yzafpnum KMGTPEZY" msgstr "" -#: src/pv/display.c:890 src/pv/transfer.c:1056 +#: src/pv/display.c:891 src/pv/transfer.c:1056 msgid "buffer allocation failed" msgstr "" @@ -482,7 +482,7 @@ msgstr "" msgid "history structure allocation failed" msgstr "" -#: src/pv/state.c:572 src/pv/state.c:583 +#: src/pv/state.c:576 src/pv/state.c:587 msgid "file list allocation failed" msgstr "" diff --git a/po/fr.po b/po/fr.po index 395e888..492092b 100644 --- a/po/fr.po +++ b/po/fr.po @@ -1,7 +1,7 @@ msgid "" msgstr "" "Report-Msgid-Bugs-To: pv@ivarch.com\n" -"POT-Creation-Date: 2024-12-09 21:44+0000\n" +"POT-Creation-Date: 2024-12-09 23:15+0000\n" "PO-Revision-Date: 2024-10-12 11:13+0000\n" "Last-Translator: a-j-wood \n" "Language-Team: French \n" @@ -288,11 +288,11 @@ msgstr "" msgid "Please report any bugs to: %s" msgstr "SVP rapporter tous bogues à %s" -#: src/main/main.c:230 +#: src/main/main.c:232 msgid "(input)" msgstr "(entrée)" -#: src/main/main.c:319 +#: src/main/main.c:328 msgid "state allocation failed" msgstr "échec de l'allocation de mémoire de condition" @@ -434,7 +434,7 @@ msgstr "" msgid "yzafpnum KMGTPEZY" msgstr "" -#: src/pv/display.c:890 src/pv/transfer.c:1056 +#: src/pv/display.c:891 src/pv/transfer.c:1056 msgid "buffer allocation failed" msgstr "échec de l'allocation de mémoire tampon" @@ -517,7 +517,7 @@ msgstr "" msgid "history structure allocation failed" msgstr "l'allocation de la structure de l'historique a échoué" -#: src/pv/state.c:572 src/pv/state.c:583 +#: src/pv/state.c:576 src/pv/state.c:587 msgid "file list allocation failed" msgstr "échec de l'allocation de la liste de fichiers" diff --git a/po/pl.po b/po/pl.po index 82953b4..a18984f 100644 --- a/po/pl.po +++ b/po/pl.po @@ -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-09 21:44+0000\n" +"POT-Creation-Date: 2024-12-09 23:15+0000\n" "PO-Revision-Date: 2024-10-20 14:07+0000\n" "Last-Translator: coralpink \n" "Language-Team: Polish \n" @@ -282,11 +282,11 @@ msgstr "" msgid "Please report any bugs to: %s" msgstr "Proszę przesyłać zgłoszenia błędów do %s" -#: src/main/main.c:230 +#: src/main/main.c:232 msgid "(input)" msgstr "(wejście)" -#: src/main/main.c:319 +#: src/main/main.c:328 msgid "state allocation failed" msgstr "alokacja stanu programu nie powiodła się" @@ -425,7 +425,7 @@ msgstr "yzafpnum kMGTPEZY" msgid "yzafpnum KMGTPEZY" msgstr "yzafpnum KMGTPEZY" -#: src/pv/display.c:890 src/pv/transfer.c:1056 +#: src/pv/display.c:891 src/pv/transfer.c:1056 msgid "buffer allocation failed" msgstr "nie udało się zaalokować bufora" @@ -509,7 +509,7 @@ msgstr "pid" msgid "history structure allocation failed" msgstr "nie udało się zaalokować struktury historii" -#: src/pv/state.c:572 src/pv/state.c:583 +#: src/pv/state.c:576 src/pv/state.c:587 msgid "file list allocation failed" msgstr "nie udało się zaalokować listy plików" diff --git a/po/pt.po b/po/pt.po index 751e6c3..a2204e5 100644 --- a/po/pt.po +++ b/po/pt.po @@ -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-09 21:44+0000\n" +"POT-Creation-Date: 2024-12-09 23:15+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -273,11 +273,11 @@ msgstr "" msgid "Please report any bugs to: %s" msgstr "Por favor, reporte quaisquer defeitos para %s" -#: src/main/main.c:230 +#: src/main/main.c:232 msgid "(input)" msgstr "" -#: src/main/main.c:319 +#: src/main/main.c:328 msgid "state allocation failed" msgstr "alocação de memória de status falhou" @@ -413,7 +413,7 @@ msgstr "" msgid "yzafpnum KMGTPEZY" msgstr "" -#: src/pv/display.c:890 src/pv/transfer.c:1056 +#: src/pv/display.c:891 src/pv/transfer.c:1056 msgid "buffer allocation failed" msgstr "erro alocando o buffer" @@ -496,7 +496,7 @@ msgstr "" msgid "history structure allocation failed" msgstr "" -#: src/pv/state.c:572 src/pv/state.c:583 +#: src/pv/state.c:576 src/pv/state.c:587 msgid "file list allocation failed" msgstr "" diff --git a/po/ru.po b/po/ru.po index 47ae9eb..b8b8bb7 100644 --- a/po/ru.po +++ b/po/ru.po @@ -1,7 +1,7 @@ msgid "" msgstr "" "Report-Msgid-Bugs-To: pv@ivarch.com\n" -"POT-Creation-Date: 2024-12-09 21:44+0000\n" +"POT-Creation-Date: 2024-12-09 23:15+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 \n" @@ -270,11 +270,11 @@ msgstr "" msgid "Please report any bugs to: %s" msgstr "Сообщайте о проблемах на: %s" -#: src/main/main.c:230 +#: src/main/main.c:232 msgid "(input)" msgstr "(ввод)" -#: src/main/main.c:319 +#: src/main/main.c:328 msgid "state allocation failed" msgstr "" @@ -408,7 +408,7 @@ msgstr "" msgid "yzafpnum KMGTPEZY" msgstr "" -#: src/pv/display.c:890 src/pv/transfer.c:1056 +#: src/pv/display.c:891 src/pv/transfer.c:1056 msgid "buffer allocation failed" msgstr "не удалось выделить память для буфера" @@ -491,7 +491,7 @@ msgstr "ИДпр" msgid "history structure allocation failed" msgstr "не удалось выделить память для структуры истории" -#: src/pv/state.c:572 src/pv/state.c:583 +#: src/pv/state.c:576 src/pv/state.c:587 msgid "file list allocation failed" msgstr "не удалось выделить память для списка файлов" diff --git a/po/tr.po b/po/tr.po index 3b81a4a..c199416 100644 --- a/po/tr.po +++ b/po/tr.po @@ -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-09 21:44+0000\n" +"POT-Creation-Date: 2024-12-09 23:15+0000\n" "PO-Revision-Date: 2024-10-12 23:51+0000\n" "Last-Translator: a-j-wood \n" "Language-Team: Turkish \n" @@ -270,11 +270,11 @@ msgstr "" msgid "Please report any bugs to: %s" msgstr "Lütfen hataları şu adrese bildirin: %s" -#: src/main/main.c:230 +#: src/main/main.c:232 msgid "(input)" msgstr "(giriş)" -#: src/main/main.c:319 +#: src/main/main.c:328 msgid "state allocation failed" msgstr "durum tahsisi başarısız oldu" @@ -409,7 +409,7 @@ msgstr "yzafpnum kMGTPEZY" msgid "yzafpnum KMGTPEZY" msgstr "yzafpnum KMGTPEZY" -#: src/pv/display.c:890 src/pv/transfer.c:1056 +#: src/pv/display.c:891 src/pv/transfer.c:1056 msgid "buffer allocation failed" msgstr "arabellek tahsisi başarısız oldu" @@ -492,7 +492,7 @@ msgstr "pid" msgid "history structure allocation failed" msgstr "geçmiş yapısı tahsisi başarısız oldu" -#: src/pv/state.c:572 src/pv/state.c:583 +#: src/pv/state.c:576 src/pv/state.c:587 msgid "file list allocation failed" msgstr "dosya listesi tahsisi başarısız oldu" diff --git a/src/include/config.h.in b/src/include/config.h.in index fc96b93..05cd084 100644 --- a/src/include/config.h.in +++ b/src/include/config.h.in @@ -65,6 +65,9 @@ /* IPC support enabled */ #undef HAVE_IPC +/* Define to 1 if you have the header file. */ +#undef HAVE_LANGINFO_H + /* Define to 1 if you have the header file. */ #undef HAVE_LIBGEN_H diff --git a/src/include/pv-internal.h b/src/include/pv-internal.h index 3ff8425..5df924d 100644 --- a/src/include/pv-internal.h +++ b/src/include/pv-internal.h @@ -132,6 +132,7 @@ struct pvstate_s { bool no_splice; /* never use splice() */ bool discard_input; /* write nothing to stdout */ bool show_stats; /* show statistics on exit */ + bool can_display_utf8; /* whether UTF-8 output is permitted */ bool width_set_manually; /* width was set manually, not detected */ bool height_set_manually; /* height was set manually, not detected */ } control; diff --git a/src/include/pv.h b/src/include/pv.h index a25ddd0..e747279 100644 --- a/src/include/pv.h +++ b/src/include/pv.h @@ -230,6 +230,7 @@ extern void pv_state_watch_pid_set(pvstate_t, pid_t); extern void pv_state_watch_fd_set(pvstate_t, int); extern void pv_state_output_set(pvstate_t, int, const char *); extern void pv_state_average_rate_window_set(pvstate_t, unsigned int); +extern void pv_state_set_can_display_utf8(pvstate_t, bool); extern void pv_state_inputfiles(pvstate_t, unsigned int, const char **); diff --git a/src/main/main.c b/src/main/main.c index 2ba4747..7fc653c 100644 --- a/src/main/main.c +++ b/src/main/main.c @@ -19,7 +19,9 @@ #include #include #include - +#ifdef HAVE_LANGINFO_H +#include +#endif int pv_remote_set(opts_t, pvstate_t); void pv_remote_init(void); @@ -279,6 +281,7 @@ int main(int argc, char **argv) /*@only@ */ pvstate_t state = NULL; int retcode = 0; bool can_have_eta = true; + bool can_display_utf8 = false; #if ! HAVE_SETPROCTITLE initproctitle(argc, argv); @@ -289,6 +292,12 @@ int main(int argc, char **argv) (void) setlocale(LC_ALL, ""); (void) bindtextdomain(PACKAGE, LOCALEDIR); (void) textdomain(PACKAGE); +#ifdef HAVE_LANGINFO_H + /*@-mustfreefresh@ *//* splint thinks nl_langinfo() leaks memory */ + if (0 == strcmp(nl_langinfo(CODESET), "UTF-8")) + can_display_utf8 = true; + /*@+mustfreefresh@ */ +#endif #endif /* Parse the command line arguments. */ @@ -503,6 +512,9 @@ int main(int argc, char **argv) can_have_eta ? opts->fineta : false, opts->rate, opts->average_rate, opts->bytes, opts->bufpercent, opts->lastwritten, opts->name); + debug("%s: %s", "can_display_utf8", can_display_utf8 ? "true" : "false"); + pv_state_set_can_display_utf8(state, can_display_utf8); + /* Initialise the signal handling. */ pv_sig_init(state); diff --git a/src/pv/state.c b/src/pv/state.c index 1d47922..534dee4 100644 --- a/src/pv/state.c +++ b/src/pv/state.c @@ -543,6 +543,10 @@ void pv_state_average_rate_window_set(pvstate_t state, unsigned int val) pv_alloc_history(state); } +void pv_state_set_can_display_utf8(pvstate_t state, bool val) +{ + state->control.can_display_utf8 = val; +} /* * Set the array of input files.