]> ncurses.scripts.mit.edu Git - ncurses.git/blob - man/curs_print.3x
ncurses 6.4 - patch 20240414
[ncurses.git] / man / curs_print.3x
1 .\"***************************************************************************
2 .\" Copyright 2018-2023,2024 Thomas E. Dickey                                *
3 .\" Copyright 1998-2010,2017 Free Software Foundation, Inc.                  *
4 .\"                                                                          *
5 .\" Permission is hereby granted, free of charge, to any person obtaining a  *
6 .\" copy of this software and associated documentation files (the            *
7 .\" "Software"), to deal in the Software without restriction, including      *
8 .\" without limitation the rights to use, copy, modify, merge, publish,      *
9 .\" distribute, distribute with modifications, sublicense, and/or sell       *
10 .\" copies of the Software, and to permit persons to whom the Software is    *
11 .\" furnished to do so, subject to the following conditions:                 *
12 .\"                                                                          *
13 .\" The above copyright notice and this permission notice shall be included  *
14 .\" in all copies or substantial portions of the Software.                   *
15 .\"                                                                          *
16 .\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
17 .\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
18 .\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
19 .\" IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
20 .\" DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
21 .\" OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
22 .\" THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
23 .\"                                                                          *
24 .\" Except as contained in this notice, the name(s) of the above copyright   *
25 .\" holders shall not be used in advertising or otherwise to promote the     *
26 .\" sale, use or other dealings in this Software without prior written       *
27 .\" authorization.                                                           *
28 .\"***************************************************************************
29 .\"
30 .\" $Id: curs_print.3x,v 1.38 2024/03/16 15:35:01 tom Exp $
31 .TH curs_print 3X 2024-03-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls"
32 .SH NAME
33 \fB\%mcprint\fP \-
34 write binary data to printer using \fIterminfo\fR capabilities
35 .SH SYNOPSIS
36 .nf
37 \fB#include <curses.h>
38 .PP
39 \fBint mcprint(char *\fIdata\fP, int \fIlen\fP);
40 .fi
41 .SH DESCRIPTION
42 This function uses the \fBmc5p\fP or \fBmc4\fP and \fBmc5\fP capabilities,
43 if they are present, to ship given data to a printer attached to the terminal.
44 .PP
45 Note that the \fB\%mcprint\fP code has no way
46 to do flow control with the printer
47 or to know how much buffering it has.
48 Your application is responsible for
49 keeping the rate of writes to the printer below its continuous throughput rate
50 (typically about half of its nominal cps rating).
51 Dot-matrix printers and
52 6-page-per-minute lasers can typically handle 80cps, so a good conservative
53 rule of thumb is to sleep for a second after shipping each 80-character line.
54 .
55 .SH RETURN VALUE
56 The \fB\%mcprint\fP function returns \fBERR\fP if the write operation aborted
57 for some reason.
58 In this case, \fB\%errno\fP will contain either an error associated
59 with \fBwrite\fP(2) or one of the following:
60 .TP 5
61 \fBENODEV\fP
62 Capabilities for printer redirection do not exist.
63 .TP 5
64 \fBENOMEM\fP
65 Couldn't allocate sufficient memory to buffer the printer write.
66 .PP
67 When \fB\%mcprint\fP succeeds, it returns the number of characters actually
68 sent to the printer.
69 .SH EXTENSIONS
70 \fB\%mcprint\fP was designed for
71 \fB\%ncurses\fP(3X),
72 and was not found in SVr4
73 .IR curses ,
74 4.4BSD
75 .IR curses ,
76 or any other previous curses implementation.
77 .SH PORTABILITY
78 Applications employing this
79 .I \%ncurses
80 extension should condition its use on the visibility of the
81 .B \%NCURSES_VERSION
82 preprocessor macro.
83 .SH BUGS
84 Padding in the
85 \fBmc5p\fP,
86 \fBmc4\fP, and
87 \fBmc5\fP capabilities is not interpreted.
88 .SH SEE ALSO
89 \fB\%curses\fP(3X)