forked from adesutherland/CMS-370-BREXX
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoptions.c
48 lines (44 loc) · 1.3 KB
/
options.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include <cmssys.h>
#include "lstring.h"
#include "options.h"
typedef struct OptList_st {
char *name;
long flags;
} OptList;
OptList optlist[] = {
{"STORAGE_DECIMAL", OPT_STORAGE_DECIMAL},
{NULL, OPT_NONE},
};
/* ----------------- ParseOptions ------------------ */
void __CDECL
ParseOptions(const PLstr value) {
char *val_ptr, *opt_ptr, *val_end;
int i, j, opt_no, in_opt;
long word_count, word_num;
Lstr word;
Context *context = (Context *) CMSGetPG();
LINITSTR(word);
(context->interpre_options) = 0UL;
opt_ptr = LSTR(*value);
opt_no = FALSE;
word_count = Lwords(value);
for (word_num = 1L; word_num <= word_count; word_num++) {
Lword(&word, value, word_num);
LASCIIZ(word);
opt_ptr = LSTR(word);
if (opt_no = (opt_ptr[0] == 'N' && opt_ptr[1] == 'O')) {
opt_ptr += 2;
}
for (j = 0; optlist[j].name != NULL; j++) {
if (strcmp(optlist[j].name, opt_ptr) == 0) {
if (opt_no) {
(context->interpre_options) &= (0xffffffffffffffffUL - optlist[j].flags);
} else {
(context->interpre_options) |= optlist[j].flags;
}
break;
}
}
}
LFREESTR(word);
} /* ParseOptions */