Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
Sunxi Tools
Commits
e72443c0
Commit
e72443c0
authored
May 05, 2012
by
Alejandro Mery
Browse files
fex2bin: parse single word values and identify GPIO ones
parent
fa9811f8
Changes
1
Hide whitespace changes
Inline
Side-by-side
fex2bin.c
View file @
e72443c0
...
...
@@ -18,7 +18,9 @@
#include <ctype.h>
#include <errno.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX_LINE 255
...
...
@@ -108,9 +110,27 @@ static int parse_fex(FILE *in, const char *filename,
/* string */
p
++
;
*--
pe
=
'\0'
;
fprintf
(
stdout
,
"%s =
\"
%s
\"\n
"
,
key
,
p
);
}
else
{
errf
(
"I: key:%s value: %s (%zu)
\n
"
,
}
else
if
(
memcmp
(
"port:P"
,
p
,
6
)
==
0
)
{
/* GPIO */
p
+=
6
;
errf
(
"I: key:%s GPIO:%s (%zu)
\n
"
,
key
,
p
,
pe
-
p
);
}
else
if
(
isdigit
(
*
p
))
{
long
long
v
=
0
;
char
*
end
;
v
=
strtoll
(
p
,
&
end
,
0
);
if
(
end
!=
pe
)
{
errf
(
"E: %s:%zu: invalid character at %zu.
\n
"
,
filename
,
line
,
end
-
buffer
+
1
);
goto
parse_error
;
}
else
if
(
v
>
UINT32_MAX
)
{
errf
(
"E: %s:%zu: value out of range %lld.
\n
"
,
filename
,
line
,
v
);
}
fprintf
(
stdout
,
"%s = %llu
\n
"
,
key
,
v
);
}
else
{
errf
(
"E: %s:%zu: invalid character at %zu.
\n
"
,
filename
,
line
,
p
-
buffer
+
1
);
}
}
...
...
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