Seth Woolley's Man Viewer

cdk_misc(3) - 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 - man 3 cdk_misc

([section] manual, -k keyword, -K [section] search, -f whatis)
man plain no title

cdk_misc(3)                                                        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(1,n) ...  -lcdk [ library ... ]

       #include <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(1,5,n));

       char ** CDKsplitString (
                      char *string(3,n),
                      int splitChar);

       char * baseName (
                      char *string(3,n));

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

       int chlen (    chtype *string(3,n));

       char *chtype2Char (
                      chtype *string(3,n));

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

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

       char *copyChar (
                      char *string(3,n));

       chtype *copyChtype (
                      chtype *string(3,n));

       void freeChar (
                      char *string(3,n));

       void freeChtype (
                      chtype *string(3,n));

       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(3,n),
                      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(3,n));

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

DESCRIPTION
       These are miscellaneous functions which may be useful with the Cdk wid-
       get set.

AVAILABLE FUNCTIONS
       Beep makes  an  audible beep.  This differs from the beep(1,3x,3x curs_beep)() function by
            flushing STDOUT stream.

       CDKcountStrings
            returns the number of strings in(1,8) the given list.

       CDKfreeStrings
            frees the strings in(1,8) 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(1,n) and stores  the  contents  in(1,8)
            the  info(1,5,n)  parameter,  which is assumed to be initialized to null.
            It returns the number of lines read(2,n,1 builtins) if(3,n) the file(1,n) could  be  opened,
            -1 otherwise.

       CDKsplitString
            splits  the given string(3,n) into strings based on the split(1,n) character
            in(1,8) splitChar, and returns a null-terminated list of  the  strings.
            The caller is responsible for freeing the result.

       baseName
            returns  a  pointer  to the first character of the filename in(1,8) the
            given pathname.

       char2Chtype
            takes a string(3,n) in(1,8) 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.  The caller is responsible for freeing the result.

       chlen
            returns the length of the chtype* given.

       chtype2Char
            takes  a  chtype*  string(3,n) and returns the equivalent char* string.
            The caller is responsible for freeing the result.

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

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

       copyChar
            copies the string(3,n) passed in.  Unlike strdup this checks to see  if(3,n)
            the string(3,n) is NULL before copying.

       copyChtype
            function  copies  the string(3,n) passed in(1,8), analogous to copyChar, but
            for chtype strings.

       freeChar
            is a wrapper for free.  It checks to see if(3,n)  the  string(3,n)  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(1,8)
            via the  list  parameter.   It  returns  the  index  in(1,8)  the  list
            selected, or -1 if(3,n) 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(1,8) or NULL if(3,n) 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(1,8) the file-mode  in(1,8)  the  fileMode
            parameter The string(3,n) parameter receives the permissions, formatted
            as if(3,n) by "ls -l").

       popupDialog
            creates a quick pop-up dialog(1,3,n) box.  Pass in(1,8)  the  message  in(1,8)  the
            mesg  parameter,  the size of the message in(1,8) the mesgCount parame-
            ter, the button labels in(1,8) the buttons parameter and the number  of
            buttons in(1,8) the buttonCount parameter.  The dialog(1,3,n) box will be cen-
            tered on the screen.

       popupLabel
            creates a quick pop-up label widget.  The message and the size  of
            the  message  are  passed  in(1,8)  via  the  mesg and count parameters
            respectively.  The label widget waits until the user hits a  char-
            acter and is centered on the screen.

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

       sortList
            performs  a  quick  sort(1,3)  of  the  given list.  The list is sorted
            alphabetically in(1,8) 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(1,n) supplied by the filename value.   The  buttons  on  the  file(1,n)
            viewer  are  supplied  by  the  buttons parameter.  It returns the
            index of the button selected, or -1 if(3,n) the file(1,n) does not exist  or
            if(3,n) 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)



                                                                   cdk_misc(3)

References for this manual (incoming links)