]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - ncurses/tinfo/lib_print.c
ncurses 5.7 - patch 20090606
[ncurses.git] / ncurses / tinfo / lib_print.c
index 6f4666730cfd911d460d20838f92010855788f47..e5abd4de614533964c0b3c4e9d4b1a2e711f7c69 100644 (file)
 /****************************************************************************
  *  Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995               *
  *     and: Eric S. Raymond <esr@snark.thyrsus.com>                         *
+ *     and: Thomas E. Dickey                        1996-on                 *
+ *     and: Juergen Pfeifer                                                 *
  ****************************************************************************/
 
 #include <curses.priv.h>
 
-#include <term.h>
-
 #ifndef CUR
-#define CUR SP_TERMTYPE 
+#define CUR SP_TERMTYPE
 #endif
 
-MODULE_ID("$Id: lib_print.c,v 1.18 2009/05/10 00:48:29 tom Exp $")
+MODULE_ID("$Id: lib_print.c,v 1.19 2009/06/06 20:26:17 tom Exp $")
 
 NCURSES_EXPORT(int)
-mcprint(char *data, int len)
+NCURSES_SP_NAME(mcprint) (NCURSES_SP_DCLx char *data, int len)
 /* ship binary character data to the printer via mc4/mc5/mc5p */
 {
-#if NCURSES_SP_FUNCS
-    SCREEN *sp = CURRENT_SCREEN;
-#endif
     char *mybuf, *switchon;
     size_t onsize, offsize, res;
 
     errno = 0;
-    if (!cur_term || (!prtr_non && (!prtr_on || !prtr_off))) {
+    if (!HasTInfoTerminal(SP_PARM) || (!prtr_non && (!prtr_on || !prtr_off))) {
        errno = ENODEV;
        return (ERR);
     }
@@ -85,15 +82,24 @@ mcprint(char *data, int len)
      * data has actually been shipped to the terminal.  If the write(2)
      * operation is truly atomic we're protected from this.
      */
-    res = write(cur_term->Filedes, mybuf, onsize + len + offsize);
+    res = write(TerminalOf(SP_PARM)->Filedes, mybuf, onsize + len + offsize);
 
     /*
      * By giving up our scheduler slot here we increase the odds that the
      * kernel will ship the contiguous clist items from the last write
      * immediately.
      */
+#ifndef __MINGW32__
     (void) sleep(0);
-
+#endif
     free(mybuf);
     return (res);
 }
+
+#if NCURSES_SP_FUNCS && !defined(USE_TERM_DRIVER)
+NCURSES_EXPORT(int)
+mcprint(char *data, int len)
+{
+    return NCURSES_SP_NAME(mcprint) (CURRENT_SCREEN, data, len);
+}
+#endif