From 04ffbbc51a6df18c95937b1b803449b5227aa438 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Mon, 14 Jul 2008 11:00:41 +0200 Subject: [PATCH] foamAllHC / foamEbrowse / foamNew - error checking --- bin/foamAllHC | 7 +++++-- bin/foamEbrowse | 6 +++--- bin/foamNew | 22 +++++++++++++--------- 3 files changed, 21 insertions(+), 14 deletions(-) diff --git a/bin/foamAllHC b/bin/foamAllHC index e57d43dd27..b42ab672d5 100755 --- a/bin/foamAllHC +++ b/bin/foamAllHC @@ -27,9 +27,12 @@ # foamAllHC # # Description -# +# #------------------------------------------------------------------------------ -find . -name "*.[HCL]" -exec $1 {} \; -print +if [ "$#" -gt 0 ] +then + find . -name "*.[HCL]" -exec $1 {} \; -print +fi #------------------------------------------------------------------------------ diff --git a/bin/foamEbrowse b/bin/foamEbrowse index 70fa6cf585..aea1cd16f6 100755 --- a/bin/foamEbrowse +++ b/bin/foamEbrowse @@ -41,12 +41,12 @@ if [ $# -ne 0 ]; then exit 1 fi +# Clean up on termination and on Ctrl-C +trap 'rm -f $headersFile $sourcesFile 2>/dev/null; exit 0' EXIT TERM INT + cd $WM_PROJECT_DIR find -H . -name "*.H" | fgrep -v "lnInclude" > $headersFile find -H . -name "*.C" | fgrep -v "lnInclude" > $sourcesFile ebrowse --files=$headersFile --files=$sourcesFile --output-file=.ebrowse -# Clean up on termination and on Ctrl-C -trap 'rm -f $headersFile $sourcesFile 2>/dev/null; exit 0' EXIT TERM INT - #------------------------------------------------------------------------------ diff --git a/bin/foamNew b/bin/foamNew index f0f202a984..3900c3c74c 100755 --- a/bin/foamNew +++ b/bin/foamNew @@ -46,19 +46,23 @@ USAGE exit 1 } -if [ "$#" -lt 1 ]; then +if [ "$#" -lt 2 ] +then usage "wrong number of arguments, expected 2 (or more)" fi case "$1" in - source) - shift - $WM_PROJECT_DIR/bin/foamTemplates/source/newSource $* - ;; - template) - shift - $WM_PROJECT_DIR/bin/foamTemplates/sourceTemplate/newSourceTemplate $* - ;; +-h | -help) + usage + ;; +source) + shift + $WM_PROJECT_DIR/bin/foamTemplates/source/newSource $* + ;; +template) + shift + $WM_PROJECT_DIR/bin/foamTemplates/sourceTemplate/newSourceTemplate $* + ;; *) usage "unknown type" ;;