Просмотр исходного кода

dpkg: Automatically prepend needed spaces for continuation force-help lines

Instead of trying to implement automatic word-wrapping, which is really
tricky when having to take into account wide characters, and locales
supporting things like combining characters, or special rules for when
to word-wrap, just take the easy way out, and require a newline
character to know when to wrap the line.
Guillem Jover лет назад: 13
Родитель
Сommit
66cc4f7837
19 измененных файлов с 139 добавлено и 155 удалено
  1. 1 0
      debian/changelog
  2. 6 8
      po/ca.po
  3. 7 8
      po/cs.po
  4. 6 10
      po/da.po
  5. 6 8
      po/de.po
  6. 9 11
      po/eo.po
  7. 7 9
      po/es.po
  8. 9 10
      po/fr.po
  9. 9 12
      po/it.po
  10. 6 9
      po/ja.po
  11. 6 7
      po/pl.po
  12. 7 9
      po/pt.po
  13. 6 7
      po/ru.po
  14. 6 9
      po/sk.po
  15. 5 8
      po/sv.po
  16. 5 6
      po/th.po
  17. 8 11
      po/vi.po
  18. 5 7
      po/zh_TW.po
  19. 25 6
      src/main.c

+ 1 - 0
debian/changelog

@@ -8,6 +8,7 @@ dpkg (1.17.2) UNRELEASED; urgency=low
     Thanks to Salvatore Bonaccorso <carnil@debian.org>. Closes: #718437
   * Version manpages-it in Replaces with (<< 2.80-4), now that the package
     does not ship the overlapping paths any more.
+  * Automatically prepend needed spaces for continuation --force-help lines.
 
  -- Guillem Jover <guillem@debian.org>  Sun, 28 Jul 2013 15:06:29 +0200
 

+ 6 - 8
po/ca.po

@@ -3399,16 +3399,14 @@ msgstr "Utilitza sempre els conffiles antics, sense preguntar"
 #: src/main.c:254
 msgid ""
 "Use the default option for new config files if one\n"
-"                         is available, don't prompt. If no default can be "
-"found,\n"
-"                         you will be prompted unless one of the confold or\n"
-"                         confnew options is also given"
+"is available, don't prompt. If no default can be found,\n"
+"you will be prompted unless one of the confold or\n"
+"confnew options is also given"
 msgstr ""
 "Utilitza l'opció predeterminada pels conffiles nous\n"
-"                        si estan disponibles, sense preguntar. Si no en\n"
-"                        troba cap de predeterminat preguntarà, a menys que\n"
-"                        també li doneu alguna de les opcions confold o "
-"confnew"
+"si estan disponibles, sense preguntar. Si no en troba\n"
+"cap de predeterminat preguntarà, a menys que també\n"
+"li doneu alguna de les opcions confold o confnew"
 
 #: src/main.c:259
 msgid "Always install missing config files"

+ 7 - 8
po/cs.po

@@ -3275,16 +3275,15 @@ msgstr "vždy bez dotazu použije starý konfigurační soubor"
 #: src/main.c:254
 msgid ""
 "Use the default option for new config files if one\n"
-"                         is available, don't prompt. If no default can be "
-"found,\n"
-"                         you will be prompted unless one of the confold or\n"
-"                         confnew options is also given"
+"is available, don't prompt. If no default can be found,\n"
+"you will be prompted unless one of the confold or\n"
+"confnew options is also given"
 msgstr ""
 "pokud existuje, použije pro nové konfigurační\n"
-"                         soubory výchozí volbu a neptá se. Pokud žádná\n"
-"                         výchozí volba neexistuje, budete dotázáni, ale\n"
-"                         pouze pokud nebyly zadány přepínače confold nebo\n"
-"                         confnew"
+"soubory výchozí volbu a neptá se. Pokud žádná\n"
+"výchozí volba neexistuje, budete dotázáni, ale\n"
+"pouze pokud nebyly zadány přepínače confold nebo\n"
+"confnew"
 
 #: src/main.c:259
 msgid "Always install missing config files"

