diff options
Diffstat (limited to 'utils/bencoding.c')
-rw-r--r-- | utils/bencoding.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/utils/bencoding.c b/utils/bencoding.c index ec5909d..ad6ded0 100644 --- a/utils/bencoding.c +++ b/utils/bencoding.c @@ -8,7 +8,7 @@ #define S0(x) (x ? x : "") int main (int argc, char ** argv) { if (argc < 1+1) - error_at_line(1, 0, __FILE__, __LINE__, "%s encode < json || %s decode < bencoding || %s path path/to/obj < bencoding || %s foreach < bencoding || %s val value < bencoding (should output null or value as JSON string if found in array) || %s insert bencoding [replace] < bencoding || %s compare bencoding < bencoding || %s encode < bencoding", S0(argv[0]), S0(argv[0]), S0(argv[0]), S0(argv[0]), S0(argv[0]), S0(argv[0]), S0(argv[0]), S0(argv[0])); + error_at_line(1, 0, __FILE__, __LINE__, "%s encode < json || %s decode < bencoding || %s path path/to/obj < bencoding || %s foreach < bencoding || %s val value < bencoding (should output null or value as JSON string if found in array) || %s insert bencoding [replace] < bencoding || %s compare bencoding < bencoding", S0(argv[0]), S0(argv[0]), S0(argv[0]), S0(argv[0]), S0(argv[0]), S0(argv[0]), S0(argv[0])); if (argv[1][0] == 'p' && argc != 1+2) error_at_line(1, 0, __FILE__, __LINE__, "set path!"); int size = 2048; @@ -29,7 +29,7 @@ int main (int argc, char ** argv) { *end = '\0'; puts(out); if (end - out != len) - error_at_line(4, 0, __FILE__, __LINE__, "b2json wrote %ld instead of %d bytes.", end-out, len); + error_at_line(4, 0, __FILE__, __LINE__, "b2json wrote %td instead of %d bytes.", end-out, len); fprintf(stderr, "len: %d\n", len); } if (argv[1][0] == 'p') { @@ -39,7 +39,7 @@ int main (int argc, char ** argv) { *end = '\0'; puts(out); if (end - out != len) - error_at_line(4, 0, __FILE__, __LINE__, "b2json wrote %ld instead of %d bytes.", end-out, len); + error_at_line(4, 0, __FILE__, __LINE__, "b2json wrote %td instead of %d bytes.", end-out, len); fprintf(stderr, "len: %d\n", len); } if (argv[1][0] == 'v') { @@ -49,24 +49,24 @@ int main (int argc, char ** argv) { *end = '\0'; puts(out); if (end - out != len) - error_at_line(4, 0, __FILE__, __LINE__, "b2json wrote %ld instead of %d bytes.", end-out, len); + error_at_line(4, 0, __FILE__, __LINE__, "b2json wrote %td instead of %d bytes.", end-out, len); fprintf(stderr, "len: %d\n", len); } if (argv[1][0] == 'f') { - bforeach (value, bencoding) { + bforeach (bencoding, value) { len = b2json_length(value->key); char out[len+1]; char * end = b2json(out, value->key); *end = '\0'; if (end - out != len) - error_at_line(4, 0, __FILE__, __LINE__, "b2json wrote %ld instead of %d bytes.", end-out, len); + error_at_line(4, 0, __FILE__, __LINE__, "b2json wrote %td instead of %d bytes.", end-out, len); printf("key(%d): %s\n", len, out); len = b2json_length(value); char out2[len+1]; end = b2json(out2, value); *end = '\0'; if (end - out2 != len) - error_at_line(4, 0, __FILE__, __LINE__, "b2json wrote %ld instead of %d bytes.", end-out2, len); + error_at_line(4, 0, __FILE__, __LINE__, "b2json wrote %td instead of %d bytes.", end-out2, len); printf("value(%d): %s\n", len, out2); } } @@ -85,7 +85,7 @@ int main (int argc, char ** argv) { *end = '\0'; puts(out); if (end - out != len) - error_at_line(4, 0, __FILE__, __LINE__, "b2json wrote %ld instead of %d bytes.", end-out, len); + error_at_line(4, 0, __FILE__, __LINE__, "b2json wrote %td instead of %d bytes.", end-out, len); fprintf(stderr, "len: %d\n", len); } if (argv[1][0] == 'c') { |