man cdk_util (Fonctions bibliothèques) - Cdk utility functions

NAME

Beep, CDKallocStrings, CDKcountStrings, CDKfreeChtypes, CDKfreeStrings, CDKgetDirectoryContents, CDKreadFile, CDKsplitString, alignxy, baseName, ceilCDK, char2Chtype, char2DisplayType, checkForLink, chlen, chstrncpy, chtype2Char, chtype2String, cleanChar, cleanChtype, cmpStrChstr, copyChar, copyChtype, deleteCursesWindow, dirName, eraseCursesWindow, floorCDK, freeChar, freeCharList, freeChtype, freeChtypeList, getListIndex, getString, intlen, justifyString, mode2Char, mode2Filetype, moveCursesWindow, popupDialog, popupLabel, popupLabelAttrib, searchList, selectFile, setWidgetDimension, sortList, stripWhiteSpace, viewFile, viewInfo - Cdk utility functions

SYNOPSIS

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

#include <cdk.h>

void Beep(void);
unsigned CDKallocStrings(
char ***list/, char *item/, unsigned length/, unsigned used/);
unsigned CDKcountStrings(
char **list");
void CDKfreeChtypes(
chtype **list);
void CDKfreeStrings(
char **list);
int CDKgetDirectoryContents (
char *directory, char ***list);
int CDKreadFile (
char *filename, char ***info);
char **CDKsplitString(
char *string, int separator);
void alignxy (
WINDOW *window, int *xpos, int *ypos, int boxWidth, int boxHeight);
char *baseName (
char *filename);
int ceilCDK(
doublevalue);
chtype *char2Chtype (
char *string, int *length, int *align);
EDisplayType char2DisplayType (
char *string);
int checkForLink (
char *line, char *filename);
int chlen (
chtype *string);
"void chstrncpy(
char *dest, chtype *src, int maxcount);
char *chtype2Char (
chtype *string);
"char *chtype2String (
chtype *string);
void cleanChar (
char *string, int length, char character);
void cleanChtype (
chtype *string, int length, chtypecharacter);
int cmpStrChstr(
char *str, chtype *chstr);
char *copyChar (
char *string);
chtype *copyChtype (
chtype *string);
void deleteCursesWindow (
WINDOW *window);
char *dirName (
char *filename);
void eraseCursesWindow (
WINDOW *window);
int floorCDK(
double value);
void freeChar (
char *string);
void freeCharList (
char **list, unsigned size);
"void freeChtype (
chtype *string);
void freeChtypeList ("
chtype **list, unsigned size);
int getListIndex (
CDKSCREEN *screen, char *title, char **list, int listSize, boolean numbers);
char *getString ("
CDKSCREEN *screen, char *title, char *label, char *init);
int intlen (
int value);
int justifyString (
int fieldWidth, int mesglen, int justify);
int mode2Char (
char *string, mode_t fileMode);
int mode2Filetype (
mode_t fileMode);
void moveCursesWindow (
WINDOW *window, int xdiff, int ydiff);
int popupDialog (
CDKSCREEN *screen, char **mesg, int mesgCount, char **buttons, int buttonCount);
void popupLabel (
CDKSCREEN *win, char **mesg, int count);
void popupLabelAttrib (
CDKSCREEN *win, char **mesg, int count, chtype attribute);
int searchList (
char **list, int listSize, char *pattern);
char *selectFile (
CDKSCREEN *screen, char *title);
int setWidgetDimension (
int parentDim, int proposedDim, int adjustment);
void sortList (
char *list[], int length);
void stripWhiteSpace (
EStripType stripType, char *string);
int viewFile (
CDKSCREEN *screen, char *title, char *filename, char **buttons, int buttonCount);
int viewInfo (
CDKSCREEN *screen, char *title, char **info, int size, char **buttons, int buttonCount, boolean interpret);

DESCRIPTION

AVAILABLE FUNCTIONS

Beep
This beeps at the user. The standard curses beep() does not flush the stream, so it will only beep until a force is made. This forces a flush after issuing the beep command.
CDKallocStrings
Add a new string item to a list. Keep a null pointer on the end so one may use CDKfreeStrings() to deallocate the whole list. The caller is responsible for updating the length of the list. The return value is the updated number of chars used.
CDKcountStrings
Count the number of items in a null-terminated list of character strings. Return the count.
CDKfreeChtypes
Free a list of chtype-strings which is terminated by a null pointer.
CDKfreeStrings
Free a list of character strings which is terminated by a null pointer.
CDKgetDirectoryContents
Open the given directory and reads in the contents. Store result in list and return the number of elements found.
CDKreadFile
Read the file filename, load the contents into a dynamically allocated array, storing its address via info and return the number of lines read.
CDKsplitString
Split the string at each occurrence of separator, returning a pointer to a dynamically allocated array of the pieces. The original string is unmodified.
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.
baseName
Return the basename of the given filename. The result should be freed by the caller.
ceilCDK
Return an integer like the math library ceil(), which returns a double.
char2Chtype
Translate a character string with embedded format markers to a null-terminated array of chtype's. The length of the array is stored via the length parameter. The alignment (LEFT, CENTER, RIGHT) is stored via the align parameter.
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.
chlen
Returns the length of the (null-terminated) string of chtype's.
chstrncpy
Extract the characters from a null-terminated array of chtype's src. The size of the destination dest is given in maxcount.
chtype2Char
Extract the characters from a null-terminated array of chtype's string. A dynamically allocated string is returned.
chtype2String
Extract the characters and formatting information from a null-terminated array of chtype's string. A dynamically allocated string is returned.
cleanChar
Set the characters in string to the given character. The length of string is given by length.
cleanChtype
Set the chtype's in string to the given character. The length of string is given by length.
cmpStrChstr
Compare a char string str to a chtype string chstr. Return -1, 0 or 1 according to whether str is less than, equal to to greater than chstr.
copyChar
Copy the given character string (like strdup).
copyChtype,
Copy the given chtype string (analogous to strdup).
deleteCursesWindow
Safely delete a given window, i.e., first check if the window parameter is nonnull.
dirName
Returns the directory for the given filename, i.e., the part before the * last slash. The return value should be freed by the caller.
eraseCursesWindow
Safely erase a given window, i.e., first check if the window parameter is nonnull.
floorCDK
Return an integer like the math function floor(), which returns a double.
freeChar
Free the memory used by the given string.
freeCharList
Free the memory used by the given list of strings. The number of strings to free is given by size.
freeChtype
Free frees the memory used by the given chtype string.
freeChtypeList
Free the memory used by the given list of chtype strings. The number of strings to free is given by size.
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
Display a simple dialog containing a prompt label and initial value init for the user's response. Return the response string.
intlen
Return the number of characters which are required to represent the given integer value.
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.
mode2Char
Given a file protection mode fileMode, store a printable version of the permissions in string. Return the corresponding permissions data, i.e., ignoring the file-type bits.
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
Display a simple dialog with a list of mesgCount message strings mesg. At the bottom of the dialog, display buttonCount buttons.
popupLabel
Display a simple dialog with a list of count message strings mesg.
popupLabelAttrib
Display a simple dialog with a list of count message strings mesg. Use the given attribute for the background of the dialog.
searchList
Search the given list of listSize strings for a subset of a word pattern in the given list. Return the index in the list if it is found, or -1 if not found.
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.
sortList
This is a wrapper for qsort, used to sort the list of strings. The number of strings in list is given by length.
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.
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.

SEE ALSO

cdk_dialog (3), cdk_display (3), cdk_position (3).

CETTE PAGE DOCUMENTE AUSSI :