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 2005 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
28 /* All Rights Reserved */
31 #pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.10 */
32 /* EMACS_MODES: !fill, lnumb, !overwrite, !nodelete, !picture */
34 #include "sys/types.h"
45 ** putform() - WRITE FORM STRUCTURE TO DISK FILES
49 putform(char *name
, FORM
*formp
, FALERT
*alertp
, FILE **p_align_fp
)
58 if (!name
|| !*name
) {
63 if (STREQU(NAME_ALL
, name
)) {
69 * Create the parent directory for this form
70 * if it doesn't yet exist.
72 if (!(path
= getformfile(name
, (char *)0)))
74 if (Stat(path
, &statbuf
) == 0) {
75 if (!S_ISDIR(statbuf
.st_mode
)) {
80 } else if (errno
!= ENOENT
|| mkdir_lpdir(path
, MODE_DIR
) == -1) {
87 * Open the configuration file and write out the form
91 if (!(path
= getformfile(name
, DESCRIBE
)))
93 if ((fd
= open_locked(path
, "w", MODE_READ
)) < 0) {
99 if (wrform(name
, formp
, fd
, 0, (int *)0) == -1) {
107 * Write out the alert condition (?)
112 && putalert(Lp_A_Forms
, name
, alertp
) == -1
118 * Write out the alignment pattern (?)
120 if (p_align_fp
&& *p_align_fp
) {
128 if (!(path
= getformfile(name
, ALIGN_PTRN
)))
130 if ((fd
= open_locked(path
, "w", MODE_READ
)) < 0) {
135 while ((n
= fread(buf
, 1, BUFSIZ
, *p_align_fp
)) != 0) {