projects
/
kconfig-hardened-check.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
aa073c2
)
Add cmdline file parsing
author
Alexander Popov
<alex.popov@linux.com>
Mon, 28 Mar 2022 09:17:31 +0000
(12:17 +0300)
committer
Alexander Popov
<alex.popov@linux.com>
Sat, 28 May 2022 16:51:16 +0000
(19:51 +0300)
kconfig_hardened_check/__init__.py
patch
|
blob
|
history
diff --git
a/kconfig_hardened_check/__init__.py
b/kconfig_hardened_check/__init__.py
index 565503e2f5e77bc881e4972db90903cf25713ed5..bf7977d4579f2d015bd81cb3329737c36577af13 100644
(file)
--- a/
kconfig_hardened_check/__init__.py
+++ b/
kconfig_hardened_check/__init__.py
@@
-804,9
+804,20
@@
def parse_kconfig_file(parsed_options, fname):
def parse_cmdline_file(parsed_options, fname):
with open(fname, 'r') as f:
- print('FIXME! cmdline file:')
- for line in f.readlines():
- print(line)
+ line = f.readline()
+ opts = line.split()
+
+ line = f.readline()
+ if line:
+ sys.exit('[!] ERROR: more than one line in "{}"'.format(fname))
+
+ for opt in opts:
+ if '=' in opt:
+ name, value = opt.split('=', 1)
+ else:
+ name = opt
+ value = '' # '' is not None
+ parsed_options[name] = value
def main():