summaryrefslogtreecommitdiff
path: root/cfile.c
diff options
context:
space:
mode:
authorIan C <ianc@noddybox.co.uk>2020-03-13 15:12:58 +0000
committerIan C <ianc@noddybox.co.uk>2020-03-13 15:12:58 +0000
commit419d650776700eaddc1feb6a175bd8bcec08b1e5 (patch)
treeab484b126c083228dde1e29a8c4f31b549a0aed9 /cfile.c
parent2cfa27d5fc55d098860000e3f9cc22626dde5a99 (diff)
Fixes to cfile tools.
Diffstat (limited to 'cfile.c')
-rw-r--r--cfile.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/cfile.c b/cfile.c
index b06c1d8..72e0ebd 100644
--- a/cfile.c
+++ b/cfile.c
@@ -21,7 +21,7 @@ int main(int argc, char *argv[])
{
if (!(in=fopen(argv[1],"rb")))
{
- perror(argv[0]);
+ perror(argv[1]);
}
}
@@ -29,7 +29,7 @@ int main(int argc, char *argv[])
{
if (!(out=fopen(argv[2],"w")))
{
- perror(argv[0]);
+ perror(argv[2]);
}
}
@@ -54,10 +54,10 @@ int main(int argc, char *argv[])
first=1;
len=0;
+ fread(&num,sizeof(unsigned long),1,in);
+
while(!feof(in))
{
- fread(&num,sizeof(unsigned long),1,in);
-
if (col==0)
{
if (first)
@@ -75,11 +75,13 @@ int main(int argc, char *argv[])
fprintf(out,",");
}
- fprintf(out,"0x%.8x",num);
+ fprintf(out,"0x%.8lx",num);
col=(col+1)%4;
num=0;
len++;
+
+ fread(&num,sizeof(unsigned long),1,in);
}
fprintf(out,"\n\t\t\t};\n#define %s_LEN %d\n", name, len);