OSDN Git Service

Merge branch 'master' of git.sourceforge.jp:/gitroot/eos/base
[eos/base.git] / sbin / ctrl2proto
1 #!/bin/sh
2 #
3 # %M% %Y% %I%
4 #
5 # The latest update : %G% at %U%
6 #
7 #%Z% ctrl2proto Function
8 #%Z%
9 #
10 #%Z% Usage : ctrl2proto SourceFileName
11 #
12 #%Z% Attention
13 #%Z%
14 #%Z% Parameter: 
15 #%Z%     Essential:
16 #%Z%         SourceFileName
17 #%Z% Optional:
18 #%Z%
19
20 usage()
21 {
22         echo "Usage: ctrl2proto ClassName ToolName OptionCtrlFileName"
23 }
24
25 NameRead()
26 {
27         ans="N"
28         while [ $ans != "Y" -a $ans != "y" ]
29         do
30                 echo $1
31                 read Name
32                 echo "$Name is good ?"
33                 read ans
34         done
35 }
36 # Store Flags
37 FlagsCharacter="-"
38
39 case $# in 
40         0)
41                 ;;
42         *)
43                 while [ `echo $1 | cut -c1` = ${FlagsCharacter} ]
44                 do
45                         if [ `echo $1 | cut -c2` = "h" ] 
46                         then
47                                 usage
48                         else
49                                 parms="${parms} $1"
50                                 shift 
51                         fi
52                 done
53                 ;;
54 esac
55
56 case $# in
57         0) # No filename 
58                 echo "Enter ClassName"
59                 read ClassName
60                 echo "Enter ToolName"
61                 read ToolName
62                 echo "Enter OptionCtrlFileName"
63                 read OptionCtrlFile
64                 ;;
65         1) # No filename 
66                 ClassName = $1
67                 echo "Enter ToolName"
68                 read ToolName
69                 echo "Enter OptionCtrlFileName"
70                 read OptionCtrlFile
71                 ;;
72         2) # 
73                 ClassName=$1
74                 ToolName=$2
75                 echo "Enter OptionCtrlFileName"
76                 read OptionCtrlFile
77                 ;;
78         3)
79                 ClassName=$1
80                 ToolName=$2
81                 OptionCtrlFile=$3
82                 ;;
83         *) #
84                 usage
85                 ;;
86 esac
87 #
88 currentDir=`pwd`
89
90 sourceFiles="usage header init argCheck util"
91
92 for i in  $sourceFiles
93 do
94         echo "creating $i"
95         $EOS_HOME/sbin/ctrl2$i $ClassName $ToolName $OptionCtrlFile
96 done
97