]> ncurses.scripts.mit.edu Git - ncurses.git/blob - man/curs_scr_dump.3x
ncurses 6.3 - patch 20220212
[ncurses.git] / man / curs_scr_dump.3x
1 .\"***************************************************************************
2 .\" Copyright 2018-2021,2022 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_scr_dump.3x,v 1.20 2022/02/12 20:05:11 tom Exp $
31 .TH curs_scr_dump 3X ""
32 .ie \n(.g .ds `` \(lq
33 .el       .ds `` ``
34 .ie \n(.g .ds '' \(rq
35 .el       .ds '' ''
36 .de bP
37 .ie n  .IP \(bu 4
38 .el    .IP \(bu 2
39 ..
40 .na
41 .hy 0
42 .SH NAME
43 \fBscr_dump\fP,
44 \fBscr_restore\fP,
45 \fBscr_init\fP,
46 \fBscr_set\fP \- read (write) a \fBcurses\fP screen from (to) a file
47 .ad
48 .hy
49 .SH SYNOPSIS
50 \fB#include <curses.h>\fP
51 .sp
52 \fBint scr_dump(const char *\fIfilename\fB);\fR
53 .br
54 \fBint scr_restore(const char *\fIfilename\fB);\fR
55 .br
56 \fBint scr_init(const char *\fIfilename\fB);\fR
57 .br
58 \fBint scr_set(const char *\fIfilename\fB);\fR
59 .br
60 .SH DESCRIPTION
61 .SS scr_dump
62 .PP
63 The \fBscr_dump\fP routine dumps the current contents
64 of the \fIvirtual screen\fP
65 to the file \fIfilename\fP.
66 .SS scr_restore
67 .PP
68 The \fBscr_restore\fP routine sets the \fIvirtual screen\fP to the contents
69 of \fIfilename\fP, which must have been written using \fBscr_dump\fP.
70 The next call to \fBdoupdate\fP restores
71 the \fIphysical screen\fP to the way it looked in the dump file.
72 .SS scr_init
73 .PP
74 The \fBscr_init\fP routine reads in the contents of \fIfilename\fP and uses
75 them to initialize the \fBcurses\fP data structures about what the terminal
76 currently has on its screen.
77 If the data is determined to be valid,
78 \fBcurses\fP bases its next update of the screen on this information rather
79 than clearing the screen and starting from scratch.
80 \fBscr_init\fP is used
81 after \fBinitscr\fP(3X) or a \fBsystem\fP(3) call to share
82 the screen with another process which has done a \fBscr_dump\fP after its
83 \fBendwin\fP(3X) call.
84 The data is declared invalid
85 .bP
86 if the terminfo capabilities \fBrmcup\fP and \fBnrrmc\fP exist, also
87 .bP
88 if the terminal has been written to since the preceding \fBscr_dump\fP call.
89 .SS scr_set
90 .PP
91 The \fBscr_set\fP routine is a combination of \fBscr_restore\fP and
92 \fBscr_init\fP.  It tells the program that the information in \fIfilename\fP is
93 what is currently on the screen, and also what the program wants on the screen.
94 This can be thought of as a screen inheritance function.
95 .PP
96 To read (write) a window from (to) a file, use the \fBgetwin\fP and
97 \fBputwin\fP routines [see \fBcurs_util\fP(3X)].
98 .SH RETURN VALUE
99 All routines return the integer \fBERR\fP upon failure and \fBOK\fP
100 upon success.
101 .PP
102 X/Open defines no error conditions.
103 In this implementation,
104 each will return an error if the file cannot be opened.
105 .SH NOTES
106 Note that \fBscr_init\fP, \fBscr_set\fP, and \fBscr_restore\fP may be macros.
107 .SH PORTABILITY
108 The XSI Curses standard, Issue 4, describes these functions (adding the const
109 qualifiers).
110 .PP
111 The SVr4 docs merely say under \fBscr_init\fP that the dump data is also
112 considered invalid "if the time-stamp of the tty is old" but do not define
113 \*(``old\*(''.
114 .SH SEE ALSO
115 \fBcurses\fP(3X),
116 \fBcurs_initscr\fP(3X),
117 \fBcurs_refresh\fP(3X),
118 \fBcurs_util\fP(3X),
119 \fBscr_dump\fP(5),
120 \fBsystem\fP(3)