Initial import from FreeBSD RELENG_4:
[games.git] / sys / dev / raid / vinum / makestatetext
1 #!/bin/sh
2 # Make statetexts.h from vinumstate.h
3 # $FreeBSD: src/sys/dev/vinum/makestatetext,v 1.6 2000/02/29 06:07:01 grog Exp $
4 # $Id: makestatetext,v 1.7 1999/12/29 07:24:54 grog Exp grog $
5 infile=vinumstate.h
6 ofile=statetexts.h
7 echo >$ofile "/* Created by $0 on" `date`.  "Do not edit */"
8 echo >>$ofile
9 cat >> $ofile <<FOO
10 /*-
11  * Copyright (c) 1997, 1998
12  *      Nan Yang Computer Services Limited.  All rights reserved.
13  *
14  *  This software is distributed under the so-called \`\`Berkeley
15  *  License'':
16  *
17  * Redistribution and use in source and binary forms, with or without
18  * modification, are permitted provided that the following conditions
19  * are met:
20  * 1. Redistributions of source code must retain the above copyright
21  *    notice, this list of conditions and the following disclaimer.
22  * 2. Redistributions in binary form must reproduce the above copyright
23  *    notice, this list of conditions and the following disclaimer in the
24  *    documentation and/or other materials provided with the distribution.
25  * 3. All advertising materials mentioning features or use of this software
26  *    must display the following acknowledgement:
27  *      This product includes software developed by Nan Yang Computer
28  *      Services Limited.
29  * 4. Neither the name of the Company nor the names of its contributors
30  *    may be used to endorse or promote products derived from this software
31  *    without specific prior written permission.
32  *  
33  * This software is provided \`\`as is'', and any express or implied
34  * warranties, including, but not limited to, the implied warranties of
35  * merchantability and fitness for a particular purpose are disclaimed.
36  * In no event shall the company or contributors be liable for any
37  * direct, indirect, incidental, special, exemplary, or consequential
38  * damages (including, but not limited to, procurement of substitute
39  * goods or services; loss of use, data, or profits; or business
40  * interruption) however caused and on any theory of liability, whether
41  * in contract, strict liability, or tort (including negligence or
42  * otherwise) arising in any way out of the use of this software, even if
43  * advised of the possibility of such damage.
44  */
45
46 FOO
47
48 echo >>$ofile "/* Drive state texts */"
49 echo >>$ofile "char *drivestatetext [] = 
50   { "
51 egrep  -e 'drive_[A-z0-9]*,'  <$infile | grep -v = | sed 's: *drive_\([^,]*\).*:  \"\1\",:' >>$ofile
52 cat <<FOO >> $ofile
53   };
54
55 /* Subdisk state texts */
56 char *sdstatetext [] =
57   { 
58 FOO
59 egrep  -e 'sd_[A-z0-9]*,' $infile | grep -v = | sed 's: *sd_\([^,]*\).*:  \"\1\",:' >>$ofile
60 cat <<FOO >> $ofile
61   };
62
63 /* Plex state texts */
64 char *plexstatetext [] =
65   { 
66 FOO
67 egrep  -e 'plex_[A-z0-9]*,' $infile | grep -v = | sed 's: *plex_\([^,]*\).*:  \"\1\",:' >>$ofile
68 cat <<FOO >> $ofile
69   };
70
71 /* Volume state texts */
72 char *volstatetext [] =
73   { 
74 FOO
75 egrep  -e 'volume_[A-z0-9]*,' $infile | grep -v = | sed 's: *volume_\([^,]*\).*:  \"\1\",:' >>$ofile
76 cat <<FOO >> $ofile
77   };
78 FOO