NAME
cdk_misc - Curses Development Kit Miscellaneous Routines
SYNOPSIS
cc [ flag ... ] file ... -lcdk [ library ... ]
#include <cdk/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);
char ** CDKsplitString (
char *string,
int splitChar);
char * baseName (
char *string);
int ceilCDK( doublevalue);
int chlen ( chtype *string);
void chstrncpy(
char *dest,
chtype *src,
int maxcount);
char *chtype2Char (
chtype *string);
void cleanChar (
char *string,
int length,
char character);
void cleanChtype (
chtype *string,
int length,
chtype character);
int cmpStrChstr(
char *str,
chtype *chstr);
char *copyChar (
char *string);
char **copyCharList (
char **list);
chtype *copyChtype (
chtype *string);
chtype **copyChtypeList (
chtype **list);
char *dirName (
char *filename);
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 intlen ( int value);
int lenCharList (
char **list);
int lenChtypeList (
chtype **list);
int mode2Char (
char *string,
mode_t fileMode);
int searchList (
char **list,
int listSize,
char *pattern);
void sortList (
char **list,
int length);
DESCRIPTION
These are miscellaneous functions which may be useful with the Cdk
widget set.
AVAILABLE FUNCTIONS
Beep makes an audible beep. 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. Also free list itself.
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. The caller is responsible for
freeing the result.
baseName
returns a pointer to the first character of the filename in the
given pathname. The result should be freed by the caller.
ceilCDK
Return an integer like the math library ceil(), which returns a
double.
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. The caller
is responsible for freeing the result.
cleanChar
is analogous to memset. Set the characters in string to the given
character. The length of string is given by length. character
which will be written.
cleanChtype
is analogous to memset. 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
copies the string passed in. Unlike strdup this checks to see if
the string is NULL before copying.
copyCharList
copies the given list.
copyChtype
function copies the string passed in, analogous to copyChar, but
for chtype strings.
copyChtypeList
copies the given list.
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.
floorCDK
Return an integer like the math function floor(), which returns a
double.
freeChar
is a wrapper for free. It checks to see if the string is NULL
before trying to free the string.
freeCharList
Free the memory used by the given list of strings. The number of
strings to free is given by size.
freeChtype
is a wrapper for free, like freeChar.
freeChtypeList
Free the memory used by the given list of chtype strings. The
number of strings to free is given by size.
intlen
returns the length of an integer, i.e., the number of characters
needed to represent it.
lenCharList
returns the length of the given list.
lenChtypeList
returns the length of the given list.
mode2Char
Given a file protection mode fileMode, store a printable version
of the permissions in string, formatted as if by "ls -l"). Return
the corresponding permissions data, i.e., ignoring the file-type
bits.
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.
sortList
performs a quick sort of the given list. This is a wrapper for
qsort, used to sort the list of strings. The number of strings in
list is given by length. The list is sorted alphabetically in
increasing order.
SEE ALSO
cdk(3), cdk_screen(3), cdk_display(3), cdk_binding(3), cdk_util(3)
cdk_misc(3)