about summary refs log tree commit diff
path: root/converter/other
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2016-04-24 22:54:44 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2016-04-24 22:54:44 +0000
commitffa0d9869fe04de4649c4101f2117473ad91fcdf (patch)
tree53aacebe4475320acafb3bd76e40006525a5ab5f /converter/other
parent2ec45a90b13b406f4028963b7985f3070550e7cf (diff)
downloadnetpbm-mirror-ffa0d9869fe04de4649c4101f2117473ad91fcdf.tar.gz
netpbm-mirror-ffa0d9869fe04de4649c4101f2117473ad91fcdf.tar.xz
netpbm-mirror-ffa0d9869fe04de4649c4101f2117473ad91fcdf.zip
Add -version, change temporary file handling
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@2717 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'converter/other')
-rwxr-xr-xconverter/other/anytopnm14
-rw-r--r--converter/other/fiasco/params.c13
2 files changed, 20 insertions, 7 deletions
diff --git a/converter/other/anytopnm b/converter/other/anytopnm
index 397faae5..e5de85cc 100755
--- a/converter/other/anytopnm
+++ b/converter/other/anytopnm
@@ -527,14 +527,18 @@ if [ $# -gt 1 ] ; then
          "input file name." 1>&2
     exit 1
 elif [ $# -eq 1 ] ; then
-    inputFile="$1"
+    if [ $1 = "--version" -o $1 = "-version" ] ; then
+        pamtopnm --version ; exit $?
+    else 
+        inputFile="$1"
+    fi
 else
-    inputFile="-"
+        inputFile="-"
+
 fi
 
-tempdir="${TMPDIR-/tmp}/anytopnm.$$"
-mkdir -m 0700 $tempdir || \
-  { echo "Could not create temporary file. Exiting."; exit 1;}
+tempdir=$(mktemp -d "${TMPDIR:-/tmp}/anytopnm.XXXXXXXX") ||
+    ( echo "Could not create temporary file. Exiting." 1>&2; exit 1; ) 
 trap 'rm -rf $tempdir' 0
 
 # Take out all spaces
diff --git a/converter/other/fiasco/params.c b/converter/other/fiasco/params.c
index afacbada..fef004e8 100644
--- a/converter/other/fiasco/params.c
+++ b/converter/other/fiasco/params.c
@@ -325,8 +325,17 @@ parseargs (param_t *usr_params,
 		      NO, sys_path, usr_file_name);
 	    else if (streq (params [param_index].name, "version"))
 	    {
-	       fprintf (stderr, "%s " VERSION "\n", argv [0]);
-	       exit (2);
+           fprintf (stderr, "%s " VERSION "\n", argv [0]);
+           {
+              /* Kludge for standard Netpbm version announcement */
+              char * modified_argv[2];
+              int argc;
+              modified_argv[0] = argv[0];
+              modified_argv[1] = (char *) "--version";
+              argc = 2;
+              pm_proginit(&argc, (const char **) modified_argv);
+           }
+           exit (2);
 	    }
 	    else if (streq (params [param_index].name, "verbose"))
 	       fiasco_set_verbosity (