[tex-k] newer

Reinhard Kotucha reinhard.kotucha at web.de
Tue Nov 29 01:32:39 CET 2005


Hi,
because newer(1) sets

  int verbose = 1;

it complains when a target file is missing (which is quite normal,
usually).  This is a bit confusing, Lars Madsen reported that metapost
sais:

This is MetaPost, Version 0.901 (Web2C 7.5.5)
(test.mpnewer: target file `test.mpx' doesn't exist.
  [1] )
1 output file written: test.1
Transcript written on test.log.

This is indeed quite confusing.

The following patch fixes this problem.  Now it behaves like this:

* If no option is given, only missing input files are reported.  In
  most cases a missing input file is a bug and should be reported.
  Missing target files are ignored.

* The --verbose option also reports missing target files.  This option
  is useful to provide some diagnostic information to people debugging
  their own scripts.  It should only be used for debugging.

* The --quiet option seems to be useless since a missing input file
  always seems to be a bug.  But it might be useful in certain
  situations:

    if newer foo.tex bar.sty bar.cfg foo.dvi; then ...

  If bar.sty contains \InputIfFileExists{bar.cfg}... then a missing
  input file is not a bug and the --quiet option makes sense.


However, in most cases no option is required.

--verbose is ignored if --quiet is set.  It could be done vice versa,
but why does anybody want to set them both?

_________________________________________________________________

--- newer.c.orig        Wed Jun 22 01:11:25 2005
+++ newer.c     Mon Nov 28 23:55:15 2005
@@ -32,7 +32,8 @@
 #endif
 
 int i;
-int verbose = 1;
+int verbose = 0;
+int quiet = 0;
 int missing_source = 0;
 int missing_target = 0;
 int result = exit_false;
@@ -63,7 +64,7 @@
                    strcmp(argv[1], "-quiet") == 0 ||
                    strcmp(argv[1], "--quiet") == 0) {
 
-            verbose = 0;
+            quiet = 1;
             argv++;
             argc--;
 
@@ -75,10 +76,10 @@
   one of them is not older than `target'.\n\
   Also exit successfully if `target' doesn't exist.\n\
 \n\
---help      display this help and exit\n\
---quiet     do not print anything\n\
---verbose   list missing input files (default)\n\
---version   output version information and exit\n\n", stdout);
+--help      Display this help and exit\n\
+--quiet     Do not print anything\n\
+--verbose   List missing files, incuding missing target files\n\
+--version   Output version information and exit\n\n", stdout);
             fputs ("Email bug reports to metapost at tug.org.\n", stdout);
             exit(0);
 
@@ -108,7 +109,7 @@
     
     /* check the target file */
     if (stat(argv[argc-1], &target_stat) < 0) {
-        if (verbose) {
+        if (verbose && !quiet) {
             fprintf(stderr, "newer: target file `%s' doesn't exist.\n",
                     argv[argc-1]);
         }
@@ -118,7 +119,7 @@
     /* check the source files */
     for (i = 1; i < (argc-1); i++) {
         if (stat(argv[i], &source_stat) < 0) {
-           if (verbose) {
+           if (!quiet) {
                 fprintf (stderr, "newer: source file `%s' doesn't exist.\n", 
                          argv[i]);
             }
_________________________________________________________________

...and the manpage...

_________________________________________________________________

--- newer.1.orig        Mon Sep 12 21:23:35 2005
+++ newer.1     Mon Nov 28 23:56:15 2005
@@ -38,4 +38,4 @@
 .TP
 .B --verbose, -v
 .rb
-List missing source files.  This is the default.
+List missing files, including missing target files.

_________________________________________________________________

Regards,
  Reinhard

-- 
----------------------------------------------------------------------------
Reinhard Kotucha			              Phone: +49-511-4592165
Marschnerstr. 25
D-30167 Hannover	                      mailto:reinhard.kotucha at web.de
----------------------------------------------------------------------------
Microsoft isn't the answer. Microsoft is the question, and the answer is NO.
----------------------------------------------------------------------------




More information about the tex-k mailing list