home *** CD-ROM | disk | FTP | other *** search
/ Media Share 9 / MEDIASHARE_09.ISO / cprog / cursesp.zip / STRADD.C < prev    next >
C/C++ Source or Header  |  1991-12-02  |  3KB  |  83 lines

  1. /****************************************************************/
  2. /* Addstr() routines of the PCcurses package                    */
  3. /*                                                              */
  4. /****************************************************************/
  5. /* This version of curses is based on ncurses, a curses version */
  6. /* originally written by Pavel Curtis at Cornell University.    */
  7. /* I have made substantial changes to make it run on IBM PC's,  */
  8. /* and therefore consider myself free to make it public domain. */
  9. /*              Bjorn Larsson (...mcvax!enea!infovax!bl)        */
  10. /****************************************************************/
  11. /* 1.0: Release:                                        870515  */
  12. /* 1.2: Rcsid[] string for maintenance:                 881002  */
  13. /* 1.3: MSC -W3, Turbo'C' -w -w-pro checkes:            881005  */
  14. /****************************************************************/
  15.  
  16. #include <curses.h>
  17. #include <curspriv.h>
  18.  
  19. char _curses_stradd_rcsid[] = "@(#)stradd.c v1.3 - 881005";
  20.  
  21. /****************************************************************/
  22. /* Waddstr() inserts string 'str' at the current cursor posi-   */
  23. /* tion in window 'win', and takes any actions as dictated by   */
  24. /* the characters.                                              */
  25. /****************************************************************/
  26.  
  27. int     waddstr(win, str)
  28.   WINDOW        *win; 
  29.   char          *str;
  30.   {
  31.   while (*str)
  32.     {
  33.     if (waddch(win, *str++) == ERR)
  34.       return(ERR);
  35.     }
  36.   return(OK);
  37.   } /* waddstr */
  38.  
  39. /****************************************************************/
  40. /* Addstr() inserts string 'str' at the current cursor posi-    */
  41. /* tion in stdscr, and takes any actions as dictated by the     */
  42. /* characters.                                                  */
  43. /****************************************************************/
  44.  
  45. int addstr(str)
  46.   char   *str;
  47.   {
  48.   return (waddstr(stdscr,str));
  49.   } /* addstr */
  50.  
  51. /****************************************************************/
  52. /* Mvaddstr() move to a new position in stdscr, then inserts    */
  53. /* string 'str' at the new position, taking any actions as dic- */
  54. /* tated by the characters.                                     */
  55. /****************************************************************/
  56.  
  57. int mvaddstr(y,x,str)
  58.   int    y;
  59.   int    x;
  60.   char  *str;
  61.   {
  62.   if (wmove(stdscr,y,x) == ERR)
  63.     return (ERR);
  64.   return (waddstr(stdscr,str));
  65.   } /* mvaddstr */
  66.  
  67. /****************************************************************/
  68. /* Mvwaddstr() move to a new position in window 'win', then     */
  69. /* inserts string 'str' at the new position, taking any actions */
  70. /* as dictated by the characters.                               */
  71. /****************************************************************/
  72.  
  73. int mvwaddstr(win,y,x,str)
  74.   WINDOW *win;
  75.   int     y;
  76.   int     x;
  77.   char   *str;
  78.   {
  79.   if (wmove(win,y,x) == ERR)
  80.     return (ERR);
  81.   return (waddstr(win,str));
  82.   } /* mvwaddstr */
  83.