Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
rc-script: eend ??
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index French
View previous topic :: View next topic  
Author Message
lowlow
n00b
n00b


Joined: 30 Oct 2002
Posts: 5
Location: /dev/null

PostPosted: Mon Dec 09, 2002 6:27 pm    Post subject: rc-script: eend ?? Reply with quote

Salut à tous

Dans les rc-script on touve souvent la fonction eend, j'ai compris qu'elle permet de terminer un rc-script et de retourner un signal d'erreur s'il y a lieu.

Par contre je comprends pas comment fonctionnent les flags de eend, du genre:

eend 0

eend 1

etc

Alors si qlq'un peut élcairer ma petite lanterne, c'est avec plaisir.

Cordialement lowlow
Back to top
View user's profile Send private message
SuperTomate
Guru
Guru


Joined: 02 Jun 2002
Posts: 392
Location: France

PostPosted: Mon Dec 09, 2002 8:55 pm    Post subject: Re: rc-script: eend ?? Reply with quote

lowlow wrote:
Dans les rc-script on touve souvent la fonction eend, j'ai compris qu'elle permet de terminer un rc-script et de retourner un signal d'erreur s'il y a lieu.


En fait, eend, c'est juste pour afficher un message d'erreur si une commande du script a échoué.
Si le premier paramètre passé à eend est 0, cela indique que l'exécution s'est bien passée, sinon, s'il est différent de 0, un message d'erreur est affiché.
Le deuxième paramètre contient le message d'erreur à afficher le cas échéant.

Code de eend dans /sbin/functions.sh :
Code:
# void eend(int error, char *errstr)
#
eend() {
        if [ "$#" -eq 0 ] || ([ -n "$1" ] && [ "$1" -eq 0 ])
        then
                if [ "${QUIET_STDOUT}" != "yes" ]
                then
                        echo -e "${ENDCOL}  \e[34;01m[ ${GOOD}ok \e[34;01m]${NORMAL}"
                fi
        else
                local returnme="$1"
                if [ "$#" -ge 2 ]
                then
                        shift
                        eerror "${*}"
                fi
                if [ "${QUIET_STDOUT}" != "yes" ]
                then
                        echo -e "${ENDCOL}  \e[34;01m[ ${BAD}!! \e[34;01m]${NORMAL}"
                        #extra spacing makes it easier to read
                        echo
                fi
                return ${returnme}
        fi
}
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index French All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum