From 6901c5aeb7c3f065dae96bcdfd6e81e8eeff8667 Mon Sep 17 00:00:00 2001 From: Fred Drueck Date: Mon, 25 Nov 2024 16:50:35 -0600 Subject: [PATCH] add some "die" statements to texml so that if an XML output file cannot be generated from any input file the script will exit with a non-zero return code, as is expected of unix-like programs that fail to run successfully. Also: modify the usage note (what the -help option will cause to be printed) to document that the script will process all filenames based as agruments to the script --- bin/texml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/bin/texml b/bin/texml index b6a581f..a382fbd 100755 --- a/bin/texml +++ b/bin/texml @@ -114,7 +114,7 @@ our %OPT = (debug => 0, sub usage() { my $usage = << "EOF"; -Usage: $PROGRAM_NAME [options] filename +Usage: $PROGRAM_NAME [options] filename [additional_filenames] Options: -help Print this help text and quit. @@ -281,6 +281,7 @@ sub process_file( $ ) { if ($@) { print "Could not pretty-print file: $@\n"; + die; } } @@ -332,9 +333,9 @@ if ($OPT{debug}) { } while (my $tex_file = shift @ARGV) { - do { warn "Can't find $tex_file\n"; next; } unless -e $tex_file; + do { warn "Can't find $tex_file\n"; die; next; } unless -e $tex_file; - do { warn "Can't read $tex_file\n"; next; } unless -r $tex_file; + do { warn "Can't read $tex_file\n"; die; next; } unless -r $tex_file; process_file($tex_file);