]> gitweb.hhaalo.de Git - scantopdf.git/commitdiff
change error logging
authorBastian Dehn <hhaalo@arcor.de>
Thu, 3 Apr 2025 18:06:51 +0000 (20:06 +0200)
committerBastian Dehn <hhaalo@arcor.de>
Thu, 3 Apr 2025 18:06:51 +0000 (20:06 +0200)
scantopdf
scantopdfbw
scantopdfgray

index 1e9e0eecc2cf6f4ad19d40d4880372c2016b3e1f..3fefa0684b104675ecfad32735e71f96713a5ab8 100755 (executable)
--- a/scantopdf
+++ b/scantopdf
@@ -1,7 +1,5 @@
 #!/bin/bash
 
-@errlog.sh@
-
 @scanbasic.sh@
 
 main()
@@ -10,15 +8,11 @@ main()
        local output=$2
        local basename=$3
 
-       if [ -z "$pagecount" ]; then
-               errlog "no page count"
-               return 1
-       fi
-
-       if [ -z "$output" ]; then
-               errlog "no pdf file name"
-               return 1
-       fi
+       command -v scanimage > /dev/null \
+               || errlog "command scanimage not found" \
+               || return $?
+       [ -n "$pagecount" ] || errlog "no page count" || return $?
+       [ -n "$output" ] || errlog "no pdf file name" || return $?
 
        scanimage --source=DocumentFeeder \
                --mode=Color \
@@ -30,14 +24,16 @@ main()
                --batch-increment=1 \
                --batch=scanned%03d.tiff \
                || errlog "scan error" \
-               || return 1
+               || return $?
 
        if [ "$output" == "multi" ]; then
-               createmultipdfs $pagecount $basename || return 1
-               exit 0
+               createmultipdfs $pagecount $basename || return $?
+               return
        fi
 
-       createonepdf $output || return 1
+       createonepdf $output || return $?
 }
 
+echo "⭐ START: scantopdf"
 main $*
+echo "✅ SUCCESS: scantopdf
index 570508e5d095d6590c78efadd0851ed79ca0219a..d682ecec400e3abd7f564074b7498cbfaf52e69e 100755 (executable)
@@ -1,7 +1,5 @@
 #!/bin/bash
 
-@errlog.sh@
-
 @scanbasic.sh@
 
 main()
@@ -10,15 +8,11 @@ main()
        local output=$2
        local basename=$3
 
-       if [ -z "$pagecount" ]; then
-               errlog "no page count"
-               return 1
-       fi
-
-       if [ -z "$output" ]; then
-               errlog "no pdf file name"
-               return 1
-       fi
+       command -v scanimage > /dev/null \
+               || errlog "command scanimage not found" \
+               || return $?
+       [ -n "$pagecount" ] || errlog "no page count" || return $?
+       [ -n "$output" ] || errlog "no pdf file name" || return $?
 
        scanimage --source=DocumentFeeder \
                --mode=BW \
@@ -30,14 +24,16 @@ main()
                --batch-increment=1 \
                --batch=scanned%03d.tiff \
                || errlog "scan error" \
-               || return 1
+               || return $?
 
        if [ "$output" == "multi" ]; then
                createmultipdfs $pagecount $basename || return 1
                return
        fi
 
-       createonepdf $output || return 1
+       createonepdf $output || return $?
 }
 
+echo "⭐ START: scantopdfbw"
 main $*
+echo "✅ SUCCESS: scantopdfbw
index 5b6a6adeaa3b526c74d973fda61798a99ad8ea7e..da7749afe88d4a0b4b72f2597340d331a5c611e1 100755 (executable)
@@ -1,7 +1,5 @@
 #!/bin/bash
 
-@errlog.sh@
-
 @scanbasic.sh@
 
 main()
@@ -10,15 +8,11 @@ main()
        local output=$2
        local basename=$3
 
-       if [ -z "$pagecount" ]; then
-               errlog "no page count"
-               return 1
-       fi
-
-       if [ -z "$output" ]; then
-               errlog "no pdf file name"
-               return 1
-       fi
+       command -v scanimage > /dev/null \
+               || errlog "command scanimage not found" \
+               || return $?
+       [ -n "$pagecount" ] || errlog "no page count" || return $?
+       [ -n "$output" ] || errlog "no pdf file name" || return $?
 
        scanimage --source=DocumentFeeder \
                --mode=Gray \
@@ -30,14 +24,16 @@ main()
                --batch-increment=1 \
                --batch=scanned%03d.tiff \
                || errlog "scan error" \
-               || return 1
+               || return $?
 
        if [ "$output" == "multi" ]; then
                createmultipdfs $pagecount $basename || return 1
                return
        fi
 
-       createonepdf $output || return 1
+       createonepdf $output || return $?
 }
 
+echo "⭐ START: scantopdfgray"
 main $*
+echo "✅ SUCCESS: scantopdfgray