+ 6 - 10
po/da.po

@@ -3309,18 +3309,14 @@ msgstr "Brug altid de gamle konfigurationsfiler, spørg ikke"
 #: src/main.c:254
 msgid ""
 "Use the default option for new config files if one\n"
-"                         is available, don't prompt. If no default can be "
-"found,\n"
-"                         you will be prompted unless one of the confold or\n"
-"                         confnew options is also given"
+"is available, don't prompt. If no default can be found,\n"
+"you will be prompted unless one of the confold or\n"
+"confnew options is also given"
 msgstr ""
 "Brug standardindstillingen for nye konfigurationsfiler\n"
-"                         hvis en sådan er tilgængelig, spørg ikke. Hvis "
-"ingen\n"
-"                         standard kan findes, vil du blive spurgt med "
-"mindre\n"
-"                         en af tilvalgene confold eller confnew også er "
-"angivet"
+"hvis en sådan er tilgængelig, spørg ikke. Hvis ingen\n"
+"standard kan findes, vil du blive spurgt med mindre\n"
+"en af tilvalgene confold eller confnew også er angivet"
 
 #: src/main.c:259
 msgid "Always install missing config files"

+ 6 - 8
po/de.po

@@ -3382,16 +3382,14 @@ msgstr "Immer alte Konf.-Dateien verwenden, nicht nachfragen"
 #: src/main.c:254
 msgid ""
 "Use the default option for new config files if one\n"
-"                         is available, don't prompt. If no default can be "
-"found,\n"
-"                         you will be prompted unless one of the confold or\n"
-"                         confnew options is also given"
+"is available, don't prompt. If no default can be found,\n"
+"you will be prompted unless one of the confold or\n"
+"confnew options is also given"
 msgstr ""
 "Vorgabe für neue Konf.-Dateien benutzen, wenn es eine\n"
-"                           gibt, nicht nachfragen. Wenn Vorgaben nicht\n"
-"                           gefunden werden können, nachfragen, außer "
-"confold\n"
-"                           oder confnew ist auch angegeben."
+"gibt, nicht nachfragen. Wenn Vorgaben nicht\n"
+"gefunden werden können, nachfragen, außer confold\n"
+"oder confnew ist auch angegeben."
 
 #: src/main.c:259
 msgid "Always install missing config files"

+ 9 - 11
po/eo.po

@@ -3293,17 +3293,15 @@ msgstr "Ĉiam uzi la malnovajn akomod-dosierojn, ne demandi"
 #: src/main.c:254
 msgid ""
 "Use the default option for new config files if one\n"
-"                         is available, don't prompt. If no default can be "
-"found,\n"
-"                         you will be prompted unless one of the confold or\n"
-"                         confnew options is also given"
-msgstr ""
-"Uzi la aprioran elekteblon por novaj akomod-dosieroj se iu estos\n"
-"                         disponigita, kaj ne demandi. Se neniu aprioraĵo "
-"povas esti trovata,\n"
-"                         vi estos demandata, nur ne, se unu el la elektebloj "
-"'confold' aŭ\n"
-"                         'confnew' ankaŭ estos provizita"
+"is available, don't prompt. If no default can be found,\n"
+"you will be prompted unless one of the confold or\n"
+"confnew options is also given"
+msgstr ""
+"Uzi la aprioran elekteblon por novaj akomod-dosieroj\n"
+"se iu estos disponigita, kaj ne demandi. Se neniu\n"
+"aprioraĵo povas esti trovata, vi estos demandata, nur\n"
+"ne, se unu el la elektebloj 'confold' aŭ 'confnew'\n"
+"ankaŭ estos provizita"
 
 #: src/main.c:259
 msgid "Always install missing config files"

+ 7 - 9
po/es.po

@@ -3515,17 +3515,15 @@ msgstr "Utiliza siempre los archivos de configuración antiguos, no pregunta."
 #: src/main.c:254
 msgid ""
 "Use the default option for new config files if one\n"
