Bladeren bron

Use thisname variable instead of hard-coded 'dpkg' string

This corrects the current program name printed by other tools.
Guillem Jover 15 jaren geleden
bovenliggende
commit
fd84ba8969
4 gewijzigde bestanden met toevoegingen van 9 en 6 verwijderingen
  1. 2 1
      lib/dpkg/ehandle.c
  2. 5 3
      src/errors.c
  3. 1 1
      src/querycmd.c
  4. 1 1
      src/trigproc.c

+ 2 - 1
lib/dpkg/ehandle.c

@@ -163,7 +163,8 @@ run_cleanups(struct error_context *econ, int flagsetin)
      
   if (++preventrecurse > 3) {
     onerr_abort++;
-    fprintf(stderr, _("dpkg: too many nested errors during error recovery !!\n"));
+    fprintf(stderr, _("%s: too many nested errors during error recovery!!\n"),
+            thisname);
     flagset= 0;
   } else {
     flagset= flagsetin;

+ 5 - 3
src/errors.c

@@ -58,13 +58,15 @@ void print_error_perpackage(const char *emsg, const char *arg) {
   struct error_report *nr;
   
   fprintf(stderr, _("%s: error processing %s (--%s):\n %s\n"),
-          DPKG, arg, cipaction->olong, emsg);
+          thisname, arg, cipaction->olong, emsg);
 
   statusfd_send("status: %s : %s : %s", arg, "error", emsg);
 
   nr= malloc(sizeof(struct error_report));
   if (!nr) {
-    perror(_("dpkg: failed to allocate memory for new entry in list of failed packages."));
+    fprintf(stderr,
+            _("%s: failed to allocate memory for new entry in list of failed packages: %s"),
+            thisname, strerror(errno));
     abort_processing = true;
     nr= &emergency;
   }
@@ -74,7 +76,7 @@ void print_error_perpackage(const char *emsg, const char *arg) {
   lastreport= &nr->next;
     
   if (nerrs++ < errabort) return;
-  fprintf(stderr, _("dpkg: too many errors, stopping\n"));
+  fprintf(stderr, _("%s: too many errors, stopping\n"), thisname);
   abort_processing = true;
 }
 

+ 1 - 1
src/querycmd.c

@@ -289,7 +289,7 @@ searchfiles(const char *const *argv)
       iterfileend(it);
     }
     if (!found) {
-      fprintf(stderr,_("dpkg: %s not found.\n"),thisarg);
+      fprintf(stderr, _("%s: %s not found.\n"), thisname, thisarg);
       failures++;
       m_output(stderr, _("<standard error>"));
     } else {

+ 1 - 1
src/trigproc.c

@@ -245,7 +245,7 @@ check_trigger_cycle(struct pkginfo *processing_now)
 	/* Oh dear. hare is a superset of tortoise. We are making no progress. */
 	fprintf(stderr, _("%s: cycle found while processing triggers:\n chain of"
 	        " packages whose triggers are or may be responsible:\n"),
-	        DPKG);
+	        thisname);
 	sep = "  ";
 	for (tcn = tortoise; tcn; tcn = tcn->next) {
 		fprintf(stderr, "%s%s", sep, tcn->then_processed->name);