1scr_dump(5)                   File Formats Manual                  scr_dump(5)
2
3
4

NAME

6       scr_dump - format of curses screen-dumps.
7

SYNOPSIS

9       scr_dump
10

DESCRIPTION

12       The  curses library provides applications with the ability to write the
13       contents of a window to an external file using scr_dump or putwin,  and
14       read it back using scr_restore or getwin.
15
16       The  putwin  and  getwin  functions  do  the  work;  while scr_dump and
17       scr_restore conveniently save and restore the whole screen, i.e.,  std‐
18       scr.
19
20   ncurses6
21       A  longstanding implementation of screen-dump was revised with ncurses6
22       to remedy problems with the earlier approach:
23
24       ·   A “magic number” is written to the  beginning  of  the  dump  file,
25           allowing  applications  (such  as file(1)) to recognize curses dump
26           files.
27
28           Because ncurses6 uses a new format, that requires a new magic  num‐
29           ber  was  unused  by  other  applications.   This 16-bit number was
30           unused:
31
32               0x8888 (octal “\210\210”)
33
34           but to be more certain, this 32-bit number was chosen:
35
36               0x88888888 (octal “\210\210\210\210”)
37
38           This is the pattern submitted to the maintainers of the  file  pro‐
39           gram:
40
41               #
42               # ncurses5 (and before) did not use a magic number,
43               # making screen dumps "data".
44               #
45               # ncurses6 (2015) uses this format, ignoring byte-order
46               0    string    \210\210\210\210ncurses    ncurses6 screen image
47               #
48
49       ·   The screen dumps are written in textual form, so that internal data
50           sizes are not directly related to the dump-format, and enabling the
51           library  to  read dumps from either narrow- or wide-character- con‐
52           figurations.
53
54           The  narrow  library  configuration  holds  characters  and   video
55           attributes  in  a  32-bit  chtype, while the wide-character library
56           stores this information in the cchar_t  structure,  which  is  much
57           larger than 32-bits.
58
59       ·   It is possible to read a screen dump into a terminal with a differ‐
60           ent screen-size, because the library truncates or fills the  screen
61           as necessary.
62
63       ·   The ncurses6 getwin reads the legacy screen dumps from ncurses5.
64
65   ncurses5 (legacy)
66       The screen-dump feature was added to ncurses in June 1995.  While there
67       were fixes and improvements in succeeding years, the basic  scheme  was
68       unchanged:
69
70       ·   The WINDOW structure was written in binary form.
71
72       ·   The WINDOW structure refers to lines of data, which were written as
73           an array of binary data following the WINDOW.
74
75       ·   When getwin restored the window, it would  keep  track  of  offsets
76           into  the  array of line-data and adjust