char2Chtype3
Cdk utility functions
Part of cdk_util(3).
Usage
cc [flag ...]
file ...
-lcdk
[library ...]
Overview
These are utility functions that one may use to initialize, build or customize widgets.
Available functions
CDKchdir-
Change working directory to the given path, possibly expanding tilde (~) and wildcards (*). It returns zero on success.
CDKgetDirectoryContents-
opens and reads the contents of the given directory, filling the array
listwith the sorted contents of the directory. If the directory cannot be opened then it returns a value of -1.
CDKopenFile-
Open the file, possibly expanding tilde (~) and wildcards (*). It returns a FILE pointer.
CDKreadFile-
Read the file filename, load the contents into a dynamically allocated array, storing its address via info. It returns the number of lines read if the file could be opened, -1 otherwise.
alignxy-
Aligns a box on the given window with the height and width given. See cdk_position (3) for the interpretation of the xpos, ypos, boxWidth and boxHeight, parameters.
char2Chtype-
Translate a character string with embedded HTML-like format markers (e.g., “</X/Y>Blah Blah”) to a null-terminated array of chtype's.
- •
-
The length of the array is stored via the length parameter.
- •
-
The
alignparameter contains justification information (LEFT, CENTER, RIGHT).
-
The caller is responsible for freeing the result.
-
See cdk_display(3) for details on formatting.
char2DisplayType-
Lookup the given name in string and return the equivalent display type. See also cdk_display(3).
checkForLink-
Check if the given line is of the form
<F=filename>
-
If so, extract the filename from the line, storing it in the filename buffer (which must hold at least CDK_PATHMAX characters). Return nonzero if a filename is extracted.
chtype2String-
Extract the characters and formatting information from a null-terminated array of chtype's string. A dynamically allocated string is returned.
-
See cdk_display(3) for details on Cdk's formatting.
-
In addition, this function supports a feature needed to represent multi-line title strings returned by
getCdkTitle(see cdk_objs(3)). Each newline separating lines in the title is represented by “<#10>” to allow Cdk to display the string in a text field.
deleteCursesWindow-
Safely delete a given window, i.e., first check if the window parameter is nonnull.
enableCursesMarkup-
Normally Cdk checks for HTML-like markup in character strings which it translates to curses strings with
char2Chtype. Use this function to disable the feature temporarily.
eraseCursesWindow-
Safely erase a given window, i.e., first check if the window parameter is nonnull.
getListIndex-
Display a scrollable list of strings in a dialog, allow the user to select one. Return the index in the list of the value selected.
- •
-
The list parameter contains the strings to display; there are listSize strings in the list.
- •
-
If numbers is true, the displayed list items will be numbered.
getString-
pops up an entry widget with
- •
-
a title supplied by the value of the
titleparameter,
- •
-
a label supplied by the
labelparameter, and
- •
-
an initial value supplied by the
initialValueparameter.
-
It returns a pointer to the value typed in or NULL if the widget was exited early.
justifyString-
Given a string length mesglen, the available field width fieldWidth and a justification type justify, return the number of characters by which to shift the string.
mode2Filetype-
Given a file protection mode fileMode, return ignoring the file-type bits, i.e., ignoring the corresponding permissions data.
moveCursesWindow-
Move a given window by the amounts in xdiff and ydiff.
popupDialog-
creates a quick pop-up dialog box. Pass in
- •
-
the message in the
mesgparameter,
- •
-
the size of the message in the
mesgCountparameter,
- •
-
the button labels in the
buttonsparameter and
- •
-
the number of buttons in the
buttonCountparameter.
-
The dialog box will be centered on the screen.
popupLabel-
creates a quick pop-up label widget.
-
The message and the size of the message are passed in via the
mesgandcountparameters respectively.
-
The label widget waits until the user hits a character and is centered on the screen.
popupLabelAttrib-
Display a simple dialog with a list of count message strings mesg. Use the given attribute for the background of the dialog.
selectFile-
Display a file-selection dialog. Return the selected filename, or null if none is selected. The caller should free the return-value.
setWidgetDimension-
This is a helper function used to set the height/width of a widget:
- •
-
If the proposed dimension proposedDim is FULL or zero, the return value will be parentDim.
- •
-
If the proposed dimension proposedDim is positive,
- •
-
and it is larger than parentDim, return proposedDim,
- •
-
otherwise return proposedDim plus adjustment.
- •
-
If the proposed dimension proposedDim is negative, the return value will be parentDim plus proposedDim.
- •
-
Otherwise, the return value will be proposedDim.
stripWhiteSpace-
Strip whitespace from the front and/or back of the given string.
-
The stripType parameter controls the type of stripping done: vFRONT, vBACK or vBOTH.
viewFile-
Read the file specified by filename and display it in a CDKVIEWER window. The title, buttons and buttonCount are applied to the CDKVIEWER window.
- •
-
The viewer shows the contents of the file supplied by the
filenamevalue.
- •
-
The buttons on the file viewer are supplied by the
buttonsparameter.
-
It returns the index of the button selected, or -1 if the file does not exist or if the widget was exited early.
| Strip_Type | Result |
| vFRONT | This tells the function to remove all of the white space from the front of the given string. |
| vBACK | This tells the function to remove all of the white space from the back of the given string. |
| vBOTH | This tells the function to remove all of the white space from both the front and the back of the given string. |
viewInfo-
Display the list of strings in info in a CDKVIEWER window. The number of strings is given by size. The title, buttons and buttonCount are applied to the CDKVIEWER window.
History
- Debian 13 (Trixie): the text shown here
- Debian 12 (Bookworm) to Debian 9 (Stretch)
- Debian 8 (Jessie) to Debian 7 (Wheezy)
- Debian 6.0 (Squeeze) to Debian 5.0 (Lenny)
- Debian 4.0 (Etch)