1ckstr(1)                         User Commands                        ckstr(1)
2
3
4

NAME

6       ckstr,  errstr, helpstr, valstr - display a prompt; verify and return a
7       string answer
8

SYNOPSIS

10       ckstr [-Q] [-W width] [ [-r regexp] [...]] [-l length]
11            [-d default] [-h help] [-e error] [-p prompt]
12            [-k pid [- s signal]]
13
14
15       /usr/sadm/bin/errstr [-W width] [-e error] [-l length]
16            [ [-r regexp] [...]]
17
18
19       /usr/sadm/bin/helpstr [-W width] [-h help] [-l length]
20            [ [-r regexp] [...]]
21
22
23       /usr/sadm/bin/valstr [-l length] [ [-r regexp] [...]] input
24
25

DESCRIPTION

27       The ckstr utility  prompts  a  user  and  validates  the  response.  It
28       defines,  among other things, a prompt message whose response should be
29       a string, text for help and error messages, and a default value  (which
30       are returned if the user responds with a RETURN).
31
32
33       The  answer  returned  from this command must match the defined regular
34       expression and be no longer than the length specified.  If  no  regular
35       expression  is  given,  valid input must be a string with a length less
36       than or equal to the length defined with no internal, leading or trail‐
37       ing white space. If no length is defined, the length is not checked.
38
39
40       All  messages  are limited in length to 79 characters and are formatted
41       automatically. Tabs and newlines are removed after a single white space
42       character  in  a message definition, but spaces are not removed. When a
43       tilde is placed at the beginning or end of a  message  definition,  the
44       default  text will be inserted at that point, allowing both custom text
45       and the default text to be displayed.
46
47
48       If the prompt, help or error message is not defined, the  default  mes‐
49       sage (as defined under EXAMPLES) is displayed.
50
51
52       Three  visual  tool  modules  are linked to the ckstr command. They are
53       errstr (which formats and displays an error  message  on  the  standard
54       output),  helpstr  (which  formats  and  displays a help message on the
55       standard output), and valstr (which validates a response).
56

OPTIONS

58       The following options are supported:
59
60       -d default    Defines the default value as default. The default is  not
61                     validated and so does not have to meet any criteria.
62
63
64       -e error      Defines the error message as  error.
65
66
67       -h help       Defines the help message as  help.
68
69
70       -k pid        Specifies  that  process ID pid is to be sent a signal if
71                     the user chooses to quit.
72
73
74       -l length     Specifies the maximum length of the input.
75
76
77       -p prompt     Defines the prompt message as prompt.
78
79
80       -Q            Specifies that quit  will  not  be  allowed  as  a  valid
81                     response.
82
83
84       -r regexp     Specifies  a  regular  expression,  regexp, against which
85                     the input should be validated. May include  white  space.
86                     If  multiple  expressions  are  defined,  the answer need
87                     match only one of them.
88
89
90       -s signal     Specifies that the process ID pid  defined  with  the  -k
91                     option  is  to be sent signal signal when quit is chosen.
92                     If no signal is specified, SIGTERM is used.
93
94
95       -W width      Specifies that prompt, help and error  messages  will  be
96                     formatted to a line length of width.
97
98

OPERANDS

100       The following operand is supported:
101
102       input    Input  to  be  verified  against  format length and/or regular
103                expression criteria.
104
105

EXAMPLES

107       Example 1 Default prompt
108
109
110       The default prompt for ckstr is:
111
112
113         example% ckstr
114         Enter an appropriate value [?,q]:
115
116
117
118       Example 2 Default error message
119
120
121       The default error message is dependent  upon  the  type  of  validation
122       involved.  The  user will be told either that the length or the pattern
123       matching failed. The default error message is:
124
125
126         example% /usr/sadm/bin/errstr
127         ERROR: Please enter a string which contains no embedded,
128         leading or trailing spaces or tabs.
129
130
131
132       Example 3 Default help message
133
134
135       The default help message is also dependent upon the type of  validation
136       involved.  If a regular expression has been defined, the message is:
137
138
139         example% /usr/sadm/bin/helpstr -r regexp
140         Please enter a string which matches the following pattern:
141         regexp
142
143
144
145
146       Other  messages  define  the length requirement and the definition of a
147       string.
148
149
150       Example 4 Using the quit option
151
152
153       When the quit option is chosen (and allowed), q is returned along  with
154       the return code 3. Quit input gets a trailing newline.
155
156
157       Example 5 Using the valstr module
158
159
160       The  valstr module will produce a usage message on stderr. It returns 0
161       for success and non-zero for failure.
162
163
164         example% /usr/sadm/bin/valstr
165         usage: valstr [-l length] [[-r regexp] [...]] input
166
167
168

EXIT STATUS

170       The following exit values are returned:
171
172       0    Successful execution.
173
174
175       1    EOF on input, or negative width on  -W option,  or usage error.
176
177
178       2    Invalid regular expression.
179
180
181       3    User termination (quit).
182
183

ATTRIBUTES

185       See attributes(5) for descriptions of the following attributes:
186
187
188
189
190       ┌─────────────────────────────┬─────────────────────────────┐
191       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
192       ├─────────────────────────────┼─────────────────────────────┤
193       │Availability                 │SUNWcsu                      │
194       └─────────────────────────────┴─────────────────────────────┘
195

SEE ALSO

197       signal.h(3HEAD), attributes(5)
198
199
200
201SunOS 5.11                        14 Sep 1992                         ckstr(1)
Impressum