5 main(int argc
, char **argv
)
12 fprintf(stderr
, "bin2char <varname>\n");
13 fprintf(stderr
, "read from standard input and write a char"
14 " array out to standard output\n");
20 fprintf(stdout
, "/* autogenerated from %s */\n", argv
[0]);
21 fprintf(stdout
, "unsigned const char %s[] = {\n", name
);
22 while ((c
= getc(stdin
)) != EOF
) {
23 fprintf(stdout
, "0x%02x,", c
& 0xff);
25 fprintf(stdout
, "\n");
27 fprintf(stdout
, "0 /* terminate with a nil */};\n");
28 fprintf(stdout
, "unsigned int %s_len = %u;\n", name
, n
);