diff options
author | Martin Schanzenbach <mschanzenbach@posteo.de> | 2012-03-07 15:50:44 +0000 |
---|---|---|
committer | Martin Schanzenbach <mschanzenbach@posteo.de> | 2012-03-07 15:50:44 +0000 |
commit | 375e1b742172911b41b1dd04c8c4efdb65caf408 (patch) | |
tree | be457da2d75736d27bdaaa7f4707d50855fd56cf /src/gns/gnunet-gns.c | |
parent | ab0702f90884738babca7948eb5310f633c612bc (diff) | |
download | gnunet-375e1b742172911b41b1dd04c8c4efdb65caf408.tar.gz gnunet-375e1b742172911b41b1dd04c8c4efdb65caf408.zip |
-shortening in cli app (in progress)
Diffstat (limited to 'src/gns/gnunet-gns.c')
-rw-r--r-- | src/gns/gnunet-gns.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/gns/gnunet-gns.c b/src/gns/gnunet-gns.c index 3fdd8d29f..6a9241897 100644 --- a/src/gns/gnunet-gns.c +++ b/src/gns/gnunet-gns.c | |||
@@ -39,7 +39,7 @@ static struct GNUNET_GNS_Handle *gns; | |||
39 | /** | 39 | /** |
40 | * GNS name to shorten. (-s option) | 40 | * GNS name to shorten. (-s option) |
41 | */ | 41 | */ |
42 | static struct char *name; | 42 | static char *name; |
43 | 43 | ||
44 | /** | 44 | /** |
45 | * Task run on shutdown. Cleans up everything. | 45 | * Task run on shutdown. Cleans up everything. |
@@ -59,6 +59,12 @@ do_shutdown (void *cls, | |||
59 | } | 59 | } |
60 | 60 | ||
61 | 61 | ||
62 | static void | ||
63 | process_shorten_result(void* cls, const char* nlong, const char* nshort) | ||
64 | { | ||
65 | printf("%s shortened to %s\n", nlong, nshort); | ||
66 | } | ||
67 | |||
62 | /** | 68 | /** |
63 | * Main function that will be run. | 69 | * Main function that will be run. |
64 | * | 70 | * |
@@ -78,11 +84,13 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
78 | _("Failed to connect to GNS\n")); | 84 | _("Failed to connect to GNS\n")); |
79 | return; | 85 | return; |
80 | } | 86 | } |
81 | if (NULL == s) | 87 | |
88 | if (name != NULL) | ||
82 | { | 89 | { |
83 | GNUNET_SCHEDULER_add_now (&do_shutdown, NULL); | 90 | /** shorten name */ |
84 | return; | 91 | GNUNET_GNS_shorten(gns, name, &process_shorten_result, NULL); |
85 | } | 92 | } |
93 | |||
86 | // FIXME: do work here... | 94 | // FIXME: do work here... |
87 | GNUNET_SCHEDULER_add_now (&do_shutdown, NULL); | 95 | GNUNET_SCHEDULER_add_now (&do_shutdown, NULL); |
88 | } | 96 | } |
@@ -100,7 +108,7 @@ main (int argc, char *const *argv) | |||
100 | { | 108 | { |
101 | static const struct GNUNET_GETOPT_CommandLineOption options[] = { | 109 | static const struct GNUNET_GETOPT_CommandLineOption options[] = { |
102 | {'s', "shorten", NULL, | 110 | {'s', "shorten", NULL, |
103 | gettext_noop ("try to shorten a given GNS name"), 0, | 111 | gettext_noop ("try to shorten a given GNS name"), 1, |
104 | &GNUNET_GETOPT_set_string, &name}, | 112 | &GNUNET_GETOPT_set_string, &name}, |
105 | GNUNET_GETOPT_OPTION_END | 113 | GNUNET_GETOPT_OPTION_END |
106 | }; | 114 | }; |