cdk_misc(3)

NAME
Beep, CDKcountStrings, CDKfreeStrings, CDKgetDirectoryContents, CDKreadFile, CDKsplitString, baseName, char2Chtype, chlen, chtype2Char, cleanChar, cleanChtype, copyChar, copyChtype, freeChar, freeChtype, getListIndex, getString, intlen, mode2Char, popupDialog, popupLabel, searchList, sortList, stripWhiteSpace, viewFile - Curses Development Kit Miscellaneous Routines

SYNOPSIS

cc [ flag ... ] file ... -lcdk [ library ... ]

#include <cdk/cdk.h>

void Beep(void);

char * baseName (
    char *pathname);

unsigned CDKcountStrings ("
    char **list);

void CDKfreeStrings ("
    char **list);

int CDKgetDirectoryContents (
    char *directory,
    char **list);

int CDKreadFile (
    char *filename,
    char ***info);

char ** CDKsplitString ("
    char *string
    char splitChar);

char * baseName (
    char *string);

chtype * char2Chtype (
    char *string,
    int *length,
    int *align);

int chlen (
    chtype *string);

char *chtype2Char (
    chtype *string);

void cleanChar (
    char *string,
    int length,
    char character);

void cleanChtype (
    chtype *string,
    int length,
    chtype character);

char *copyChar (
    char *string);

chtype *copyChtype (
    chtype *string);

void freeChar (
    char *string);

void freeChtype (
    chtype *string);

int getListIndex (
    CDKSCREEN *win,
    char *title,
    char **list,
    int listSize,
    boolean numbers);

char *getString (
    CDKSCREEN *win,
    char *title,
    char *label,
    char *inititalValue);

int intlen (
    int value);

int mode2Char (
    char *string,
    mode_t fileMode);

int popupDialog (
    CDKSCREEN *screen,
    char **mesg,
    int mesgCount,
    char **buttons,
    int buttonCount);

void popupLabel (
    CDKSCREEN *win,
    char **mesg,
    int count);

int searchList (
    char **list,
    int listSize,
    char *pattern);

void sortList (
    char **list,
    int length);

void stripWhiteSpace (
    EStripType stripType,
    char *string);

int viewFile (
    CDKSCREEN *win,
    char *title,
    char *filename,
    char **buttons,
    int buttonCount);

DESCRIPTION
These are miscellaneous functions which may be useful with the Cdk widget set.

AVAILABLE FUNCTIONS

Beep
    makes an audible beep. This differs from the beep() function by flushing STDOUT stream.

CDKcountStrings
    returns the number of strings in the given list.

CDKfreeStrings
    frees the strings in the list, and the given list itself.

CDKgetDirectoryContents
    opens and reads the contents of the given directory, filling the array list with the sorted contents of the directory. If the directory cannot be opened then it returns a value of -1.

CDKreadFile
    reads the contents of the given file and stores the contents in the info parameter, which is assumed to be initialized to null. It returns the number of lines read if the file could be opened, -1 otherwise.

CDKsplitString
    splits the given string into strings based on the split character in splitChar, and returns a null-terminated list of the strings.

baseName
    returns a pointer to the first character of the filename in the given pathname.

char2Chtype
    takes a string in the form of "</X/Y>Blah Blah" and returns a chtype* of the correct type. The length parameter is the length of the chtype* and the align parameter contains justification information.

chlen
    returns the length of the chtype* given.

chtype2Char
    takes a chtype* string and returns the equivalent char* string.

cleanChar
    is analogous to memset. The length parameter states how many characters to write, and character is the character which will be written.

cleanChtype
    is analogous to memset. The length parameter states how many chtype's to write, and character is the chtype value which will be written.

copyChar
    copies the string passed in. Unlike strdup this checks to see if the string is NULL before copying.

copyChtype
    function copies the string passed in, analogous to copyChar, but for chtype strings.

freeChar
    is a wrapper for free. It checks to see if the string is NULL before trying to free the string.

freeChtype
    is a wrapper for free, like freeChar.

getListIndex
    provides a popup scrolling list filled with the items passed in via the list parameter. It returns the index in the list selected, or -1 if no item was selected.

getString
    pops up an entry widget with a title supplied by the value of the title parameter, a label supplied by the label parameter, and an initial value supplied by the initialValue parameter. It returns a pointer to the value typed in or NULL if the widget was exited early.

intlen
    returns the length of an integer, i.e., the number of characters needed to represent it.

mode2Char
    returns the permissions stored in the file-mode in the fileMode parameter The string parameter receives the permissions, formatted as if by "ls -l").

popupDialog
    creates a quick pop-up dialog box. Pass in the message in the mesg parameter, the size of the message in the mesgCount parameter, the button labels in the buttons parameter and the number of buttons in the buttonCount parameter. 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 mesg and count parameters respectively. The label widget waits until the user hits a character and is centered on the screen.

searchList
    searches the array list checking to find an element in the array starting with the given pattern. It returns the index of the first match or -1 if it can't find one.

sortList
    performs a quick sort of the given list. The list is sorted alphabetically in increasing order.

stripWhiteSpace
    strips leading and trailing white space from the given string. The parameter stripType is one of the following values.

viewFile
    pops up a viewer widget. The viewer shows the contents of the file supplied by the filename value. The buttons on the file viewer are supplied by the buttons parameter. 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.

SEE ALSO
cdk(3), cdk_screen(3), cdk_display(3), cdk_binding(3)