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 (c) 1984, 1986, 1987, 1988, 1989 AT&T */
24 /* All Rights Reserved */
28 * Copyright (c) 1997, by Sun Microsystems, Inc.
29 * All rights reserved.
37 #include <sys/types.h>
41 puthelp(FILE *fp
, char *defmesg
, char *help
)
48 /* use default message since no help was provided */
49 help
= defmesg
? defmesg
: "No help available.";
50 } else if (defmesg
!= NULL
) {
53 /* prepend default message */
54 tmp
= calloc(n
+strlen(defmesg
)+1, sizeof (char));
55 (void) strcpy(tmp
, defmesg
);
56 (void) strcat(tmp
, "\n");
58 (void) strcat(tmp
, help
);
60 } else if (n
&& (help
[n
-1] == '~')) {
61 /* append default message */
62 tmp
= calloc(n
+strlen(defmesg
)+2, sizeof (char));
63 (void) strcpy(tmp
, help
);
65 (void) strcat(tmp
, "\n");
66 (void) strcat(tmp
, defmesg
);
70 (void) puttext(fp
, help
, ckindent
, ckwidth
);
71 (void) fputc('\n', fp
);