*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->NetBSD man pages -> cdk_misc (3)              
Title
Content
Arch
Section
 

cdk_misc(3)

Contents


NAME    [Toc]    [Back]

          Cdk - Curses Development Kit Miscellaneous Routines

SYNOPSIS    [Toc]    [Back]

       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 char-
       acter);

       char *copyChar (char *string);

       chtype *copyChtype (chtype *string);

       void freeChar (char *string);

       void freeChtype (chtype *string);

       int getDirectoryContents (char  *directory,  char  **list,
       int maxListSize);

       int intlen (int value);

       int mode2Char (char *string, mode_t fileMode);

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

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

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

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

       int viewFile (CDKSCREEN *win, char *title, char *filename,
       char **buttons, 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    [Toc]    [Back]

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

AVAILABLE FUNCTIONS    [Toc]    [Back]

       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 filename 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  nullterminated
 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 justification 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 char-
       acter);
          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 maxListSize);
          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 directory
          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 mesg-
       Count, 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  centered
 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 parameters 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 listSize, 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 parameter, 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 *file-
       name, 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 element in the array starts with the given pat-
          tern.  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    [Toc]    [Back]

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

NOTES    [Toc]    [Back]

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

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



                           28 June 1996               cdk_misc(3)
[ Back ]
 Similar pages
Name OS Title
filter Tru64 Miscellaneous utility routines for Curses
curs_util FreeBSD miscellaneous curses utility routines
keyname FreeBSD miscellaneous curses utility routines
putwin OpenBSD miscellaneous curses utility routines
putwin FreeBSD miscellaneous curses utility routines
filter FreeBSD miscellaneous curses utility routines
use_env FreeBSD miscellaneous curses utility routines
delay_output FreeBSD miscellaneous curses utility routines
keyname Tru64 Miscellaneous utility routines for Curses
key_name Tru64 Miscellaneous utility routines for Curses
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service