11 * See the License for the specific language governing permissions
12 * and limitations under the License.
13 *
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]
19 *
20 * CDDL HEADER END
21 */
22
23 /*
24 * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
25 * Use is subject to license terms.
26 */
27
28 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
29 /* All Rights Reserved */
30
31 #pragma ident "%Z%%M% %I% %E% SMI"
32
33
34 /*
35 * fmtmsg.c
36 *
37 * Contains:
38 * fmtmsg Command that writes a message in the standard
39 * message format. May in future make these
40 * messages available for logging.
41 */
42
43
44 /*
45 * Header files used:
46 * <stdio.h> C Standard I/O function definitions
47 * <string.h> C string-handling definitions
48 * <errno.h> UNIX error-code "errno" definitions
49 * <fmtmsg.h> Standard Message definitions
50 */
51
52 #include <stdio.h>
53 #include <string.h>
706 class_info++) ;
707
708 /* If found in list and no conflict, remember in class */
709 if ((class_info->keyword != (char *) NULL) && ((class & class_info->conflict) == 0L))
710 class |= class_info->value;
711 else
712 errflg = TRUE;
713
714 } while (!errflg && ((tokenptr = strtok((char *) NULL, ",")) != (char *) NULL)) ;
715
716 if (errflg) {
717 (void) snprintf(msgbuf, sizeof (msgbuf),
718 "Invalid subclass: %s", ustr);
719 (void) fmtmsg(CLASS, labelbuf, MM_ERROR, msgbuf,
720 MM_NULLACT, MM_NULLTAG);
721 exit(1);
722 }
723
724 }
725
726 if (!c_seen & !u_seen) class = MM_NULLMC;
727
728
729
730 /*
731 * Severity.
732 */
733
734 if (s_seen) {
735
736 /* If the severity is specified as a number, use that value */
737 severity = strtol(sstr, &p, 10);
738 if (*p || (strlen(sstr) == 0)) {
739
740 /* Look for the standard severities */
741 for (sev_info = severities ;
742 (sev_info->keyword != (char *) NULL) &&
743 (strcmp(sstr, sev_info->keyword)) ;
744 sev_info++) ;
745
746 /*
|
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
13 *
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]
19 *
20 * CDDL HEADER END
21 */
22
23 /*
24 * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
25 * Use is subject to license terms.
26 */
27
28 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
29 /* All Rights Reserved */
30
31 /*
32 * Copyright (c) 2018, Joyent, Inc.
33 */
34
35 /*
36 * fmtmsg.c
37 *
38 * Contains:
39 * fmtmsg Command that writes a message in the standard
40 * message format. May in future make these
41 * messages available for logging.
42 */
43
44
45 /*
46 * Header files used:
47 * <stdio.h> C Standard I/O function definitions
48 * <string.h> C string-handling definitions
49 * <errno.h> UNIX error-code "errno" definitions
50 * <fmtmsg.h> Standard Message definitions
51 */
52
53 #include <stdio.h>
54 #include <string.h>
707 class_info++) ;
708
709 /* If found in list and no conflict, remember in class */
710 if ((class_info->keyword != (char *) NULL) && ((class & class_info->conflict) == 0L))
711 class |= class_info->value;
712 else
713 errflg = TRUE;
714
715 } while (!errflg && ((tokenptr = strtok((char *) NULL, ",")) != (char *) NULL)) ;
716
717 if (errflg) {
718 (void) snprintf(msgbuf, sizeof (msgbuf),
719 "Invalid subclass: %s", ustr);
720 (void) fmtmsg(CLASS, labelbuf, MM_ERROR, msgbuf,
721 MM_NULLACT, MM_NULLTAG);
722 exit(1);
723 }
724
725 }
726
727 if (!c_seen && !u_seen) class = MM_NULLMC;
728
729
730
731 /*
732 * Severity.
733 */
734
735 if (s_seen) {
736
737 /* If the severity is specified as a number, use that value */
738 severity = strtol(sstr, &p, 10);
739 if (*p || (strlen(sstr) == 0)) {
740
741 /* Look for the standard severities */
742 for (sev_info = severities ;
743 (sev_info->keyword != (char *) NULL) &&
744 (strcmp(sstr, sev_info->keyword)) ;
745 sev_info++) ;
746
747 /*
|