-"                         is available, don't prompt. If no default can be "
-"found,\n"
-"                         you will be prompted unless one of the confold or\n"
-"                         confnew options is also given"
+"is available, don't prompt. If no default can be found,\n"
+"you will be prompted unless one of the confold or\n"
+"confnew options is also given"
 msgstr ""
 "Utiliza la opción predeterminada para los ficheros de\n"
-"                configuración nuevo si están disponibles,\n"
-"                sin preguntar. Si no se encuentra ninguno\n"
-"                predeterminado preguntará, a menos que se\n"
-"                utilicen también alguna de las opciones confold\n"
-"                o confnew."
+"configuración nuevo si están disponibles, sin\n"
+"preguntar. Si no se encuentra ninguno predeterminado\n"
+"preguntará, a menos que se utilicen también alguna de\n"
+"las opciones confold o confnew."
 
 #: src/main.c:259
 msgid "Always install missing config files"

+ 9 - 10
po/fr.po

@@ -3477,16 +3477,15 @@ msgstr ""
 #: src/main.c:254
 msgid ""
 "Use the default option for new config files if one\n"
-"                         is available, don't prompt. If no default can be "
-"found,\n"
-"                         you will be prompted unless one of the confold or\n"
-"                         confnew options is also given"
-msgstr ""
-"Choisir l'option par défaut pour les nouveaux fichiers de\n"
-"     si elle existe, ne pas demander. S'il n'existe pas\n"
-"     d'option par défaut, la question sera posée à moins\n"
-"     que l'une des options « confold » ou « confnew » ne soit\\      "
-"utilisée."
+"is available, don't prompt. If no default can be found,\n"
+"you will be prompted unless one of the confold or\n"
+"confnew options is also given"
+msgstr ""
+"Choisir l'option par défaut pour les nouveaux fichiers\n"
+"de si elle existe, ne pas demander. S'il n'existe pas\n"
+"d'option par défaut, la question sera posée à moins\n"
+"que l'une des options « confold » ou « confnew » ne\n"
+"soit utilisée."
 
 #: src/main.c:259
 msgid "Always install missing config files"

+ 9 - 12
po/it.po

@@ -3437,18 +3437,15 @@ msgstr "Usa sempre i vecchi file di configurazione, non chiede nulla"
 #: src/main.c:254
 msgid ""
 "Use the default option for new config files if one\n"
-"                         is available, don't prompt. If no default can be "
-"found,\n"
-"                         you will be prompted unless one of the confold or\n"
-"                         confnew options is also given"
-msgstr ""
-"Usa l'opzione predefinita per i nuovi file di configurazione se ne è\n"
-"                         disponibile una, senza chiedere nulla. Se non può\n"
-"                         essere trovato alcun valore predefinito, viene "
-"chiesto\n"
-"                         a meno che non sia usata una delle opzioni confold "
-"o\n"
-"                         confnew."
+"is available, don't prompt. If no default can be found,\n"
+"you will be prompted unless one of the confold or\n"
+"confnew options is also given"
+msgstr ""
+"Usa l'opzione predefinita per i nuovi file di\n"
+"configurazione se ne è disponibile una, senza chiedere\n"
+"nulla. Se non può essere trovato alcun valore\n"
+"predefinito, viene chiesto a meno che non sia usata\n"
+"una delle opzioni confold o confnew."
 
 #: src/main.c:259
 msgid "Always install missing config files"

+ 6 - 9
po/ja.po

@@ -3319,17 +3319,14 @@ msgstr "常に古い設定ファイルを使用し、問い合わせない"
 #: src/main.c:254
 msgid ""
 "Use the default option for new config files if one\n"
-"                         is available, don't prompt. If no default can be "
-"found,\n"
-"                         you will be prompted unless one of the confold or\n"
-"                         confnew options is also given"
+"is available, don't prompt. If no default can be found,\n"
+"you will be prompted unless one of the confold or\n"
+"confnew options is also given"
 msgstr ""
 "新しい設定ファイルに、もし利用できるなら問い合わせせず\n"
