unixdev.net


Switch to SpeakEasy.net DSL

The Modular Manual Browser

Home Page
Manual: (NetBSD-2.0)
Page:
Section:
Apropos / Subsearch:
optional field

cdk_misc(3)                Library Functions Manual                cdk_misc(3)



NAME
          Cdk - Curses Development Kit Miscellaneous Routines

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

       #include <cdk.h>

       void Beep();

       char * baseName (char *pathname);

       unsigned CDKcountStrings (char **list);

       void CDKfreeStrings (char **list);

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

       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  getDirectoryContents  (char  *directory, char **list, int maxList-
       Size);

       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  getListIndex  (CDKSCREEN *win, char *title, char **list, int list-
       Size, boolean numbers);

       char *getString (CDKSCREEN *win, char *title, char *label, char *initi-
       talValue);

       int  viewFile (CDKSCREEN *win, char *title, char *filename, char **but-
       tons, int buttonCount);

       void quickSort (char **,list, int left, int right);

       int readFile (char *filename, char **info, int maxlines);

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

       void stripWhiteSpace (EStripType stripType, char *string);

DESCRIPTION
       The functions provided in this manual page are miscellaneous  functions
       which may be required when using the Cdk widget set.


AVAILABLE FUNCTIONS
       void Beep();
          This function makes an audible beep. The difference between this one
          and the beep function in the curses library is this one flushes  the
          STDOUT stream.

       char *baseName (char *pathname);
          This  function returns a pointer to the first character of the file-
          name in the given pathname.

       unsigned CDKcountStrings (char **list);
          Return the number of strings in the given list.

       void CDKfreeStrings (char **list);
          Free the strings in the list, and the given list itself.

       char ** CDKsplitString (char *string, char splitChar);
          Split the given string into strings based on the split character  in
          splitChar.   The  return  value  is  a  null-terminated  list of the
          strings.

       chtype *char2Chtype (char *string, int *length, int *align);
          This function 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  justifica-
          tion information.

       int chlen (chtype *string);
          This function returns the length of the chtype * given.

       char *chtype2Char (chtype *string);
          This function takes a chtype * and returns the equivalent char *.

       void cleanChar (char *string, int length, char character);
          This function is analogous to bzero or memcopy. The length parameter
          states how many characters to write, and character is the  character
          which will be written.

       void cleanChtype (chtype *string, int length, chtype character);
          This function is analogous to bzero or memcopy. The length parameter
          states how many characters to write, and character is the  character
          which will be written.

       char *copyChar (char *string);
          This  function  copies the string passed in. It is safer than strdup
          because it checks to see if the string is NULL before  copying,  and
          it  forces  a NULL character on the end of the string after the copy
          is complete.

       chtype *copyChtype (chtype *string);
          This function copies the string passed in. It is safer  than  strdup
          because  it  checks to see if the string is NULL before copying, and
          it forces a NULL character on the end of the string after  the  copy
          is complete.

       void freeChar (char *string);
          This  function  is  safer  to use than free. It checks to see if the
          string is NULL before trying to free the string.

       void freeChtype (chtype *string);
          This function is safer to use than free. It checks  to  see  if  the
          string is NULL before trying to free the string.

       int  getDirectoryContents  (char  *directory, char **list, int maxList-
       Size);
          This function opens and reads the contents of the  given  directory.
          It  fills  the array list with the sorted contents of the directory,
          and the parameter maxListSize states how many entries the array  can
          hold.  This function returns the number of files read. If the direc-
          tory could not be opened then it returns a value of -1.

       int intlen (int value);
          This function returns the length of an integer value.

       int mode2Char (char *string, mode_t fileMode);
          This function takes the file-mode  in  the  fileMode  parameter  and
          returns  the  octal  equivalent. The string parameter is a character
          string of the permissions. (The string looks like the permissions of
          a file when the command ls -l has been run on the file.)

       int  popupDialog  (CDKSCREEN  *screen, char **mesg, int mesgCount, char
       **buttons, int buttonCount);
          This function 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 cen-
          tered on the screen.

       void popupLabel (CDKSCREEN *win, char **mesg, int count);
          This function creates a quick pop-up label widget. The  message  and
          the size of the message are passed in via the mesg and count parame-
          ters respectively.  The label widget will wait until the user hits a
          character and will be centered on the screen.

       int  getListIndex  (CDKSCREEN *win, char *title, char **list, int list-
       Size, boolean numbers);
          This function 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.

       char *getString (CDKSCREEN *screen,  char  *title,  char  *label,  char
       *initialValue);
          This  function  pops up an entry widget with a title supplied by the
          value of the title parameter, a label supplied by the label  parame-
          ter,  and  an  initial value supplied by the initialValue parameter.
          This returns a pointer to the value typed in or NULL if  the  widget
          was exited early.

       int  viewFile  (CDKSCREEN  *screen,  char  *title, char *filename, char
       **buttons, int buttonCount);
          This function pops up a viewer widget,  with  the  contents  of  the
          viewer  being  the  contents  of  the  file supplied by the filename
          value. The buttons on the file viewer are supplied  by  the  buttons
          parameter.  This  function  returns  the integer value of the button
          selected. This function returns -1 if the file does  not  exist,  or
          the widget was exited early.

       void quickSort (char **list, int left, int right);
          This function performs a quick sort of the given list. The list will
          be sorted alphabetically in increasing order.

       int readFile (char *filename, char **info, int maxlines);
          This function reads the contents of the given file  and  stores  the
          contents  in  the  info parameter. The maxlines parameter states how
          many lines can be stored in the info array.  This  function  returns
          the number of lines read if the file could be opened, -1 otherwise.

       int searchList (char **list, int listSize, char *pattern);
          This  function  searches the array list checking to see if each ele-
          ment in the array starts  with  the  given  pattern.  This  function
          returns the index of the first match or -1 if it can't find one.

       void stripWhiteSpace (EStripType stripType, char *string);
          This  function  strips  the  leading/trailing white space off of the
          given string. The parameter stripType takes the following values.

             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)

NOTES
       The  header  file  &lt&lt;cdk.h&gt&gt;  automatically  includes  the  header  files
       &lt&lt;curses.h&gt&gt;,  &lt&lt;stdlib.h&gt&gt;, &lt&lt;string.h&gt&gt;, &lt&lt;ctype.h&gt&gt;, &lt&lt;unistd.h&gt&gt;, &lt&lt;dirent.h&gt&gt;,
       &lt&lt;time.h&gt&gt;, &lt&lt;errno.h&gt&gt;, &lt&lt;pwd.h&gt&gt;, &lt&lt;grp.h&gt&gt;, &lt&lt;sys/stat.h&gt&gt;, and &lt&lt;sys/types.h&gt&gt;.
       The &lt&lt;curses.h&gt&gt; header file includes &lt&lt;stdio.h&gt&gt; and &lt&lt;unctrl.h&gt&gt;.

       If you have Ncurses installed on your machine add -DNCURSES to the com-
       pile line to include the Ncurses header files instead.



                                 28 June 1996                      cdk_misc(3)