Unix validation tools - Introduction
What are the benefits of these tools - beside the portability between Unix and Linux?
- They provide a lot of features for command line user interfaces. They:
- display an input prompt
- request for user input
- validate the input according to the tool type and the rules defined using command line options
- display an error message when the user input is invalid, return to the prompt
- display a help text on user request, return to the prompt
- There are defaults defined for all types of messages. In the most simple way you only have to call the tool without any options - all work is done for you and all messages will appear depending on your system language (actually only german and english).
- The tools are controlled widely using the same syntax. Many options are available in most of the tools (individual prompt, error, help messages, defaults ...).
- All tools are completely independent of terminal properties. They don't use screen control sequences, so they do theri work even over slow (serial) connections on a VT100 terminal, usable also on very old modem lines.
- They don't use keys except the ones on a normal alphanumeric keyboard. The only one key, that is not an ordinary key is CTRL-D, used to stop paging in the ckitem tool.
The following tools are available (see the manual for a detailed option's description):
- ckdate: request for a date (in a default or defined format)
- ckgid: request for a group name existing on the system
- ckint: request for an integer, per default to base 10, bases between 2 and 36 are possible
- ckitem: display a list of menu items; request for an item; a large list of options is available
- ckkeywd: request for a keyword defined in a list
- ckpath: request for a pathname, it is possible to define the file type, permissions, existence ...
- ckrange: request for an integer within a given range, per default to base 10, bases between 2 and 36 are possible
- ckstr: request for a string, optional limited in length or matching defined regular expressions
- cktime: request for a time (in a default or defined format)
- ckuid: request for an existing user name
- ckyorn: yes/no request
- ckcont: that's an extension to the tools available on Unix systems. The tool is very simple: it displays a prompt and waits for a RETURN. I often use such a simple prompt to let the user read a program output and then continue with my script. It could be simulated using another tool like ckyorn with default "yes", but I don't need error or help messages or "quit" ...
With many tools (if it makes sense) come some so called "visual tools". They perform partial tasks and can be used independent of a complete user input request. And here they are:
- err*: display the error message and quit
- help*: display the help text and quit
- val*: validate the input given on command line and return an appropriate exit value
I think, the benefits are obvious: easy to use for both programmer and user, ready to work in almost every environment. That's why I implemented the Perl module in order to make it just as easy for you to integrate it in your Perl programs.