blob: 3694beffcca163ddd5fe783930f5e9261c7e05c6 [file] [log] [blame]
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301.\"***************************************************************************
micky3879b9f5e72025-07-08 18:04:53 -04002.\" Copyright 2018-2023,2024 Thomas E. Dickey *
3.\" Copyright 1998-2010,2017 Free Software Foundation, Inc. *
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05304.\" *
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.\"
micky3879b9f5e72025-07-08 18:04:53 -040030.\" $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"
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053032.SH NAME
micky3879b9f5e72025-07-08 18:04:53 -040033\fB\%mcprint\fP \-
34write binary data to printer using \fIterminfo\fR capabilities
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053035.SH SYNOPSIS
micky3879b9f5e72025-07-08 18:04:53 -040036.nf
37\fB#include <curses.h>
38.PP
39\fBint mcprint(char *\fIdata\fP, int \fIlen\fP);
40.fi
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053041.SH DESCRIPTION
micky3879b9f5e72025-07-08 18:04:53 -040042This function uses the \fBmc5p\fP or \fBmc4\fP and \fBmc5\fP capabilities,
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053043if they are present, to ship given data to a printer attached to the terminal.
44.PP
micky3879b9f5e72025-07-08 18:04:53 -040045Note that the \fB\%mcprint\fP code has no way
46to do flow control with the printer
47or to know how much buffering it has.
48Your application is responsible for
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053049keeping the rate of writes to the printer below its continuous throughput rate
micky3879b9f5e72025-07-08 18:04:53 -040050(typically about half of its nominal cps rating).
51Dot-matrix printers and
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530526-page-per-minute lasers can typically handle 80cps, so a good conservative
53rule of thumb is to sleep for a second after shipping each 80-character line.
54.
55.SH RETURN VALUE
micky3879b9f5e72025-07-08 18:04:53 -040056The \fB\%mcprint\fP function returns \fBERR\fP if the write operation aborted
57for some reason.
58In this case, \fB\%errno\fP will contain either an error associated
59with \fBwrite\fP(2) or one of the following:
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053060.TP 5
micky3879b9f5e72025-07-08 18:04:53 -040061\fBENODEV\fP
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053062Capabilities for printer redirection do not exist.
63.TP 5
micky3879b9f5e72025-07-08 18:04:53 -040064\fBENOMEM\fP
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053065Couldn't allocate sufficient memory to buffer the printer write.
66.PP
micky3879b9f5e72025-07-08 18:04:53 -040067When \fB\%mcprint\fP succeeds, it returns the number of characters actually
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053068sent to the printer.
micky3879b9f5e72025-07-08 18:04:53 -040069.SH EXTENSIONS
70\fB\%mcprint\fP was designed for
71\fB\%ncurses\fP(3X),
72and was not found in SVr4
73.IR curses ,
744.4BSD
75.IR curses ,
76or any other previous curses implementation.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053077.SH PORTABILITY
micky3879b9f5e72025-07-08 18:04:53 -040078Applications employing this
79.I \%ncurses
80extension should condition its use on the visibility of the
81.B \%NCURSES_VERSION
82preprocessor macro.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053083.SH BUGS
micky3879b9f5e72025-07-08 18:04:53 -040084Padding in the
85\fBmc5p\fP,
86\fBmc4\fP, and
87\fBmc5\fP capabilities is not interpreted.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053088.SH SEE ALSO
micky3879b9f5e72025-07-08 18:04:53 -040089\fB\%curses\fP(3X)