1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
|
.\"***************************************************************************
.\" Copyright 2018-2022,2023 Thomas E. Dickey *
.\" Copyright 1998-2010,2017 Free Software Foundation, Inc. *
.\" *
.\" Permission is hereby granted, free of charge, to any person obtaining a *
.\" copy of this software and associated documentation files (the *
.\" "Software"), to deal in the Software without restriction, including *
.\" without limitation the rights to use, copy, modify, merge, publish, *
.\" distribute, distribute with modifications, sublicense, and/or sell *
.\" copies of the Software, and to permit persons to whom the Software is *
.\" furnished to do so, subject to the following conditions: *
.\" *
.\" The above copyright notice and this permission notice shall be included *
.\" in all copies or substantial portions of the Software. *
.\" *
.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
.\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
.\" IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
.\" DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
.\" OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
.\" THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
.\" *
.\" Except as contained in this notice, the name(s) of the above copyright *
.\" holders shall not be used in advertising or otherwise to promote the *
.\" sale, use or other dealings in this Software without prior written *
.\" authorization. *
.\"***************************************************************************
.\"
.\" $Id: curs_scr_dump.3x,v 1.37 2023/12/30 21:34:11 tom Exp $
.TH scr_dump 3NCURSES 2023-12-30 "ncurses 6.4" "Library calls"
.ie \n(.g \{\
.ds `` \(lq
.ds '' \(rq
.\}
.el \{\
.ie t .ds `` ``
.el .ds `` ""
.ie t .ds '' ''
.el .ds '' ""
.\}
.
.de bP
.ie n .IP \(bu 4
.el .IP \(bu 2
..
.SH NAME
\fB\%scr_dump\fP,
\fB\%scr_restore\fP,
\fB\%scr_init\fP,
\fB\%scr_set\fP \-
read/write a \fIcurses\fR screen from/to a file
.SH SYNOPSIS
.nf
\fB#include <ncursesw/curses.h>
.PP
\fBint scr_dump(const char *\fIfilename\fP);
\fBint scr_restore(const char *\fIfilename\fP);
\fBint scr_init(const char *\fIfilename\fP);
\fBint scr_set(const char *\fIfilename\fP);
.fi
.SH DESCRIPTION
.I curses
provides applications the ability to write the contents of the screen
to a file and read them back.
To read/write a window
(rather than the whole screen)
from/to a file,
use \fB\%getwin\fP(3NCURSES) and
\fB\%putwin\fP(3NCURSES),
respectively.
.SS scr_dump
\fB\%scr_dump\fP writes to
.I filename
the contents of the virtual screen;
see \fB\%curscr\fP(3NCURSES).
.SS scr_restore
\fB\%scr_restore\fP updates the virtual screen to contain the contents
of
.I filename
(if it was validly written with \fB\%scr_dump\fP).
No refresh is performed;
after performing any further desired updates,
call \fB\%doupdate\fP(3NCURSES) or similar.
.SS scr_init
\fB\%scr_init\fP reads
.I filename,
using it to initialize
.I curses
data structures describing the state of the terminal screen.
If these data are valid,
.I curses
bases its next update of the screen on this information rather than
clearing it and starting from scratch.
.PP
The data fail the validity check
.bP
if the terminal employs
.I \%term\%info
capabilities
.B \%exit_ca_mode
.RB ( \%rmcup )
or
.B \%non_rev_rmcup
.RB ( \%nrrmc )
are defined,
or
.bP
if
.I curses
knows that the terminal has been written to since the preceding
\fB\%scr_dump\fP call.
.PP
\fB\%scr_init\fP could be used after \fB\%initscr\fP(3NCURSES) or
\fB\%system\fP(3) to share the screen with another process that has
done a \fBscr_dump\fP after \fB\%endwin\fP(3NCURSES).
.SS scr_set
The \fBscr_set\fP routine is a combination of \fBscr_restore\fP and
\fBscr_init\fP. It tells the program that the information in \fIfilename\fP is
what is currently on the screen, and also what the program wants on the screen.
This can be thought of as a screen inheritance function.
.SH RETURN VALUE
These functions return \fBOK\fP on success and \fBERR\fP on failure.
.PP
X/Open defines no failure conditions.
In this implementation,
each function fails if it cannot open
.I filename.
.SH NOTES
\fB\%scr_init\fP,
\fB\%scr_set\fP,
and
\fB\%scr_restore\fP may be macros.
.SH PORTABILITY
X/Open Curses, Issue 4, describes these functions.
.PP
.\" SVID 4, p. 529
SVr4 omitted the
.I \%const
qualifiers.
.PP
SVr4 documentation describes \fB\%scr_init\fP such that the dump data is
also considered invalid \*(``if the time-stamp of the tty is old\*(''
but does not define \*(``old\*(''.
.SH SEE ALSO
\fB\%ncurses\fP(3NCURSES),
\fB\%initscr\fP(3NCURSES),
\fB\%refresh\fP(3NCURSES),
\fB\%util\fP(3NCURSES),
\fB\%system\fP(3),
\fB\%scr_dump\fP(5)
|