diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2015-05-02 00:19:09 +0200 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2015-05-02 00:19:09 +0200 |
commit | 56e847dae8f585254c6b336ea557bd75a0574711 (patch) | |
tree | 7e775ea62e06caa505e7ad017e17bbc0800d8ab3 /yamdrv/mcs2h.c | |
parent | 62ceba5818d888041adbd466e8c67a8104bcf4fa (diff) | |
parent | 67d85b3d5cf145a5bf0a1431d6052473b017daa9 (diff) |
Merge branch 'master' of git://git.linux-ax25.org/pub/scm/ralf/ax25-tools
Conflicts:
ax25/axspawn.c
Diffstat (limited to 'yamdrv/mcs2h.c')
-rw-r--r-- | yamdrv/mcs2h.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/yamdrv/mcs2h.c b/yamdrv/mcs2h.c index 6914965..bf1ae72 100644 --- a/yamdrv/mcs2h.c +++ b/yamdrv/mcs2h.c @@ -6,12 +6,12 @@ int in2hex(char *ptr) { char str[3]; int val; - + memcpy(str, ptr, 2); str[2] = '\0'; - + sscanf(str, "%x", &val); - + return val; } @@ -19,7 +19,7 @@ unsigned char swap(unsigned char c) { unsigned char r = 0; int i; - + for (i = 0 ; i < 8 ; i++) { r <<= 1; @@ -34,12 +34,12 @@ int in4hex(char *ptr) { char str[5]; int val; - + memcpy(str, ptr, 4); str[4] = '\0'; - + sscanf(str, "%x", &val); - + return val; } @@ -50,22 +50,22 @@ int main(int ac, char *av[]) time_t temps; FILE *fptr; char buf[256]; - + if (ac != 3) { fprintf(stderr, "format : mcs2h 1200|9600 filename\n"); return 1; } - + fptr = fopen(av[2], "r"); if (fptr == NULL) { fprintf(stderr, "file %s not found\n", av[2]); return 1; } - + time(&temps); - + printf( "/*\n" " *\n" " * File %s converted to h format by mcs2h\n" @@ -84,10 +84,10 @@ int main(int ac, char *av[]) nb = in2hex(buf+1); add = in4hex(buf+3); type = in2hex(buf+7); - + if (type != 0) continue; - + if (first) first = 0; else @@ -98,9 +98,9 @@ int main(int ac, char *av[]) printf("0x%02x%s", swap(in2hex(buf+9+i*2)), (i < (nb-1)) ? "," : ""); } } - + printf(" };\n"); - + fclose(fptr); return 0; } |