home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / vol_300 / 332_02 / stradd.c < prev    next >
C/C++ Source or Header  |  1990-01-06  |  3KB  |  85 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 (bl@infovox.se)    */
  10. /****************************************************************/
  11. /* 1.4:  Use of short wherever possible. Portability        */
  12. /*     improvements:                    900114    */
  13. /* 1.3:     MSC -W3, Turbo'C' -w -w-pro checkes:        881005    */
  14. /* 1.2:     Rcsid[] string for maintenance:        881002    */
  15. /* 1.0:     Release:                    870515    */
  16. /****************************************************************/
  17.  
  18. #include <curses.h>
  19. #include <curspriv.h>
  20.  
  21. char _curses_stradd_rcsid[] = "@(#)stradd.c     v.1.4  - 900114";
  22.  
  23. /****************************************************************/
  24. /* Waddstr() inserts string 'str' at the current cursor posi-    */
  25. /* tion in window 'win', and takes any actions as dictated by    */
  26. /* the characters.                        */
  27. /****************************************************************/
  28.  
  29. int    waddstr(win, str)
  30.   WINDOW    *win; 
  31.   char        *str;
  32.   {
  33.   while (*str)
  34.     {
  35.     if (waddch(win, *str++) == ERR)
  36.       return(ERR);
  37.     }
  38.   return(OK);
  39.   } /* waddstr */
  40.  
  41. /****************************************************************/
  42. /* Addstr() inserts string 'str' at the current cursor posi-    */
  43. /* tion in stdscr, and takes any actions as dictated by the    */
  44. /* characters.                            */
  45. /****************************************************************/
  46.  
  47. int addstr(str)
  48.   char     *str;
  49.   {
  50.   return (waddstr(stdscr,str));
  51.   } /* addstr */
  52.  
  53. /****************************************************************/
  54. /* Mvaddstr() move to a new position in stdscr, then inserts    */
  55. /* string 'str' at the new position, taking any actions as dic-    */
  56. /* tated by the characters.                    */
  57. /****************************************************************/
  58.  
  59. int mvaddstr(y,x,str)
  60.   int     y;
  61.   int     x;
  62.   char    *str;
  63.   {
  64.   if (wmove(stdscr,y,x) == ERR)
  65.     return (ERR);
  66.   return (waddstr(stdscr,str));
  67.   } /* mvaddstr */
  68.  
  69. /****************************************************************/
  70. /* Mvwaddstr() move to a new position in window 'win', then    */
  71. /* inserts string 'str' at the new position, taking any actions    */
  72. /* as dictated by the characters.                */
  73. /****************************************************************/
  74.  
  75. int mvwaddstr(win,y,x,str)
  76.   WINDOW *win;
  77.   int      y;
  78.   int      x;
  79.   char   *str;
  80.   {
  81.   if (wmove(win,y,x) == ERR)
  82.     return (ERR);
  83.   return (waddstr(win,str));
  84.   } /* mvwaddstr */
  85.