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) 2001 by Sun Microsystems, Inc.
24 * All rights reserved.
27 #pragma ident "%Z%%M% %I% %E% SMI"
33 static uchar_t bitlocation
[8] = {1, 2, 4, 8, 0x10, 0x20, 0x40, 0x80};
36 * Create a bytemask to store the command line options.
39 set_options_mask(options
*msk
, char *str
)
42 (void) memset(msk
, 0, sizeof (*msk
));
43 for (i
= 0; str
[i
] != 0; i
++) {
44 add_option(msk
, str
[i
]);
49 add_option(options
*msk
, char option
)
54 /* put option into the correct bucket */
55 msk
->bitmap
[loc
>> 3] |= bitlocation
[loc
& 7];
59 * Compare the bytemask of the command line options used with
60 * acceptable options. If an invalid option is found use it as
64 compare_options_mask(options
*msk
, options
*specified
)
69 for (i
= 0; i
< 16; i
++) {
70 if (msk
->bitmap
[i
] == specified
->bitmap
[i
])
72 bmap
= msk
->bitmap
[i
] | specified
->bitmap
[i
];
73 bmap
^= msk
->bitmap
[i
];
78 /* no invalid options found */
82 for (j
= 0; j
< 8; j
++) {
83 if (bmap
& bitlocation
[j
])