- fixed issue# 7 where long flags declared with '=' didn't work
- flag and non-flag arguments can now be mixed on the command-line
- removed setting and unsetting of '-u' to check for unset variables
- obsoleted FLAGS_ARGC and replaced with FLAGS_ARGV
diff --git a/source/1.0/examples/debug_output.sh b/source/1.0/examples/debug_output.sh
index ed552ef..d54635f 100755
--- a/source/1.0/examples/debug_output.sh
+++ b/source/1.0/examples/debug_output.sh
@@ -10,17 +10,54 @@
 #
 # This script demonstrates the use of a boolean flag to enable custom
 # functionality in a script.
+#
+# Try running these:
+# $ ./debug_output.sh speak
+# $ ./debug_output.sh sing
+# $ ./debug_output.sh --debug sing
 
 # source shflags
 . ../src/shflags
 
-debug() { [ ${FLAGS_debug} -eq ${FLAGS_TRUE} ] && echo "DEBUG: $@" >&2; }
-
 # define flags
 DEFINE_boolean 'debug' false 'enable debug mode' 'd'
+FLAGS_HELP=`cat <<EOF
+commands:
+  speak:  say something
+  sing:   sing something
+EOF`
+
+
+debug()
+{
+  [ ${FLAGS_debug} -eq ${FLAGS_TRUE} ] || return
+  echo "DEBUG: $@" >&2
+}
+
+die() {
+  [ $# -gt 0 ] && echo "error: $@" >&2
+  flags_help
+  exit 1
+}
+
 
 # parse the command-line
-FLAGS "$@" || exit 1; shift ${FLAGS_ARGC}
+FLAGS "$@" || exit 1
+eval set -- "${FLAGS_ARGV}"
 
-debug 'debug mode enabled'
-echo 'something interesting'
+command=$1
+case ${command} in
+  '') die ;;
+
+  speak)
+    debug "I'm getting ready to say something..."
+    echo 'The answer to the question "What is the meaning of life?" is "42".'
+    ;;
+
+  sing)
+    debug "I'm getting ready to sing something..."
+    echo 'I love to sing! La diddy da dum!'
+    ;;
+
+  *) die "unrecognized command (${command})" ;;
+esac
diff --git a/source/1.0/examples/hello_world.sh b/source/1.0/examples/hello_world.sh
index d04a797..6fb2cb0 100755
--- a/source/1.0/examples/hello_world.sh
+++ b/source/1.0/examples/hello_world.sh
@@ -19,6 +19,7 @@
 DEFINE_string 'name' 'world' 'name to say hello to' 'n'
 
 # parse the command-line
-FLAGS "$@" || exit 1; shift ${FLAGS_ARGC}
+FLAGS "$@" || exit 1
+eval set -- "${FLAGS_ARGV}"
 
 echo "Hello, ${FLAGS_name}!"
diff --git a/source/1.0/examples/write_date.sh b/source/1.0/examples/write_date.sh
index 0d9ccd0..85695cf 100755
--- a/source/1.0/examples/write_date.sh
+++ b/source/1.0/examples/write_date.sh
@@ -14,34 +14,46 @@
 # - direct calling of the flags_help() function for script controlled usage
 #   output
 # - handling of non-flag type command-line arguments that follow the flags
+#
+# Try the following:
+# $ ./write_date.sh now.out
+# $ cat now.out
+#
+# $ ./write_date.sh now.out
+# $ cat now.out
+#
+# $ ./write_date.sh -f now.out
+# $ cat now.out
 
 # source shflags
 . ../src/shflags
 
-write_date() { date >"$1"; }
-
 # configure shflags
 DEFINE_boolean 'force' false 'force overwriting' 'f'
 FLAGS_HELP="USAGE: $0 [flags] filename"
 
-# parse the command-line
-FLAGS "$@" || exit 1; shift ${FLAGS_ARGC}
 
-# check for filename
-if [ $# -eq 0 ]; then
-  echo 'error: filename missing' >&2
+write_date()
+{
+  date >"$1"
+}
+
+die()
+{
+  [ $# -gt 0 ] && echo "error: $@" >&2
   flags_help
   exit 1
-fi
+}
+
+
+# parse the command-line
+FLAGS "$@" || exit 1
+eval set -- "${FLAGS_ARGV}"
+
+# check for filename
+[ $# -gt 0 ] || die 'filename missing'
 filename=$1
 
-if [ ! -f "${filename}" ]; then
-  write_date "${filename}"
-else
-  if [ ${FLAGS_force} -eq ${FLAGS_TRUE} ]; then
-    write_date "${filename}"
-  else
-    echo 'warning: filename exists; not overwriting' >&2
-    exit 2
-  fi
-fi
+[ -f "${filename}" -a ${FLAGS_force} -eq ${FLAGS_FALSE} ] \
+    && die 'filename exists; not overwriting'
+write_date "${filename}"