Debian Codegraph @

upstream/debian-unstable/man3/print.3ncurses

raw
1 .\"***************************************************************************
2 .\" Copyright 2018-2024,2025 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.41 2025/02/15 18:42:34 tom Exp $
31 .TH print 3NCURSES 2025-02-15 "ncurses 6.6" "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 .BR \%mcprint ","
43 an
44 .I \%ncurses
45 extension to the
46 .I curses
47 library,
48 uses the terminal's
49 .B \%prtr_non
50 .RB ( mc5p )
51 or
52 .B \%prtr_on
53 .RB ( mc5 )
54 and
55 .B \%prtr_off
56 .RB ( mc4 )
57 media copy capabilities,
58 if defined,
59 to send
60 .I len
61 bytes of the given string
62 .I data
63 to a printer attached to the terminal.
64 .PP
65 .B \%mcprint
66 has no means of flow control to the printer
67 nor of knowing how much buffering it has.
68 Your application is responsible
69 for keeping the rate of writes to the printer
70 below its continuous throughput rate,
71 typically about half of its nominal characters-per-second (cps) rating.
72 Dot-matrix printers and
73 6-page-per-minute laser printers can typically handle 80 cps,
74 so a conservative rule of thumb
75 is to sleep for one second after sending an 80-character line.
76 .SH RETURN VALUE
77 On success,
78 .B \%mcprint
79 returns the number of characters sent to the printer.
80 .PP
81 .B \%mcprint
82 returns
83 .B ERR
84 if the write operation fails for any reason.
85 In that event,
86 .B errno
87 contains either a value set by \fIwrite\fP(2),
88 or one of the following.
89 .TP 5
90 \fBENODEV\fP
91 The terminal lacks relevant media copy capabilities.
92 .TP 5
93 \fBENOMEM\fP
94 .I \%ncurses
95 could not allocate sufficient memory to buffer the write operation.
96 .SH EXTENSIONS
97 .B \%mcprint
98 is an \fB\%ncurses\fP(3NCURSES) extension,
99 and is not found in SVr4
100 .IR curses ","
101 4.4BSD
102 .IR curses ","
103 or any other previous
104 .I curses
105 implementation.
106 .SH PORTABILITY
107 Applications employing this
108 .I \%ncurses
109 extension should condition its use on the visibility of the
110 .B \%NCURSES_VERSION
111 preprocessor macro.
112 .SH HISTORY
113 .I \%ncurses
114 introduced
115 .I \%mcprint
116 prior to version 1.9.9g (1996).
117 .SH BUGS
118 Padding in the
119 .B \%prtr_non
120 .RB ( mc5p ),
121 .B \%prtr_on
122 .RB ( mc5 ),
123 and
124 .B \%prtr_off
125 .RB ( mc4 )
126 capabilities is not interpreted.
127 .SH SEE ALSO
128 \fB\%ncurses\fP(3NCURSES)