source: rtems-testing/covoar/mkExplanation @ 96d6019

4.11
Last change on this file since 96d6019 was 96d6019, checked in by Joel Sherrill <joel.sherrill@…>, on Jun 21, 2010 at 12:36:36 PM

2010-06-21 Joel Sherrill <joel.sherrill@…>

  • mkExplanation: Default value for verbose.
  • Property mode set to 100755
File size: 1.1 KB
Line 
1#! /bin/sh
2#
3#  Script to help generate an explanation for the covoar explanations file.
4#
5#  $Id$
6#
7
8toggle()
9{
10  case $1 in
11    no)  echo "yes" ;;
12    yes) echo "no" ;;
13    *)   fatal "Unknown value to toggle ($1)" ;;
14  esac
15}
16
17usage()
18{
19  echo "$progname -r sourceLine -c category [-m message|-M msgfile] "
20  exit 1
21}
22
23message=
24messageFile=
25category=
26sourceLine=
27verbose=no
28while getopts c:m:M:r:v OPT
29do
30  case "$OPT" in
31    c) category=$OPTARG ;;
32    m) message=$OPTARG ;;
33    M) messageFile=$OPTARG ;;
34    r) sourceLine=$OPTARG ;;
35    v) verbose=`toggle ${verbose}` ;;
36    *) usage ;;
37  esac
38done
39
40# Error check
41if [ "X${sourceLine}" = "X" ] ; then
42  echo No sourceLine provided
43  usage
44fi
45
46let $((shiftcount = $OPTIND - 1))
47shift #shiftcount
48
49args=$*
50
51if [ "X${category}" = "X" ] ; then
52  echo No category provided
53  usage
54fi
55
56if [ "X${message}" = "X" -a "X${messageFile}" = "X" ] ; then
57  echo No message provided
58  usage
59fi
60
61# Generate the explanation
62echo ${sourceLine}
63echo ${category}
64if [ "X${message}" = "X" ] ; then
65  cat ${messageFile}
66else
67  echo ${message} | xargs -s 76
68fi
69echo "+++"
70echo
71
72exit 0
Note: See TracBrowser for help on using the repository browser.