-"                         にデフォルトオプションを使用する。デフォルトが見つか"
-"らな\n"
-"                         い場合は、confold または confnew オプションが与えら"
-"れ\n"
-"                         ていない限り、問い合わせが行われる"
+"にデフォルトオプションを使用する。デフォルトが見つから\n"
+"ない場合は、confold または confnew オプションが与えられ\n"
+"ていない限り、問い合わせが行われる"
 
 #: src/main.c:259
 msgid "Always install missing config files"

+ 6 - 7
po/pl.po

@@ -3358,15 +3358,14 @@ msgstr "Używanie starych plików konfiguracyjnych zawsze, bez pytania"
 #: src/main.c:254
 msgid ""
 "Use the default option for new config files if one\n"
-"                         is available, don't prompt. If no default can be "
-"found,\n"
-"                         you will be prompted unless one of the confold or\n"
-"                         confnew options is also given"
+"is available, don't prompt. If no default can be found,\n"
+"you will be prompted unless one of the confold or\n"
+"confnew options is also given"
 msgstr ""
 "Używanie domyślnej opcji dla nowych plików konfiguracyjnych, bez pytania,\n"
-"                         jeśli jest dostępna. Jeśli nie można znaleźć opcji\n"
-"                         domyślnej, pytanie użytkownika, chyba że podana\n"
-"                         zostania opcja confold albo confnew."
+"jeśli jest dostępna. Jeśli nie można znaleźć opcji\n"
+"domyślnej, pytanie użytkownika, chyba że podana\n"
+"zostania opcja confold albo confnew."
 
 #: src/main.c:259
 msgid "Always install missing config files"

+ 7 - 9
po/pt.po

@@ -3336,17 +3336,15 @@ msgstr "Utilizar sempre os ficheiros de configuração antigos, não perguntar"
 #: src/main.c:254
 msgid ""
 "Use the default option for new config files if one\n"
-"                         is available, don't prompt. If no default can be "
-"found,\n"
-"                         you will be prompted unless one of the confold or\n"
-"                         confnew options is also given"
+"is available, don't prompt. If no default can be found,\n"
+"you will be prompted unless one of the confold or\n"
+"confnew options is also given"
 msgstr ""
 "Utilizar a opção por omissão para novos ficheiros de\n"
-"                         configuração, se estiver disponível não "
-"questionar.\n"
-"                         Se não puder ser encontrado nenhum por omissão irá\n"
-"                         ser questionado a menos que também sejam indicadas\n"
-"                         as opções confold ou confnew"
+"configuração, se estiver disponível não questionar.\n"
+"Se não puder ser encontrado nenhum por omissão irá\n"
+"ser questionado a menos que também sejam indicadas\n"
+"as opções confold ou confnew"
 
 #: src/main.c:259
 msgid "Always install missing config files"

+ 6 - 7
po/ru.po

@@ -3365,15 +3365,14 @@ msgstr "Всегда использовать старые файлы настр
 #: src/main.c:254
 msgid ""
 "Use the default option for new config files if one\n"
-"                         is available, don't prompt. If no default can be "
-"found,\n"
-"                         you will be prompted unless one of the confold or\n"
-"                         confnew options is also given"
+"is available, don't prompt. If no default can be found,\n"
+"you will be prompted unless one of the confold or\n"
+"confnew options is also given"
 msgstr ""
 "Использовать для новых файлов настройки вариант\n"
-"                         по умолчанию, если он есть, ничего не\n"
-"                         спрашивая. Если он не найден, то выдаётся\n"
-"                         запрос, если только не заданы параметры confold и"
+"по умолчанию, если он есть, ничего не спрашивая.\n"
+"Если он не найден, то выдаётся запрос, если только\n"
+"не заданы параметры confold и"
 
 #: src/main.c:259
 msgid "Always install missing config files"

