+# Options:
+# -v ... verbose output
+#
+# Example:
+# $ cd $FG_ROOT/Aircraft/bo105
+# $ fg-submit # -> bo105.diff.bz2 or bo105.tar.bz2
+#
+# $ fg-submit update # -> update.diff.bz2 or update.tar.bz2
+#
+#
+# Spaces in the basename are replaced with "%20". People who prefer
+# to have the date in the archive name can conveniently achieve this
+# by defining a shell alias in ~/.bashrc:
+#
+# alias submit='fg-submit "${PWD##*/}-$(date +%Y-%m-%d)"'
+#
+#
+#
+# If the script finds an application named "fg-upload", then it calls
+# this at the end with two arguments:
+#
+# $1 ... archive or compressed diff for submission
+# $2 ... accessory uncompressed diff, *NOT* for submission!
+#
+# $1 and $2 are guaranteed not to contain spaces, only $1 is guaranteed
+# to actually exist. Such a script can be used to upload the file to an
+# ftp-/webserver, and/or to remove one or both files. Example using
+# KDE's kfmclient for upload (alternatives: ncftpput, gnomevfs-copy):
+#
+# $ cat ~/bin/fg-upload
+# #!/bin/bash
+# echo "uploading $1"
+# if kfmclient copy $1 ftp://user:password@server.com; then
+# echo "deleting $1 $2"
+# rm -f $1 $2
+#
+# URL=ftp://server.com/$1
+#
+# # copy URL to KDE's clipboard, so that MMB-clicking pastes it
+# dcop klipper klipper setClipboardContents $URL
+#
+# echo "Done. --> $URL"
+# else
+# echo "$0: uploading failed!"
+# fi
+#
+#
+#
+# Whether a file should be included in the archive or not, is decided
+# by pattern rules. There is a set of reasonable default rules predefined,
+# but alternative settings can be defined in a hidden configuration file
+# named ".fg-submit". Such a file is searched in the current directory,
+# in its parent directory, in its grand-parent directory and so on,
+# and finally in the $HOME directory. The first found file is taken.
+#
+# A file can use a list of three keywords with arguments, each on a
+# separate line:
+#
+# ALLOW <pattern-list> ... accept & report matching file
+# DENY <pattern-list> ... reject & report matching file
+# IGNORE <pattern-list> ... silently reject matching file
+#
+# A <pattern-list> is a space-separated list of shell pattern.
+# It may also be empty, in which case it has no effect. Examples:
+#
+# DENY test.blend
+# ALLOW *.xcf *.blend
+#
+# The list of pattern is checked in the same order in which it was
+# built. The first match causes a file to be accepted or rejected.
+# Further matches are not considered. Comments using the hash
+# character '#' are allowed and ignored.
+#
+# Some default rules are always added at the end. If you want to
+# bypass them, then finish your configuration with an "ALLOW *"
+# or "DENY *", and no file will ever reach the default rules.
+#
+#
+# Example:
+#
+# DENY test.xcf # throw out the test image, but ...
+# ALLOW *.xcf # ... allow all other GIMP images (the default
+# # rules would otherwise throw them out)
+#
+# ALLOW not.old # add this file, but ...
+# IGNORE *.old # throw out all other "old" files (and don't
+# # report that to the terminal)
+#
+#
+# .fg-submit configuration files are "sourced" bash scripts, the
+# keywords are simple shell functions. That means that you can
+# also use other bash commands in that file, such as "echo", or
+# write several commands on one line, separated with semicolon.
+# You can even put all special rules in your ~/.fg-submit file,
+# with rules depending on the working directory:
+#
+# case "$PWD" in
+# */bo105*) DENY *.osg; ALLOW livery.xcf ;;
+# */ufo*) DENY *.tiff ;;
+# esac
+
+
+
+SELF=${0##*/}
+DIR=${PWD##*/}
+
+if [ "$1" == "-v" ]; then
+ DBG=1
+ shift
+fi
+
+BASE=${1:-$DIR}
+BASE=${BASE// /%20}