Browse Source

Checked all exit calls use exit flags, changed some -z, etc to my isEmpty or isNotEmpy functions

master
Gustavo Neves 8 years ago
parent
commit
442579b87f
1 changed files with 4 additions and 4 deletions
  1. +4
    -4
      pdfScale.sh

+ 4
- 4
pdfScale.sh View File

@@ -272,7 +272,7 @@ pageResize() {

# Parse a forced mode of operation
parseMode() {
if [[ -z $1 ]]; then
if isEmpty "$1"; then
printError "Mode is empty, please specify the desired mode"
printError "Falling back to adaptive mode!"
ADAPTIVEMODE=$TRUE
@@ -952,7 +952,7 @@ Examples:
# Prints usage info
usage() {
[[ "$2" != 'nobanner' ]] && printVersion 2
[[ ! -z "$1" ]] && printError "$1"
isNotEmpty "$1" && printError "$1"
printError "Usage: $PDFSCALE_NAME [-v] [-s <factor>] [-m <mode>] <inFile.pdf> [outfile.pdf]"
printError "Try: $PDFSCALE_NAME -h # for help"
}
@@ -960,7 +960,7 @@ usage() {

# Prints Verbose information
vprint() {
[[ $VERBOSE -eq 0 ]] && return 0
[[ $VERBOSE -eq 0 ]] && return $TRUE
timestamp=""
[[ $VERBOSE -gt 1 ]] && timestamp="$(date +%Y-%m-%d:%H:%M:%S) | "
echo "$timestamp$1"
@@ -985,7 +985,7 @@ printDependency() {
initError() {
local errStr="$1"
local exitStat=$2
[[ -z "$exitStat" ]] && exitStat=$EXIT_ERROR
isEmpty "$exitStat" && exitStat=$EXIT_ERROR
usage "ERROR! $errStr" "$3"
exit $exitStat
}


Loading…
Cancel
Save