2 .\" Copyright 1989 AT&T Copyright (c) 2001, Sun Microsystems, Inc. All Rights Reserved
3 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
4 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
5 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
6 .TH CKSTR 1 "Sep 14, 1992"
8 ckstr, errstr, helpstr, valstr \- display a prompt; verify and return a string
13 \fBckstr\fR [\fB-Q\fR] [\fB-W\fR \fIwidth\fR] [ [\fB-r\fR \fIregexp\fR] [...]] [\fB-l\fR \fIlength\fR]
14 [\fB-d\fR \fIdefault\fR] [\fB-h\fR \fIhelp\fR] [\fB-e\fR \fIerror\fR] [\fB-p\fR \fIprompt\fR]
15 [\fB-k\fR \fIpid\fR [\fB- s\fR \fIsignal\fR]]
20 \fB/usr/sadm/bin/errstr\fR [\fB-W\fR \fIwidth\fR] [\fB-e\fR \fIerror\fR] [\fB-l\fR \fIlength\fR]
21 [ [\fB-r\fR \fIregexp\fR] [...]]
26 \fB/usr/sadm/bin/helpstr\fR [\fB-W\fR \fIwidth\fR] [\fB-h\fR \fIhelp\fR] [\fB-l\fR \fIlength\fR]
27 [ [\fB-r\fR \fIregexp\fR] [...]]
32 \fB/usr/sadm/bin/valstr\fR [\fB-l\fR \fIlength\fR] [ [\fB-r\fR \fIregexp\fR] [...]] \fIinput\fR
38 The \fBckstr\fR utility prompts a user and validates the response. It defines,
39 among other things, a prompt message whose response should be a string, text
40 for help and error messages, and a default value (which are returned if the
41 user responds with a RETURN).
44 The answer returned from this command must match the defined regular expression
45 and be no longer than the length specified. If no regular expression is given,
46 valid input must be a string with a length less than or equal to the length
47 defined with no internal, leading or trailing white space. If no length is
48 defined, the length is not checked.
51 All messages are limited in length to 79 characters and are formatted
52 automatically. Tabs and newlines are removed after a single white space
53 character in a message definition, but spaces are not removed. When a tilde is
54 placed at the beginning or end of a message definition, the default text will
55 be inserted at that point, allowing both custom text and the default text to be
59 If the prompt, help or error message is not defined, the default message (as
60 defined under EXAMPLES) is displayed.
63 Three visual tool modules are linked to the \fBckstr\fR command. They are
64 \fBerrstr\fR (which formats and displays an error message on the standard
65 output), \fBhelpstr\fR (which formats and displays a help message on the
66 standard output), and \fBvalstr\fR (which validates a response).
70 The following options are supported:
74 \fB\fB-d\fR \fIdefault\fR\fR
77 Defines the default value as \fIdefault\fR. The default is not validated and so
78 does not have to meet any criteria.
84 \fB\fB-e\fR \fIerror\fR\fR
87 Defines the error message as \fI error\fR.
93 \fB\fB-h\fR \fIhelp\fR\fR
96 Defines the help message as \fI help\fR.
102 \fB\fB-k\fR \fIpid\fR\fR
105 Specifies that process \fBID\fR \fIpid\fR is to be sent a signal if the user
112 \fB\fB-l\fR \fIlength\fR\fR
115 Specifies the maximum length of the input.
121 \fB\fB-p\fR \fIprompt\fR\fR
124 Defines the prompt message as \fIprompt\fR.
133 Specifies that \fBquit\fR will not be allowed as a valid response.
139 \fB\fB-r\fR \fIregexp\fR\fR
142 Specifies a regular expression, \fI regexp\fR, against which the input should
143 be validated. May include white space. If multiple expressions are defined, the
144 answer need match only one of them.
150 \fB\fB-s\fR \fIsignal\fR\fR
153 Specifies that the process \fBID\fR \fIpid\fR defined with the \fB-k\fR option
154 is to be sent signal \fIsignal\fR when quit is chosen. If no signal is
155 specified, \fBSIGTERM\fR is used.
161 \fB\fB-W\fR \fIwidth\fR\fR
164 Specifies that prompt, help and error messages will be formatted to a line
165 length of \fIwidth\fR.
171 The following operand is supported:
178 Input to be verified against format length and/or regular expression criteria.
183 \fBExample 1 \fRDefault prompt
186 The default prompt for \fBckstr\fR is:
192 Enter an appropriate value [?,q]:
198 \fBExample 2 \fRDefault error message
201 The default error message is dependent upon the type of validation involved.
202 The user will be told either that the length or the pattern matching failed.
203 The default error message is:
208 example% \fB/usr/sadm/bin/errstr\fR
209 ERROR: Please enter a string which contains no embedded,
210 leading or trailing spaces or tabs.
216 \fBExample 3 \fRDefault help message
219 The default help message is also dependent upon the type of validation
220 involved. If a regular expression has been defined, the message is:
225 example% \fB/usr/sadm/bin/helpstr \fR\fB-r\fR\fB regexp\fR
226 Please enter a string which matches the following pattern:
234 Other messages define the length requirement and the definition of a string.
237 \fBExample 4 \fRUsing the quit option
240 When the quit option is chosen (and allowed), \fBq\fR is returned along with
241 the return code \fB3\fR. Quit input gets a trailing newline.
244 \fBExample 5 \fRUsing the valstr module
247 The \fBvalstr\fR module will produce a usage message on stderr. It returns
248 \fB0\fR for success and non-zero for failure.
253 example% \fB/usr/sadm/bin/valstr\fR
254 usage: valstr [\fB-l\fR length] [[\fB-r\fR regexp] [\|.\|.\|.\|]] input
262 The following exit values are returned:
269 Successful execution.
278 \fBEOF\fR on input, or negative width on \fB-W\fR option, or usage error.
287 Invalid regular expression.
296 User termination (quit).
302 \fBsignal.h\fR(3HEAD), \fBattributes\fR(5)