diff options
author | Christian Grothoff <christian@grothoff.org> | 2012-03-05 10:34:20 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2012-03-05 10:34:20 +0000 |
commit | 67b1d5de1c51fa08c6136b94f4d06bd24e9e40fd (patch) | |
tree | d61cb67b5034bc299ef0257779dcd29a5c71717e /src/gns/gnunet-gns.c | |
parent | 0333d3afbc95ada40eabbac5e7cf02c598507a67 (diff) | |
download | gnunet-67b1d5de1c51fa08c6136b94f4d06bd24e9e40fd.tar.gz gnunet-67b1d5de1c51fa08c6136b94f4d06bd24e9e40fd.zip |
-parsing expiration and some option checking in gnunet-gns
Diffstat (limited to 'src/gns/gnunet-gns.c')
-rw-r--r-- | src/gns/gnunet-gns.c | 57 |
1 files changed, 55 insertions, 2 deletions
diff --git a/src/gns/gnunet-gns.c b/src/gns/gnunet-gns.c index 738c68788..e2fbb7509 100644 --- a/src/gns/gnunet-gns.c +++ b/src/gns/gnunet-gns.c | |||
@@ -127,6 +127,7 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
127 | size_t data_size; | 127 | size_t data_size; |
128 | struct in_addr value_a; | 128 | struct in_addr value_a; |
129 | struct in6_addr value_aaaa; | 129 | struct in6_addr value_aaaa; |
130 | struct GNUNET_TIME_Relative etime; | ||
130 | 131 | ||
131 | if (NULL == keyfile) | 132 | if (NULL == keyfile) |
132 | { | 133 | { |
@@ -138,6 +139,13 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
138 | zone_pkey = GNUNET_CRYPTO_rsa_key_create_from_file (keyfile); | 139 | zone_pkey = GNUNET_CRYPTO_rsa_key_create_from_file (keyfile); |
139 | GNUNET_free (keyfile); | 140 | GNUNET_free (keyfile); |
140 | keyfile = NULL; | 141 | keyfile = NULL; |
142 | if (! (add|del|list)) | ||
143 | { | ||
144 | /* nothing more to be done */ | ||
145 | GNUNET_CRYPTO_rsa_key_free (zone_pkey); | ||
146 | zone_pkey = NULL; | ||
147 | return; | ||
148 | } | ||
141 | if (NULL == zone_pkey) | 149 | if (NULL == zone_pkey) |
142 | { | 150 | { |
143 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 151 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
@@ -147,6 +155,7 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
147 | GNUNET_CRYPTO_rsa_key_get_public (zone_pkey, | 155 | GNUNET_CRYPTO_rsa_key_get_public (zone_pkey, |
148 | &pub); | 156 | &pub); |
149 | GNUNET_CRYPTO_hash (&pub, sizeof (pub), &zone); | 157 | GNUNET_CRYPTO_hash (&pub, sizeof (pub), &zone); |
158 | |||
150 | ns = GNUNET_NAMESTORE_connect (cfg); | 159 | ns = GNUNET_NAMESTORE_connect (cfg); |
151 | if (NULL == ns) | 160 | if (NULL == ns) |
152 | { | 161 | { |
@@ -164,6 +173,13 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
164 | fprintf (stderr, _("Unsupported type `%s'\n"), typestring); | 173 | fprintf (stderr, _("Unsupported type `%s'\n"), typestring); |
165 | GNUNET_SCHEDULER_shutdown (); | 174 | GNUNET_SCHEDULER_shutdown (); |
166 | return; | 175 | return; |
176 | } else if (add) | ||
177 | { | ||
178 | fprintf (stderr, | ||
179 | _("Missing option `%s' for operation `%s'\n"), | ||
180 | "-t", _("add")); | ||
181 | GNUNET_SCHEDULER_shutdown (); | ||
182 | return; | ||
167 | } | 183 | } |
168 | if (NULL != value) | 184 | if (NULL != value) |
169 | { | 185 | { |
@@ -232,9 +248,46 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
232 | default: | 248 | default: |
233 | GNUNET_assert (0); | 249 | GNUNET_assert (0); |
234 | } | 250 | } |
251 | } else if (add) | ||
252 | { | ||
253 | fprintf (stderr, | ||
254 | _("Missing option `%s' for operation `%s'\n"), | ||
255 | "-V", _("add")); | ||
256 | GNUNET_SCHEDULER_shutdown (); | ||
257 | return; | ||
258 | } | ||
259 | if (NULL != expirationstring) | ||
260 | { | ||
261 | if (GNUNET_OK != | ||
262 | GNUNET_STRINGS_fancy_time_to_relative (expirationstring, | ||
263 | &etime)) | ||
264 | { | ||
265 | fprintf (stderr, | ||
266 | _("Invalid time format `%s'\n"), | ||
267 | expirationstring); | ||
268 | GNUNET_SCHEDULER_shutdown (); | ||
269 | return; | ||
270 | } | ||
271 | } else if (add) | ||
272 | { | ||
273 | fprintf (stderr, | ||
274 | _("Missing option `%s' for operation `%s'\n"), | ||
275 | "-e", _("add")); | ||
276 | GNUNET_SCHEDULER_shutdown (); | ||
277 | return; | ||
278 | } | ||
279 | if (add) | ||
280 | { | ||
281 | // FIXME | ||
282 | } | ||
283 | if (del) | ||
284 | { | ||
285 | // FIXME | ||
286 | } | ||
287 | if (list) | ||
288 | { | ||
289 | // FIXME | ||
235 | } | 290 | } |
236 | |||
237 | |||
238 | } | 291 | } |
239 | 292 | ||
240 | 293 | ||