diff options
author | Hao Zhang | 2011-06-27 13:16:08 -0500 |
---|---|---|
committer | Hao Zhang | 2011-06-27 13:16:08 -0500 |
commit | 14b791088556a658214f15c8395f6d90fcba1895 (patch) | |
tree | a68c0d8c145cf4af08c6fb7ed8efbba31f8f8e27 /hfile2array/hfile2array.c | |
parent | b108619ac5a024fe077894b57a00766dcd7a79f6 (diff) | |
download | mcsdk-tools-14b791088556a658214f15c8395f6d90fcba1895.tar.gz mcsdk-tools-14b791088556a658214f15c8395f6d90fcba1895.tar.xz mcsdk-tools-14b791088556a658214f15c8395f6d90fcba1895.zip |
Updates for 2.0.0.11 GA releaseDEV.BIOS.MCSDK.02.00.00.11
Diffstat (limited to 'hfile2array/hfile2array.c')
-rw-r--r-- | hfile2array/hfile2array.c | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/hfile2array/hfile2array.c b/hfile2array/hfile2array.c index 19e658d..a6d7a5b 100644 --- a/hfile2array/hfile2array.c +++ b/hfile2array/hfile2array.c | |||
@@ -43,8 +43,9 @@ | |||
43 | 43 | ||
44 | int main(int argc, char **argv) | 44 | int main(int argc, char **argv) |
45 | { | 45 | { |
46 | FILE *out, *in; | 46 | FILE *out, *in, *in_hdr; |
47 | char line[200] = "uint8_t "; | 47 | char line[200] = "uint8_t "; |
48 | char line_hdr[200]; | ||
48 | 49 | ||
49 | if (argc != 4) | 50 | if (argc != 4) |
50 | { | 51 | { |
@@ -68,12 +69,38 @@ int main(int argc, char **argv) | |||
68 | printf ("Can not open %s\n", *argv[1]); | 69 | printf ("Can not open %s\n", *argv[1]); |
69 | return (-1); | 70 | return (-1); |
70 | } | 71 | } |
72 | |||
73 | in_hdr = fopen("header.txt", "rt"); | ||
74 | |||
75 | if (in_hdr == NULL) | ||
76 | { | ||
77 | printf ("Can not open header.tx\n"); | ||
78 | return (-1); | ||
79 | } | ||
80 | |||
81 | while (1) | ||
82 | { | ||
83 | if (fgets(line_hdr, 200, in_hdr) != NULL) | ||
84 | { | ||
85 | if (fputs(line_hdr, out) != 0) | ||
86 | { | ||
87 | printf ("fputs %s error\n", line_hdr); | ||
88 | goto error; | ||
89 | } | ||
90 | } | ||
91 | else | ||
92 | { | ||
93 | /* EOF reached */ | ||
94 | break; | ||
95 | } | ||
96 | } | ||
97 | |||
71 | strcat (line, (const char *)(*argv++)); | 98 | strcat (line, (const char *)(*argv++)); |
72 | strcat (line, "[] = {\n"); | 99 | strcat (line, "[] = {\n"); |
73 | 100 | ||
74 | if (fputs(line, out) != 0) | 101 | if (fputs(line, out) != 0) |
75 | { | 102 | { |
76 | printf ("fputs %s error\n", fputs); | 103 | printf ("fputs %s error\n", line); |
77 | goto error; | 104 | goto error; |
78 | } | 105 | } |
79 | 106 | ||
@@ -101,12 +128,14 @@ int main(int argc, char **argv) | |||
101 | } | 128 | } |
102 | 129 | ||
103 | fclose(in); | 130 | fclose(in); |
131 | fclose(in_hdr); | ||
104 | fclose(out); | 132 | fclose(out); |
105 | 133 | ||
106 | return 0; | 134 | return 0; |
107 | 135 | ||
108 | error: | 136 | error: |
109 | fclose(in); | 137 | fclose(in); |
138 | fclose(in_hdr); | ||
110 | fclose(out); | 139 | fclose(out); |
111 | 140 | ||
112 | return (-1); | 141 | return (-1); |