source: rtems-testing/covoar/mkExplanation @ 2801a7e

4.11
Last change on this file since 2801a7e was 2801a7e, checked in by Joel Sherrill <joel.sherrill@…>, on Jun 18, 2010 at 4:13:01 PM

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

  • Makefile: Add simple script to help write explanation entries.
  • mkExplanation: New file.
  • 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=
27while getopts c:m:M:r:v OPT
28do
29  case "$OPT" in
30    c) category=$OPTARG ;;
31    m) message=$OPTARG ;;
32    M) messageFile=$OPTARG ;;
33    r) sourceLine=$OPTARG ;;
34    v) verbose=`toggle ${verbose}` ;;
35    *) usage ;;
36  esac
37done
38
39# Error check
40if [ "X${sourceLine}" = "X" ] ; then
41  echo No sourceLine provided
42  usage
43fi
44
45let $((shiftcount = $OPTIND - 1))
46shift #shiftcount
47
48args=$*
49
50if [ "X${category}" = "X" ] ; then
51  echo No category provided
52  usage
53fi
54
55if [ "X${message}" = "X" -a "X${messageFile}" = "X" ] ; then
56  echo No message provided
57  usage
58fi
59
60# Generate the explanation
61echo ${sourceLine}
62echo ${category}
63if [ "X${message}" = "X" ] ; then
64  cat ${messageFile}
65else
66  echo ${message} | xargs -s 76
67fi
68echo "+++"
69echo
70
71exit 0
Note: See TracBrowser for help on using the repository browser.