Module Name: src Committed By: christos Date: Fri Jun 4 18:42:55 UTC 2010
Modified Files: src/etc: rc rc.subr Log Message: print human readable exit code. To generate a diff of this commit: cvs rdiff -u -r1.164 -r1.165 src/etc/rc cvs rdiff -u -r1.81 -r1.82 src/etc/rc.subr Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/etc/rc diff -u src/etc/rc:1.164 src/etc/rc:1.165 --- src/etc/rc:1.164 Fri Sep 11 14:17:04 2009 +++ src/etc/rc Fri Jun 4 14:42:54 2010 @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: rc,v 1.164 2009/09/11 18:17:04 apb Exp $ +# $NetBSD: rc,v 1.165 2010/06/04 18:42:54 christos Exp $ # # rc -- # Run the scripts in /etc/rc.d with rcorder, and log output @@ -270,7 +270,7 @@ # If the command failed, report it, and add it to a list. if [ "$2" != 0 ]; then rc_failures="${rc_failures}${rc_failures:+ }$1" - msg="$1 reported failure status $2" + msg="$1 $(human_exit_code $2)" rc_log_message "$msg" if ! $rc_silent; then printf "%s\n" "$msg" Index: src/etc/rc.subr diff -u src/etc/rc.subr:1.81 src/etc/rc.subr:1.82 --- src/etc/rc.subr:1.81 Mon Mar 15 14:59:47 2010 +++ src/etc/rc.subr Fri Jun 4 14:42:54 2010 @@ -1,4 +1,4 @@ -# $NetBSD: rc.subr,v 1.81 2010/03/15 18:59:47 jmmv Exp $ +# $NetBSD: rc.subr,v 1.82 2010/06/04 18:42:54 christos Exp $ # # Copyright (c) 1997-2004 The NetBSD Foundation, Inc. # All rights reserved. @@ -1175,4 +1175,22 @@ _twiddle_state="$_next" } +# +# human_exit_code +# Print the a human version of the exit code. +# +human_exit_code() +{ + if [ $1 -lt 127 ] + then + echo "exited with code $1" + elif [ $1 -eq 127 ] + then + echo "stopped with signal $(expr $1 / 256)" + else + echo "terminated with signal $(expr $1 - 128)" + fi +} + + _rc_subr_loaded=: