13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22 /*
23 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 */
26
27 /*
28 * Copyright 1985, 1993 by Mortice Kern Systems Inc. All rights reserved.
29 *
30 */
31
32 /*
33 * getconf -- POSIX.2 compatible utility to query configuration specific
34 * parameters.
35 * -- XPG4 support added June/93
36 *
37 * -- XPG5 support added Dec/97
38 *
39 * -- XPG6 support added May/2003
40 */
41
42 #include <stdio.h>
43 #include <stdlib.h>
44 #include <string.h>
45 #include <errno.h>
46 #include <unistd.h>
47 #include <limits.h>
48 #include <locale.h>
49 #include <libintl.h>
50 #include <assert.h>
51
52 extern size_t confstr(int, char *, size_t);
919 */
920 break;
921 case '?':
922 return (usage());
923 }
924 argc -= optind-1;
925 argv += optind-1;
926
927 if ((aflag && argc >= 2) || (!aflag && argc < 2))
928 return (usage());
929 if (aflag) {
930
931 #define TabStop 8
932 #define RightColumn 32
933 #define DefPathName "."
934
935 /*
936 * sort the table by the "name" field
937 * so we print it in sorted order
938 */
939 qsort(&sctab[0], (sizeof (sctab)/sizeof (struct sctab))-1,
940 sizeof (struct sctab), namecmp);
941
942 /*
943 * print all the known symbols and their values
944 */
945 for (scp = &sctab[0]; scp->name != NULL; ++scp) {
946 int stat;
947
948 /*
949 * create 2 columns:
950 * variable name in the left column,
951 * value in the right column.
952 * The right column starts at a tab stop.
953 */
954 (void) printf("%s:\t", scp->name);
955
956 c = strlen(scp->name) + 1;
957 c = (c+TabStop) / TabStop, c *= TabStop;
958 for (; c < RightColumn; c += TabStop)
959 (void) putchar('\t');
|
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22 /*
23 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 */
26
27 /*
28 * Copyright 1985, 1993 by Mortice Kern Systems Inc. All rights reserved.
29 *
30 */
31
32 /*
33 * Copyright (c) 2018, Joyent, Inc.
34 */
35
36 /*
37 * getconf -- POSIX.2 compatible utility to query configuration specific
38 * parameters.
39 * -- XPG4 support added June/93
40 *
41 * -- XPG5 support added Dec/97
42 *
43 * -- XPG6 support added May/2003
44 */
45
46 #include <stdio.h>
47 #include <stdlib.h>
48 #include <string.h>
49 #include <errno.h>
50 #include <unistd.h>
51 #include <limits.h>
52 #include <locale.h>
53 #include <libintl.h>
54 #include <assert.h>
55
56 extern size_t confstr(int, char *, size_t);
923 */
924 break;
925 case '?':
926 return (usage());
927 }
928 argc -= optind-1;
929 argv += optind-1;
930
931 if ((aflag && argc >= 2) || (!aflag && argc < 2))
932 return (usage());
933 if (aflag) {
934
935 #define TabStop 8
936 #define RightColumn 32
937 #define DefPathName "."
938
939 /*
940 * sort the table by the "name" field
941 * so we print it in sorted order
942 */
943 qsort(&sctab[0], (sizeof (sctab) /
944 sizeof (struct sctab)) - 1,
945 sizeof (struct sctab), namecmp);
946
947 /*
948 * print all the known symbols and their values
949 */
950 for (scp = &sctab[0]; scp->name != NULL; ++scp) {
951 int stat;
952
953 /*
954 * create 2 columns:
955 * variable name in the left column,
956 * value in the right column.
957 * The right column starts at a tab stop.
958 */
959 (void) printf("%s:\t", scp->name);
960
961 c = strlen(scp->name) + 1;
962 c = (c+TabStop) / TabStop, c *= TabStop;
963 for (; c < RightColumn; c += TabStop)
964 (void) putchar('\t');
|