Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
ccan
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
mirror
ccan
Commits
374c57f7
Commit
374c57f7
authored
Jun 12, 2018
by
Rusty Russell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tools/configurator: support --var-file for outputting VAR=VAL format.
Signed-off-by:
Rusty Russell
<
rusty@rustcorp.com.au
>
parent
33a9e453
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
1 deletion
+24
-1
tools/configurator/configurator.c
tools/configurator/configurator.c
+24
-1
No files found.
tools/configurator/configurator.c
View file @
374c57f7
...
@@ -684,13 +684,14 @@ int main(int argc, const char *argv[])
...
@@ -684,13 +684,14 @@ int main(int argc, const char *argv[])
const
char
*
outflag
=
DEFAULT_OUTPUT_EXE_FLAG
;
const
char
*
outflag
=
DEFAULT_OUTPUT_EXE_FLAG
;
const
char
*
configurator_cc
=
NULL
;
const
char
*
configurator_cc
=
NULL
;
const
char
*
orig_cc
;
const
char
*
orig_cc
;
const
char
*
varfile
=
NULL
;
if
(
argc
>
0
)
if
(
argc
>
0
)
progname
=
argv
[
0
];
progname
=
argv
[
0
];
while
(
argc
>
1
)
{
while
(
argc
>
1
)
{
if
(
strcmp
(
argv
[
1
],
"--help"
)
==
0
)
{
if
(
strcmp
(
argv
[
1
],
"--help"
)
==
0
)
{
printf
(
"Usage: configurator [-v] [-O<outflag>] [--configurator-cc=<compiler-for-tests>] [<compiler> <flags>...]
\n
"
printf
(
"Usage: configurator [-v] [-
-var-file=<filename>] [-
O<outflag>] [--configurator-cc=<compiler-for-tests>] [<compiler> <flags>...]
\n
"
" <compiler> <flags> will have
\"
<outflag> <outfile> <infile.c>
\"
appended
\n
"
" <compiler> <flags> will have
\"
<outflag> <outfile> <infile.c>
\"
appended
\n
"
"Default: %s %s %s
\n
"
,
"Default: %s %s %s
\n
"
,
DEFAULT_COMPILER
,
DEFAULT_FLAGS
,
DEFAULT_COMPILER
,
DEFAULT_FLAGS
,
...
@@ -719,6 +720,10 @@ int main(int argc, const char *argv[])
...
@@ -719,6 +720,10 @@ int main(int argc, const char *argv[])
configurator_cc
=
argv
[
1
]
+
18
;
configurator_cc
=
argv
[
1
]
+
18
;
argc
--
;
argc
--
;
argv
++
;
argv
++
;
}
else
if
(
strncmp
(
argv
[
1
],
"--var-file="
,
11
)
==
0
)
{
varfile
=
argv
[
1
]
+
11
;
argc
--
;
argv
++
;
}
else
{
}
else
{
break
;
break
;
}
}
...
@@ -739,6 +744,24 @@ int main(int argc, const char *argv[])
...
@@ -739,6 +744,24 @@ int main(int argc, const char *argv[])
remove
(
OUTPUT_FILE
);
remove
(
OUTPUT_FILE
);
remove
(
INPUT_FILE
);
remove
(
INPUT_FILE
);
if
(
varfile
)
{
FILE
*
vars
;
if
(
strcmp
(
varfile
,
"-"
)
==
0
)
vars
=
stdout
;
else
{
vars
=
fopen
(
varfile
,
"a"
);
if
(
!
vars
)
c12r_err
(
2
,
"Could not open %s"
,
varfile
);
}
for
(
i
=
0
;
i
<
sizeof
(
tests
)
/
sizeof
(
tests
[
0
]);
i
++
)
fprintf
(
vars
,
"%s=%u
\n
"
,
tests
[
i
].
name
,
tests
[
i
].
answer
);
if
(
vars
!=
stdout
)
{
if
(
fclose
(
vars
)
!=
0
)
c12r_err
(
2
,
"Closing %s"
,
varfile
);
}
}
printf
(
"/* Generated by CCAN configurator */
\n
"
printf
(
"/* Generated by CCAN configurator */
\n
"
"#ifndef CCAN_CONFIG_H
\n
"
"#ifndef CCAN_CONFIG_H
\n
"
"#define CCAN_CONFIG_H
\n
"
);
"#define CCAN_CONFIG_H
\n
"
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment