123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 |
- #!/bin/bash
-
-
- FFOO_EXITS_OK=0
- FFOO_EXITS_NO=1
- FFOO_EXITS_USAGE=2
- FFOO_EXITS_ERROR=3
- FFOO_EXITS_PANIC=4
-
-
- exit_ok() {
- #
- # Exit script with success
- #
- exit $FFOO_EXITS_OK
- }
-
-
- exit_no() {
- #
- # Exit script with answer "no"
- #
- exit $FFOO_EXITS_NO
- }
-
-
- exit_usage() {
- #
- # Exit script with usage error
- #
- exit $FFOO_EXITS_USAGE
- }
-
-
- exit_error() {
- #
- # Exit script with generic unexpected error
- #
- exit $FFOO_EXITS_ERROR
- }
-
-
- exit_panic() {
- #
- # Exit script in panic (e.g. assert failure, sure bug)
- #
- exit $FFOO_EXITS_PANIC
- }
-
-
- exits() {
- #
- # Like exit but will not exit interactive session
- #
- # fastfoo libs are not intended for use in interactive
- # session (one should use fff for that), but for development
- # and testing purposes we want to enable it
- #
- test -z "$PS1" && exit $1
- }
-
-
- exits_ok() {
- #
- # Exit script with success
- #
- exits $FFOO_EXITS_OK
- }
-
-
- exits_no() {
- #
- # Exit script with answer "no"
- #
- exits $FFOO_EXITS_NO
- }
-
-
- exits_usage() {
- #
- # Exit script with usage error
- #
- exits $FFOO_EXITS_USAGE
- }
-
-
- exits_error() {
- #
- # Exit script with generic unexpected error
- #
- exits $FFOO_EXITS_ERROR
- }
-
-
- exits_panic() {
- #
- # Exit script in panic (e.g. assert failure, sure bug)
- #
- exits $FFOO_EXITS_PANIC
- }
-
|