- added svn props for newly added files

git-svn-id: svn://svn.berlios.de/openocd/trunk@804 b42882b7-edfa-0310-969c-e2dbd0fdcd60
This commit is contained in:
ntfreak 2008-07-13 20:20:58 +00:00
parent 766b0ca8ac
commit 1edd0e6822
1 changed files with 30 additions and 30 deletions

View File

@ -1,30 +1,30 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
int int
main(int argc, char **argv) main(int argc, char **argv)
{ {
int c; int c;
unsigned int n; unsigned int n;
char *name; char *name;
if (argc == 1) { if (argc == 1) {
fprintf(stderr, "bin2char <varname>\n"); fprintf(stderr, "bin2char <varname>\n");
fprintf(stderr, "read from standard input and write a char" fprintf(stderr, "read from standard input and write a char"
" array out to standard output\n"); " array out to standard output\n");
exit(1); exit(1);
} }
n = 0; n = 0;
name = argv[1]; name = argv[1];
fprintf(stdout, "/* autogenerated from %s */\n", argv[0]); fprintf(stdout, "/* autogenerated from %s */\n", argv[0]);
fprintf(stdout, "unsigned const char %s[] = {\n", name); fprintf(stdout, "unsigned const char %s[] = {\n", name);
while ((c = getc(stdin)) != EOF) { while ((c = getc(stdin)) != EOF) {
fprintf(stdout, "0x%02x,", c & 0xff); fprintf(stdout, "0x%02x,", c & 0xff);
if ((++n % 16) == 0) if ((++n % 16) == 0)
fprintf(stdout, "\n"); fprintf(stdout, "\n");
} }
fprintf(stdout, "0 /* terminate with a nil */};\n"); fprintf(stdout, "0 /* terminate with a nil */};\n");
fprintf(stdout, "unsigned int %s_len = %u;\n", name, n); fprintf(stdout, "unsigned int %s_len = %u;\n", name, n);
return 0; return 0;
} }