4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright 1997 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 /* Copyright (c) 1988 AT&T */
28 /* All Rights Reserved */
31 * University Copyright- Copyright (c) 1982, 1986, 1988
32 * The Regents of the University of California
35 * University Acknowledgment- Portions of this document are derived from
36 * software developed by the University of California, Berkeley, and its
40 #pragma ident "%Z%%M% %I% %E% SMI"
44 #include "curses_inc.h"
45 #include <sys/types.h>
50 scr_ll_dump(FILE *filep
)
52 short magic
= SVR3_DUMP_MAGIC_NUMBER
, rv
= ERR
;
54 SLK_MAP
*slk
= SP
->slk
;
57 if (fwrite((char *) &magic
, sizeof (short), 1, filep
) != 1)
60 /* write term name and modification time */
61 if ((thistty
= ttyname(cur_term
->Filedes
)) == NULL
)
64 (void) stat(thistty
, &statbuf
);
66 if (fwrite((char *) &(statbuf
.st_mtime
), sizeof (time_t),
72 (void) force_doupdate();
73 if (putwin(curscr
, filep
) == ERR
)
76 /* next output: 0 no slk, 1 hardware slk, 2 simulated slk */
78 magic
= (!slk
) ? 0 : (slk
->_win
) ? 2 : 1;
79 if (fwrite((char *) &magic
, sizeof (int), 1, filep
) != 1)
82 short i
, labmax
= slk
->_num
, lablen
= slk
->_len
+ 1;
84 /* output the soft labels themselves */
85 if ((fwrite((char *) &labmax
,
86 sizeof (short), 1, filep
) != 1) ||
87 (fwrite((char *) &lablen
, sizeof (short),
91 for (i
= 0; i
< labmax
; i
++)
92 if ((fwrite(slk
->_ldis
[i
], sizeof (char), lablen
,
93 filep
) != lablen
) || (fwrite(slk
->_lval
[i
],
94 sizeof (char), lablen
, filep
) != lablen
)) {
99 /* now write information about colors. Use the following format. */
100 /* Line 1 is mandatory, the remaining lines are required only if */
102 /* line 1: 0 (no colors) or 1 (colors) */
103 /* line 2: number of colors, number of color pairs, can_change */
104 /* X lines: Contents of colors (r, g, b) */
105 /* Y lines: Contents of color-pairs */
107 magic
= ((cur_term
->_pairs_tbl
) ? 1 : 0);
108 if (fwrite((char *) &magic
, sizeof (int), 1, filep
) != 1)
111 /* number of colors and color_pairs */
112 if ((fwrite((char *) &COLORS
, sizeof (int), 1, filep
) != 1) ||
113 (fwrite((char *) &COLOR_PAIRS
, sizeof (int), 1, filep
) !=
114 1) || (fwrite((char *) &can_change
, sizeof (char), 1,
118 /* contents of color_table */
121 if (fwrite((char *) &(cur_term
->_color_tbl
->r
),
122 sizeof (_Color
), COLORS
, filep
) != COLORS
)
126 /* contents of pairs_table */
128 if (fwrite((char *) &(cur_term
->_pairs_tbl
->foreground
),
129 sizeof (_Color_pair
), COLOR_PAIRS
, filep
) != COLOR_PAIRS
)