| 1 | #!/bin/shscip-shell filesystem . . `/bin/sh`. |
| 2 | if [scip-shell system . . `[`. -z "$1" ] |
| 3 | then |
| 4 | echoscip-shell system . . echo. "usage: $0 [TOOL] <example> [args...]" |
| 5 | echoscip-shell system . . echo. |
| 6 | echoscip-shell system . . echo. " Runs the given example, using the library in the current directory" |
| 7 | echoscip-shell system . . echo. " instead of using the system library search mechanism. Accepts an " |
| 8 | echoscip-shell system . . echo. " arbitrary number of arguments." |
| 9 | echoscip-shell system . . echo. |
| 10 | echoscip-shell system . . echo. " TOOL can be 'valgrind', 'gdb', or 'ldd', which causes exrun to" |
| 11 | echoscip-shell system . . echo. " run the example program under the given tool." |
| 12 | echoscip-shell system . . echo. |
| 13 | exit 1 |
| 14 | fi |
| 15 | |
| 16 | TOOL= |
| 17 | PROG=$1 |
| 18 | if [scip-shell system . . `[`. "$PROG" = 'valgrind' ] |
| 19 | then |
| 20 | TOOL='valgrind' |
| 21 | shift |
| 22 | PROG=$1 |
| 23 | elif [scip-shell system . . `[`. "$PROG" = 'gdb' ] |
| 24 | then |
| 25 | TOOL='gdb --args' |
| 26 | shift |
| 27 | PROG=$1 |
| 28 | elif [scip-shell system . . `[`. "$PROG" = 'ldd' ] |
| 29 | then |
| 30 | TOOL='ldd' |
| 31 | shift |
| 32 | PROG=$1 |
| 33 | fi |
| 34 | |
| 35 | shift |
| 36 | if [scip-shell system . . `[`. -e "$PROG" ] |
| 37 | then |
| 38 | if [scip-shell system . . `[`. `unamescip-shell system . . uname. -s` = 'Darwin' ] |
| 39 | then |
| 40 | DYLD_LIBRARY_PATH=. $TOOL ./$PROG $* |
| 41 | elif [scip-shell system . . `[`. `unamescip-shell system . . uname. -o` = 'Cygwin' ] |
| 42 | then |
| 43 | # Cygwin build case; see below for bash-as-DOS-shell case |
| 44 | PATH=. $TOOL ./$PROG $* |
| 45 | elif [scip-shell system . . `[`. -e /usr/bin/lddscip-shell filesystem . . `/usr/bin/ldd`. ] |
| 46 | then |
| 47 | if [scip-shell system . . `[`. `unamescip-shell system . . uname. -s` = 'SunOS' ] |
| 48 | then |
| 49 | LD_LIBRARY_PATH=.:/usr/mysql/lib/mysql $TOOL ./$PROG $* |
| 50 | else |
| 51 | LD_LIBRARY_PATH=. $TOOL ./$PROG $* |
| 52 | fi |
| 53 | else |
| 54 | echoscip-shell system . . echo. "ERROR: I don't grok this system's dynamic linkage system." |
| 55 | fi |
| 56 | elif [scip-shell system . . `[`. `unamescip-shell system . . uname. -o` = 'Cygwin' ] |
| 57 | then |
| 58 | # VC++ build, but using Cygwin's bash as shell to run programs |
| 59 | cmd.exe /cscip-shell filesystem . . `/c`. exrun.bat $PROG $* |
| 60 | else |
| 61 | echoscip-shell system . . echo. "usage: $0 [TOOL] <example> [args...]" |
| 62 | echoscip-shell system . . echo. |
| 63 | echoscip-shell system . . echo. " Run $0 without arguments for more detailed usage info." |
| 64 | echoscip-shell system . . echo. |
| 65 | exit 1 |
| 66 | fi |