+ 6 - 9
po/sk.po

@@ -3324,17 +3324,14 @@ msgstr "Vždy používať staré konfiguračné súbory, nepýtať sa"
 #: src/main.c:254
 msgid ""
 "Use the default option for new config files if one\n"
-"                         is available, don't prompt. If no default can be "
-"found,\n"
-"                         you will be prompted unless one of the confold or\n"
-"                         confnew options is also given"
+"is available, don't prompt. If no default can be found,\n"
+"you will be prompted unless one of the confold or\n"
+"confnew options is also given"
 msgstr ""
 "Používať predvolenú voľbu pre nové konfiguračné súbory\n"
-"                         ak je dostupná, nepýtať sa. Ak nič nie je "
-"predvolené,\n"
-"                         budete vyzvaní ak ste zároveň nezadali jednu z "
-"volieb\n"
-"                         confold alebo confnew"
+"ak je dostupná, nepýtať sa. Ak nič nie je predvolené,\n"
+"budete vyzvaní ak ste zároveň nezadali jednu z volieb\n"
+"confold alebo confnew"
 
 #: src/main.c:259
 msgid "Always install missing config files"

+ 5 - 8
po/sv.po

@@ -3283,16 +3283,13 @@ msgstr "Använd alltid gamla konfigurationsfiler, fråga ej"
 #: src/main.c:254
 msgid ""
 "Use the default option for new config files if one\n"
-"                         is available, don't prompt. If no default can be "
-"found,\n"
-"                         you will be prompted unless one of the confold or\n"
-"                         confnew options is also given"
+"is available, don't prompt. If no default can be found,\n"
+"you will be prompted unless one of the confold or\n"
+"confnew options is also given"
 msgstr ""
 "Använd förval för nya konfigurationsfiler om sådant\n"
-"                         finns, fråga ej. Om inget förval finns tillfrågas "
-"du\n"
-"                         såvida inte flaggorna confold eller confnew\n"
-"                         också angivit"
+"finns, fråga ej. Om inget förval finns tillfrågas du\n"
+"såvida inte flaggorna confold eller confnew också angivit"
 
 #: src/main.c:259
 msgid "Always install missing config files"

+ 5 - 6
po/th.po

@@ -3218,14 +3218,13 @@ msgstr "ใช้แฟ้มค่าตั้งเดิมเสมอโด
 #: src/main.c:254
 msgid ""
 "Use the default option for new config files if one\n"
-"                         is available, don't prompt. If no default can be "
-"found,\n"
-"                         you will be prompted unless one of the confold or\n"
-"                         confnew options is also given"
+"is available, don't prompt. If no default can be found,\n"
+"you will be prompted unless one of the confold or\n"
+"confnew options is also given"
 msgstr ""
 "ใช้คำตอบปริยายสำหรับคำถามเกี่ยวกับแฟ้มค่าตั้งใหม่ถ้ามี\n"
-"                         โดยไม่ต้องถาม ถ้าไม่มีค่าปริยายกำหนดไว้ ก็จะถามคำถาม\n"
-"                         ยกเว้นมีการกำหนดตัวเลือก confold หรือ confnew ด้วย"
+"โดยไม่ต้องถาม ถ้าไม่มีค่าปริยายกำหนดไว้ ก็จะถามคำถาม\n"
+"ยกเว้นมีการกำหนดตัวเลือก confold หรือ confnew ด้วย"
 
 #: src/main.c:259
 msgid "Always install missing config files"

+ 8 - 11
po/vi.po

@@ -3355,17 +3355,14 @@ msgstr "Luôn dùng các tập tin cấu hình cũ, không cần hỏi"
 #: src/main.c:254
 msgid ""
 "Use the default option for new config files if one\n"
