summaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
authorAnton Luka Šijanec <anton@sijanec.eu>2022-12-31 18:09:39 +0100
committerAnton Luka Šijanec <anton@sijanec.eu>2022-12-31 18:09:39 +0100
commitbe5631dff1f4f28636ba1b88e9d17034fe4551d0 (patch)
treec462139b9ab130579be5e7f14247fe069a9d4032 /utils
parentdns resolving for bootstrapping, dht.c compiles, but is untested (diff)
downloadtravnik-be5631dff1f4f28636ba1b88e9d17034fe4551d0.tar
travnik-be5631dff1f4f28636ba1b88e9d17034fe4551d0.tar.gz
travnik-be5631dff1f4f28636ba1b88e9d17034fe4551d0.tar.bz2
travnik-be5631dff1f4f28636ba1b88e9d17034fe4551d0.tar.lz
travnik-be5631dff1f4f28636ba1b88e9d17034fe4551d0.tar.xz
travnik-be5631dff1f4f28636ba1b88e9d17034fe4551d0.tar.zst
travnik-be5631dff1f4f28636ba1b88e9d17034fe4551d0.zip
Diffstat (limited to 'utils')
-rw-r--r--utils/bencoding.c16
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') {