Author: baby-guest
Date: 2007-08-02 10:15:53 +0000 (Thu, 02 Aug 2007)
New Revision: 3522

Modified:
   packages/trunk/fenix/debian/fenix.sh
Log:
Make a proper script for starting fenix programs



Modified: packages/trunk/fenix/debian/fenix.sh
===================================================================
--- packages/trunk/fenix/debian/fenix.sh        2007-08-02 09:15:34 UTC (rev 
3521)
+++ packages/trunk/fenix/debian/fenix.sh        2007-08-02 10:15:53 UTC (rev 
3522)
@@ -1,3 +1,72 @@
 #!/bin/sh
 
+# (c) 2007 Miriam Ruiz <[EMAIL PROTECTED]>
+# 
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
+
+ARG="$1"
+GAME_FILE=""
+
+if [ -z "$GAME_FILE" ] && [ -z "$ARG" ]; then
+       FILE_NUM=`ls *.prg 2>/dev/null | wc -l`
+       if [ "$FILE_NUM" -eq 1 ] ; then
+               GAME_FILE="ls *.prg 2>/dev/null"
+               echo "Game File: \"$GAME_FILE\"" >&2
+       else
+               GAME_FILE=""
+       fi
+fi
+
+if [ -z "$GAME_FILE" ] && [ -d "$ARG" ]; then
+       FILE_NUM=`ls "$ARG"/*.prg 2>/dev/null | wc -l`
+       if [ "$FILE_NUM" -eq 1 ] ; then
+               GAME_FILE="`ls "$ARG"/*.prg` 2>/dev/null"
+               echo "Game File: \"$GAME_FILE\"" >&2
+       else
+               GAME_FILE=""
+               echo "Cannot choose a game file in the directory \"$ARG\"" >&2
+               exit 1
+       fi
+fi
+
+if [ -e "$ARG" ]; then
+       FILE_NUM=`ls \"$ARG\" 2>/dev/null | wc -l`
+       if [ "$FILE_NUM" -eq 1 ] ; then
+               GAME_FILE=""
+               echo "Game File: \"$GAME_FILE\"" >&2
+       else
+               GAME_FILE="$ARG"
+               echo "Cannot choose a game file" >&2
+       fi
+fi
+
+if [ -z "$GAME_FILE" ] && [ ! -z "$ARG" ] && [ -z "$2" ]; then
+       echo "Game program does not exist in \"$ARG\"" >&2
+       exit 1
+fi
+
+if [ -z "$GAME_FILE" ] || [ ! -z "$2" ]; then
+       echo "Usage: $0" >&2
+       echo "Usage: $0 <file.prg>" >&2
+       echo "Usage: $0 <directory>" >&2
+       exit 1
+fi
+
+if [ -z "$GAME_FILE" ] || [ ! -e "$GAME_FILE" ]
+       echo "File \"$GAME_FILE\" does not exist" >&2
+       exit 1
+fi
+
 fenix-fxc "$@" -o - | fenix-fxi -


_______________________________________________
Pkg-games-commits mailing list
[email protected]
http://lists.alioth.debian.org/mailman/listinfo/pkg-games-commits

Reply via email to