-"                         is available, don't prompt. If no default can be "
-"found,\n"
-"                         you will be prompted unless one of the confold or\n"
-"                         confnew options is also given"
-msgstr ""
-"Dùng tùy chọn mặc định cho các tập tin cấu hình mới nếu có một\n"
-"                         cái sẵn để dùng, đừng hỏi lại. Nếu không tìm thấy "
-"cái\n"
-"                         nào, bạn sẽ được nhắc trừ phi có một tùy chọn cấu "
-"hình cũ\n"
-"                         hoặc mới cũng đồng thời được đưa ra"
+"is available, don't prompt. If no default can be found,\n"
+"you will be prompted unless one of the confold or\n"
+"confnew options is also given"
+msgstr ""
+"Dùng tùy chọn mặc định cho các tập tin cấu hình mới nếu\n"
+"có một cái sẵn để dùng, đừng hỏi lại. Nếu không tìm\n"
+"thấy cái nào, bạn sẽ được nhắc trừ phi có một tùy chọn\n"
+"cấu hình cũ hoặc mới cũng đồng thời được đưa ra"
 
 #: src/main.c:259
 msgid "Always install missing config files"

+ 5 - 7
po/zh_TW.po

@@ -3205,14 +3205,12 @@ msgstr "永遠採用舊的設定檔,不另行詢問"
 #: src/main.c:254
 msgid ""
 "Use the default option for new config files if one\n"
-"                         is available, don't prompt. If no default can be "
-"found,\n"
-"                         you will be prompted unless one of the confold or\n"
-"                         confnew options is also given"
+"is available, don't prompt. If no default can be found,\n"
+"you will be prompted unless one of the confold or\n"
+"confnew options is also given"
 msgstr ""
-"                         若有新設定檔,則用預設選項,不再詢問。若沒有預設選"
-"項,\n"
-"                         除非有設定 confold  或 confnew 選項,否則會詢問你"
+"若有新設定檔,則用預設選項,不再詢問。若沒有預設選項,\n"
+"除非有設定 confold 或 confnew 選項,否則會詢問你"
 
 #: src/main.c:259
 msgid "Always install missing config files"

+ 25 - 6
src/main.c

@@ -249,12 +249,11 @@ static const struct forceinfo {
     '!', N_("Always use the new config files, don't prompt") },
   { "confold",             &fc_conff_old,
     '!', N_("Always use the old config files, don't prompt") },
-  /* XXX: Handle automatically line wrappings. */
   { "confdef",             &fc_conff_def,
     '!', N_("Use the default option for new config files if one\n"
-"                         is available, don't prompt. If no default can be found,\n"
-"                         you will be prompted unless one of the confold or\n"
-"                         confnew options is also given") },
+            "is available, don't prompt. If no default can be found,\n"
+            "you will be prompted unless one of the confold or\n"
+            "confnew options is also given") },
   { "confmiss",            &fc_conff_miss,
     '!', N_("Always install missing config files") },
   { "confask",             &fc_conff_ask,
@@ -555,6 +554,27 @@ arch_remove(const char *const *argv)
   return 0;
 }
 
+static inline void
+print_forceinfo_line(int type, const char *name, const char *desc)
+{
+  printf("  %s %-18s %s\n", forcetype_str(type), name, desc);
+}
+
+static void
+print_forceinfo(const struct forceinfo *fi)
+{
+  char *desc, *line;
+
+  desc = m_strdup(gettext(fi->desc));
+
+  line = strtok(desc, "\n");
+  print_forceinfo_line(fi->type, fi->name, desc);
+  while ((line = strtok(NULL, "\n")))
+    print_forceinfo_line(' ', "", line);
+
+  free(desc);
+}
+
 static void setforce(const struct cmdinfo *cip, const char *value) {
   const char *comma;
   size_t l;
@@ -568,8 +588,7 @@ static void setforce(const struct cmdinfo *cip, const char *value) {
 " Forcing things:\n"), DPKG);
 
     for (fip = forceinfos; fip->name; fip++)
-      printf("  %s %-18s %s\n", forcetype_str(fip->type), fip->name,
-             gettext(fip->desc));
+      print_forceinfo(fip);
 
     printf(_(
 "\n"