Revision 9084,
1.6 KB
checked in by ghudson, 28 years ago
(diff) |
This commit was generated by cvs2svn to compensate for changes in r9083,
which included commits to RCS files with non-trunk default branches.
|
-
Property svn:executable set to
*
|
Line | |
---|
1 | #!/bin/csh -f |
---|
2 | set ny = (no yes) |
---|
3 | if ($2 == "yesno") then |
---|
4 | @ i = $3 + 1 |
---|
5 | set pmpt = "$1 [$ny[$i]]: " |
---|
6 | else |
---|
7 | if ("$3" == "") then |
---|
8 | set pmpt = "${1}" |
---|
9 | else |
---|
10 | set pmpt = "$1 [$3]: " |
---|
11 | endif |
---|
12 | endif |
---|
13 | rpt: |
---|
14 | echo -n "$pmpt" |
---|
15 | set input = $< |
---|
16 | switch ($2) |
---|
17 | case number: |
---|
18 | set tmp = `echo $input | tr -d 0123456789.` |
---|
19 | if ("x$tmp" != x) then |
---|
20 | echo "Invalid number. Please try again." |
---|
21 | goto rpt |
---|
22 | endif |
---|
23 | breaksw |
---|
24 | |
---|
25 | case integer: |
---|
26 | set tmp = `echo $input | tr -d 0123456789` |
---|
27 | if ("x$tmp" != x) then |
---|
28 | echo "Invalid integer. Please try again." |
---|
29 | goto rpt |
---|
30 | endif |
---|
31 | breaksw |
---|
32 | |
---|
33 | case neginteger: |
---|
34 | if ("x$input" != x-1) then |
---|
35 | set tmp = `echo $input | tr -d 0123456789` |
---|
36 | if ("x$tmp" != x) then |
---|
37 | echo "Invalid integer. Please try again." |
---|
38 | goto rpt |
---|
39 | endif |
---|
40 | endif |
---|
41 | breaksw |
---|
42 | |
---|
43 | case file: |
---|
44 | if ("x$input" == "x") then |
---|
45 | set input = $3 |
---|
46 | endif |
---|
47 | if (! -e "$input") then |
---|
48 | echo The file $input "does not exist. Please try again." |
---|
49 | goto rpt |
---|
50 | endif |
---|
51 | breaksw |
---|
52 | |
---|
53 | case path: |
---|
54 | if ("x$input" == "x") then |
---|
55 | set input = "$3" |
---|
56 | endif |
---|
57 | if (! -e "$input") then |
---|
58 | foreach elt ($path) |
---|
59 | if (-e "$elt/$input") breaksw |
---|
60 | end |
---|
61 | echo The command $input "was not found. Please try again." |
---|
62 | goto rpt |
---|
63 | endif |
---|
64 | breaksw |
---|
65 | |
---|
66 | case yesno: |
---|
67 | if ("x$input" == xy || "x$input" == xyes) then |
---|
68 | set input = 1 |
---|
69 | else if ("x$input" == xn || "x$input" == xno) then |
---|
70 | set input = 0 |
---|
71 | else if ("x$input" != x) then |
---|
72 | echo 'Please answer "yes" or "no".' |
---|
73 | goto rpt |
---|
74 | endif |
---|
75 | breaksw |
---|
76 | |
---|
77 | default: |
---|
78 | breaksw |
---|
79 | |
---|
80 | endsw |
---|
81 | |
---|
82 | if ("x$input" == x) then |
---|
83 | set input = "$3" |
---|
84 | endif |
---|
85 | |
---|
86 | echo $input > $4 |
---|
Note: See
TracBrowser
for help on using the repository browser.