source: roaraudio/roarclients/roarctl.c @ 1202:f3d8bc61c7d3

Last change on this file since 1202:f3d8bc61c7d3 was 1202:f3d8bc61c7d3, checked in by phi, 15 years ago

added sleep command

File size: 18.8 KB
Line 
1//roarctl.c:
2
3/*
4 *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2008
5 *
6 *  This file is part of roarclients a part of RoarAudio,
7 *  a cross-platform sound system for both, home and professional use.
8 *  See README for details.
9 *
10 *  This file is free software; you can redistribute it and/or modify
11 *  it under the terms of the GNU General Public License version 3
12 *  as published by the Free Software Foundation.
13 *
14 *  RoarAudio is distributed in the hope that it will be useful,
15 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
16 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 *  GNU General Public License for more details.
18 *
19 *  You should have received a copy of the GNU General Public License
20 *  along with this software; see the file COPYING.  If not, write to
21 *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
22 *
23 */
24
25#include <roaraudio.h>
26#include <pwd.h>
27#include <grp.h>
28
29int g_verbose = 0;
30
31int display_mixer (struct roar_connection * con, int stream);
32int show_meta_all (struct roar_connection * con, int id);
33
34void usage (void) {
35 printf("roarctl [OPTIONS]... COMMAND [OPTS] [COMMAND [OPTS] [COMMAND [OPTS] [...]]]\n");
36
37 printf("\nOptions:\n\n");
38
39 printf("  --server SERVER         - Set server hostname\n"
40        "  --help                  - Show this help\n"
41        "  --verbose   -v          - Show verbose output\n"
42       );
43
44 printf("\nCommands:\n\n");
45 printf(
46        "  help                    - Show this help\n"
47        "\n"
48        "  standby, off            - Go into standby mode\n"
49        "  resume, on              - Go into active mode\n"
50        "  standbymode             - Show current standby mode\n"
51        "  exit                    - Quits the roard (must be used as last command)\n"
52        "  terminate               - Like exit but let the server up to serve still connected clients,\n"
53        "                            new clients cann't connect and the server terminates after the last\n"
54        "                            client disconnected\n"
55        "\n"
56        "  volume ID CHAN V0 V1... - Sets volume for stream ID\n"
57        "                            CHAN is the number of channels or 'mono' or 'stereo'\n"
58        "                            if mono or stereo is chosen roarctl trys to set\n"
59        "                            sensfull values for all channels even if the output\n"
60        "                            is has more channels.\n"
61        "                            all other args are the volumes of the channels\n"
62        "                            you may use integer or percent values.\n"
63        "                            percent values can flooding points.\n"
64        "\n"
65        "  flag   ID FLAGS         - Sets flags FLAGS on stream ID. FLAGS may be a comma\n"
66        "                            seperated list of flags.\n"
67        "  unflag ID FLAGS         - Unsets flags on a stream. See flag.\n"
68        "\n"
69        "  kick TYPE ID            - Kicks object of TYPE with id ID\n"
70        "                            Types: client stream sample source\n"
71        "\n"
72        "  metasave ID FILE        - Saves meta data of stream ID to file FILE\n"
73        "  metaload ID FILE        - Loads meta data from file FILE and set it on stream ID\n"
74        "\n"
75        "  serveroinfo             - Gets Informations about server output\n"
76        "  listclients             - Gets Informations about clients\n"
77        "  liststreams             - Gets Informations about streams\n"
78        "  allinfo                 - Get all infos\n"
79       );
80}
81
82void server_oinfo (struct roar_connection * con) {
83 struct roar_stream s;
84
85 if ( roar_server_oinfo(con, &s) == -1 ) {
86  fprintf(stderr, "Error: can not get server output info\n");
87  return;
88 }
89
90 printf("Stream direction      : %s\n", roar_dir2str(s.dir));
91 printf("Server Output rate    : %i\n", s.info.rate);
92 printf("Server Output bits    : %i\n", s.info.bits);
93 printf("Server Output channels: %i\n", s.info.channels);
94 printf("Server Output codec   : %i (%s%s)\n", s.info.codec, roar_codec2str(s.info.codec),
95                                     s.info.codec == ROAR_CODEC_DEFAULT ? " native" : "");
96// printf("Server Output rate: %i", s.info.rate);
97  if ( g_verbose > 1 )
98   printf("Server Position       : %lu S (%.3fs)\n", (unsigned long int) s.pos, (float)s.pos/(s.info.rate*s.info.channels));
99}
100
101const char * proc_name (pid_t pid) {
102 static char ret[80] = "?";
103#ifdef __linux__
104 char file[80], buf[80], *r;
105 int  i;
106
107 snprintf(file, 79, "/proc/%i/exe", pid);
108 file[79] = 0;
109
110 ret[0] = '?';
111 ret[1] = 0;
112
113 if ( (i = readlink(file, buf, 79)) != -1 ) {
114  buf[i] = 0;
115  if ( (r = strrchr(buf, '/')) != NULL ) {
116   r++;
117   if ( *r != 0 )
118    strcpy(ret, r);
119  }
120 }
121#endif
122
123 return ret;
124}
125
126void list_clients (struct roar_connection * con) {
127 int i;
128 int num;
129 int h;
130 int id[ROAR_CLIENTS_MAX];
131 struct roar_client c;
132 struct group  * grp = NULL;
133 struct passwd * pwd = NULL;
134
135 if ( (num = roar_list_clients(con, id, ROAR_CLIENTS_MAX)) == -1 ) {
136  fprintf(stderr, "Error: can not get client list\n");
137  return;
138 }
139
140 for (i = 0; i < num; i++) {
141  printf("client %i:\n", id[i]);
142  if ( roar_get_client(con, &c, id[i]) == -1 ) {
143   fprintf(stderr, "Error: can not get client info\n");
144   continue;
145  }
146  printf("Player name           : %s\n", c.name);
147  printf("Player PID            : %i(%s)\n", c.pid, proc_name(c.pid));
148  if ( c.uid != -1 ) {
149   pwd = getpwuid(c.uid);
150   grp = getgrgid(c.gid);
151   printf("Player UID/GID        : %i(%s)/%i(%s)\n", c.uid, pwd ? pwd->pw_name : "?", c.gid, grp ? grp->gr_name : "?");
152  }
153  if ( c.execed != -1 )
154   printf("Execed stream         : %i\n", c.execed);
155
156  for (h = 0; h < ROAR_CLIENTS_MAX_STREAMS_PER_CLIENT; h++)
157   if ( c.streams[h] != -1 )
158    printf("stream                : %i\n", c.streams[h]);
159 }
160
161}
162
163void list_streams (struct roar_connection * con) {
164 int i;
165 int num;
166 int id[ROAR_STREAMS_MAX];
167 struct roar_stream s;
168 struct roar_stream_info info;
169 char flags[80];
170
171
172 if ( (num = roar_list_streams(con, id, ROAR_STREAMS_MAX)) == -1 ) {
173  fprintf(stderr, "Error: can not get stream list\n");
174  return;
175 }
176
177 for (i = 0; i < num; i++) {
178  printf("stream %i:\n", id[i]);
179  if ( roar_get_stream(con, &s, id[i]) == -1 ) {
180   fprintf(stderr, "Error: can not get stream info\n");
181   continue;
182  }
183  printf("Stream direction      : %s\n", roar_dir2str(s.dir));
184  if ( s.pos_rel_id == -1 ) {
185   printf("Relativ position id   : none (stream not synchronized)\n");
186  } else if ( s.pos_rel_id == id[i] ) {
187   printf("Relativ position id   : %i (self synchronized)\n", s.pos_rel_id);
188  } else {
189   printf("Relativ position id   : %i (synchronized)\n", s.pos_rel_id);
190  }
191  if ( g_verbose > 1 )
192   printf("Position              : %lu S (%.3fs)\n", (unsigned long int) s.pos, (float)s.pos/(s.info.rate*s.info.channels));
193  printf("Input rate            : %i\n", s.info.rate);
194  printf("Input bits            : %i\n", s.info.bits);
195  printf("Input channels        : %i\n", s.info.channels);
196  printf("Input codec           : %2i (%s%s)\n", s.info.codec, roar_codec2str(s.info.codec),
197                                       s.info.codec == ROAR_CODEC_DEFAULT ? " native" : "");
198  if ( roar_stream_get_info(con, &s, &info) != -1 ) {
199   printf("Input codec (streamed): %2i (%s%s)\n", info.codec, roar_codec2str(info.codec),
200                                      info.codec == ROAR_CODEC_DEFAULT ? " native" : "");
201   if ( g_verbose ) {
202    printf("Input block size      : %i Byte\n", info.block_size);
203    printf("Underruns pre/post    : %i/%i\n",   info.pre_underruns, info.post_underruns);
204    if ( g_verbose > 1 )
205     printf("Stream delay          : %ims\n",   (int)info.delay/1000);
206
207    *flags = 0;
208    if ( info.flags & ROAR_FLAG_PRIMARY )
209     strcat(flags, "primary ");
210    if ( info.flags & ROAR_FLAG_SYNC )
211     strcat(flags, "sync ");
212    if ( info.flags & ROAR_FLAG_OUTPUT )
213     strcat(flags, "output ");
214    if ( info.flags & ROAR_FLAG_SOURCE )
215     strcat(flags, "source ");
216    if ( info.flags & ROAR_FLAG_META )
217     strcat(flags, "meta ");
218
219    printf("Flags                 : %s\n", flags);
220   }
221  }
222  display_mixer(con, id[i]);
223  show_meta_all(con, id[i]);
224 }
225
226}
227
228int display_mixer (struct roar_connection * con, int stream) {
229 int channels;
230 struct roar_mixer_settings mixer;
231 int i;
232
233 if ( roar_get_vol(con, stream, &mixer, &channels) == -1 ) {
234  fprintf(stderr, "Error: can not get stream mixer info\n");
235  return -1;
236 }
237
238 for (i = 0; i < channels; i++)
239  printf("Mixer volume chan %2i  : %i (%.2f%%)\n", i, mixer.mixer[i], (float)mixer.mixer[i]/655.35);
240
241 return 0;
242}
243
244int set_mixer (struct roar_connection * con, int * cur, int max, char * arg[]) {
245 int chans = 0;
246 int id;
247 int i;
248 int len;
249 int old_chans;
250 int vol_l, vol_r;
251 char * k;
252 struct roar_mixer_settings mixer;
253 struct roar_mixer_settings old_mixer;
254
255 if (*cur + 2 > max)
256  return -1;
257
258 id = atoi(arg[++(*cur)]);
259
260 k = arg[++(*cur)];
261
262 if ( roar_get_vol(con, id, &old_mixer, &old_chans) == -1 ) {
263  fprintf(stderr, "Error: can not get stream mixer info\n");
264  return -1;
265 }
266
267
268 if ( strcmp(k, "mono") == 0 && old_chans != 1 ) {
269  chans = 1;
270
271  if ( *cur + 1 > max )
272   return -1;
273
274  k   = arg[++(*cur)];
275  len = strlen(k);
276
277  if ( k[len - 1] == '%' ) {
278   k[len - 1] = 0;
279   vol_l = (atof(k)*65535)/100;
280  } else {
281   vol_l = atoi(k);
282  }
283
284  for (i = 0; i < old_chans; i++)
285   mixer.mixer[i] = vol_l;
286
287  chans = old_chans;
288
289 } else if ( strcmp(k, "stereo") == 0 && old_chans != 2 ) {
290  chans = 2;
291//  printf("mode: stereo; chans=%i, old_chans=%i\n", chans, old_chans);
292  ROAR_ERR("mode stereo not supported");
293  return -1;
294 } else {
295  if ( strcmp(k, "mono") == 0 ) {
296   chans = 1;
297  } else if ( strcmp(k, "stereo") == 0 ) {
298   chans = 2;
299  } else {
300   chans = atoi(k);
301  }
302
303//  printf("mode: int; chans=%i, old_chans=%i\n", chans, old_chans);
304
305  if ( *cur + chans > max )
306   return -1;
307
308  for (i = 0; i < chans; i++) {
309   k   = arg[++(*cur)];
310   len = strlen(k);
311
312   if ( k[len - 1] == '%' ) {
313    k[len - 1] = 0;
314    mixer.mixer[i] = (atof(k)*(int)65535)/100;
315   } else {
316    mixer.mixer[i] = atoi(k);
317   }
318  }
319 }
320
321 mixer.scale = 65535;
322
323 return roar_set_vol(con, id, &mixer, chans);
324}
325
326int set_meta (struct roar_connection * con, int id, char * mode, char * type, char * val) {
327 struct roar_meta   meta;
328 struct roar_stream s;
329 int mode_i = ROAR_META_MODE_SET;
330
331 memset(&s, 0, sizeof(s));
332
333 s.id = id;
334
335// printf("set_meta(*): mode='%s', type='%s', val='%s'\n", mode, type, val);
336
337 if ( strcmp(mode, "add") == 0 ) {
338  mode_i = ROAR_META_MODE_ADD;
339 }
340
341 meta.type   = roar_meta_inttype(type);
342 meta.value  = val;
343 meta.key[0] = 0;
344
345 if ( meta.type == -1 ) {
346  fprintf(stderr, "Error: unknown type: %s\n", type);
347  return -1;
348 }
349
350// printf("D: type=%i, mode=%i\n", meta.type, mode_i);
351
352 if ( roar_stream_meta_set(con, &s, mode_i, &meta) == -1 )
353  return -1;
354
355 meta.type  = ROAR_META_TYPE_NONE;
356 meta.value = NULL;
357
358 return roar_stream_meta_set(con, &s, ROAR_META_MODE_FINALIZE, &meta);
359}
360
361int load_meta (struct roar_connection * con, int id, char * file) {
362 struct roar_meta   meta;
363 struct roar_stream s;
364 int mode_i = ROAR_META_MODE_SET;
365 FILE * in;
366 char lion[1024];
367 char * v;
368
369 memset(&s, 0, sizeof(s));
370
371 s.id = id;
372
373 if ( (in = fopen(file, "r")) == NULL )
374  return -1;
375
376 while (fgets(lion, 1024, in) != NULL) {
377  if ( (v = strtok(lion, "\r\n")) != NULL )
378   if ( (v = strtok(NULL, "\r\n")) != NULL )
379    *(v-1) = 0;
380
381  if ( (v = strstr(lion, "=")) == NULL ) {
382   fprintf(stderr, "Error: can not parse meta data lion: %s\n", lion);
383   continue;
384  }
385
386  *v++ = 0;
387
388  meta.type   = roar_meta_inttype(lion);
389  meta.value  = v;
390  meta.key[0] = 0;
391
392  if ( meta.type == -1 ) {
393   fprintf(stderr, "Error: unknown type: %s\n", lion);
394   continue;
395  }
396
397  if ( roar_stream_meta_set(con, &s, mode_i, &meta) == -1 )
398   return -1;
399 }
400
401 fclose(in);
402
403 meta.type  = ROAR_META_TYPE_NONE;
404 meta.value = NULL;
405
406 return roar_stream_meta_set(con, &s, ROAR_META_MODE_FINALIZE, &meta);
407}
408
409int show_meta_type (struct roar_connection * con, int id, char * type) {
410 struct roar_meta   meta;
411 struct roar_stream s;
412
413 memset(&s, 0, sizeof(s));
414
415 s.id = id;
416
417 meta.type  = roar_meta_inttype(type);
418
419 if ( meta.type == -1 ) {
420  fprintf(stderr, "Error: unknown type: %s\n", type);
421  return -1;
422 }
423
424 if ( roar_stream_meta_get(con, &s, &meta) == -1 )
425  return -1;
426
427 printf("Meta %-17s: %s\n", roar_meta_strtype(meta.type), meta.value);
428
429 roar_meta_free(&meta);
430
431 return 0;
432}
433
434int show_meta_all (struct roar_connection * con, int id) {
435 struct roar_stream s;
436 int types[ROAR_META_MAX_PER_STREAM];
437 int i;
438 int len;
439
440 memset(&s, 0, sizeof(s));
441
442 s.id = id;
443
444 if ( (len = roar_stream_meta_list(con, &s, types, ROAR_META_MAX_PER_STREAM)) == -1 )
445  return -1;
446
447 for (i = 0; i < len; i++)
448  show_meta_type(con, id, roar_meta_strtype(types[i]));
449
450 return 0;
451}
452
453int save_meta (struct roar_connection * con, int id, char * file) {
454 struct roar_stream s;
455 struct roar_meta   meta;
456 int types[ROAR_META_MAX_PER_STREAM];
457 int i;
458 int len;
459 FILE * out;
460
461 memset(&s, 0, sizeof(s));
462
463 s.id = id;
464
465 if ( (out = fopen(file, "w")) == NULL )
466  return -1;
467
468 if ( (len = roar_stream_meta_list(con, &s, types, ROAR_META_MAX_PER_STREAM)) == -1 )
469  return -1;
470
471 for (i = 0; i < len; i++) {
472/*
473  show_meta_type(con, id, roar_meta_strtype(types[i]));
474*/
475  meta.type  = types[i];
476
477  if ( roar_stream_meta_get(con, &s, &meta) == -1 )
478   continue;
479
480//  printf("Meta %-17s: %s\n", roar_meta_strtype(meta.type), meta.value);
481
482  fprintf(out, "%s=%s\n", roar_meta_strtype(meta.type), meta.value);
483
484  roar_meta_free(&meta);
485 }
486
487 fclose(out);
488
489 return 0;
490}
491
492int set_flags (struct roar_connection * con, int id, int reset, char * flags) {
493 int f = ROAR_FLAG_NONE;
494 char * c;
495 struct roar_stream s[1];
496
497 memset(s, 0, sizeof(struct roar_stream));
498
499 s->id = id;
500
501 c = strtok(flags, ",");
502 while (c != NULL) {
503  if ( !strcmp(c, "meta") ) {
504   f |= ROAR_FLAG_META;
505  } else if ( !strcmp(c, "primary") ) {
506   f |= ROAR_FLAG_PRIMARY;
507  } else if ( !strcmp(c, "sync") ) {
508   f |= ROAR_FLAG_SYNC;
509  } else {
510   fprintf(stderr, "Error: unknown flag: %s\n", c);
511   return -1;
512  }
513
514  c = strtok(NULL, ",");
515 }
516
517 return roar_stream_set_flags(con, s, f, reset);
518}
519
520int main (int argc, char * argv[]) {
521 struct roar_connection con;
522 char * server   = NULL;
523 char * k = NULL;
524 int    i;
525 int    t = 0;
526
527 for (i = 1; i < argc; i++) {
528  k = argv[i];
529
530  if ( strcmp(k, "--server") == 0 ) {
531   server = argv[++i];
532  } else if ( strcmp(k, "-v") == 0 || strcmp(k, "--verbose") == 0 ) {
533   g_verbose++;
534  } else if ( strcmp(k, "--help") == 0 ) {
535   usage();
536   return 0;
537  } else if ( *k == '-' ) {
538   fprintf(stderr, "Error: unknown argument: %s\n", k);
539   usage();
540   return 1;
541  } else {
542   break;
543  }
544 }
545
546 // connect
547
548 if ( roar_connect(&con, server) == -1 ) {
549  fprintf(stderr, "Error: Can not connect to server\n");
550  return 1;
551 }
552
553 if ( roar_identify(&con, "roarctl") == -1 ) {
554  fprintf(stderr, "Error: Can not identify to server\n");
555  return 1;
556 }
557
558 if ( i == argc ) {
559  fprintf(stderr, "Error: No Commands given\n");
560  return 0; // this is not a fatal error...
561 }
562
563 for (; i < argc; i++) {
564  k = argv[i];
565  // cmd is in k
566
567  printf("--- [ %s ] ---\n", k);
568
569  if ( !strcmp(k, "help") ) {
570   usage();
571
572  } else if ( !strcmp(k, "sleep") ) {
573   sleep(atoi(argv[++i]));
574
575  } else if ( !strcmp(k, "standby") || !strcmp(k, "off") ) {
576   if ( roar_set_standby(&con, ROAR_STANDBY_ACTIVE) == -1 ) {
577    fprintf(stderr, "Error: can not set mode to standby\n");
578   } else {
579    printf("going into standby\n");
580   }
581  } else if ( !strcmp(k, "resume") || !strcmp(k, "on") ) {
582   if ( roar_set_standby(&con, ROAR_STANDBY_INACTIVE) == -1 ) {
583    fprintf(stderr, "Error: can not set mode to active\n");
584   } else {
585    printf("going into active mode\n");
586   }
587
588  } else if ( !strcmp(k, "exit") ) {
589   if ( roar_exit(&con) == -1 ) {
590    fprintf(stderr, "Error: can not quit server\n");
591   } else {
592    printf("Server quited\n");
593    break;
594   }
595  } else if ( !strcmp(k, "terminate") ) {
596   if ( roar_terminate(&con, 1) == -1 ) {
597    fprintf(stderr, "Error: can not terminate server\n");
598   } else {
599    printf("Server got asked to quited\n");
600    break;
601   }
602
603  } else if ( !strcmp(k, "standbymode") ) {
604   t = roar_get_standby(&con);
605   if ( t == -1 ) {
606    fprintf(stderr, "Error: can not get stanby mode\n");
607   } else if ( t == ROAR_STANDBY_ACTIVE ) {
608    printf("Server is in standby\n");
609   } else if ( t == ROAR_STANDBY_INACTIVE ) {
610    printf("Server is active\n");
611   } else {
612    fprintf(stderr, "Error: unknown standby mode: %i\n", t);
613   }
614
615  } else if ( !strcmp(k, "whoami") ) {
616   printf("My client ID is: %i\n", roar_get_clientid(&con));
617  } else if ( !strcmp(k, "serveroinfo") ) {
618   server_oinfo(&con);
619  } else if ( !strcmp(k, "listclients") ) {
620   list_clients(&con);
621  } else if ( !strcmp(k, "liststreams") ) {
622   list_streams(&con);
623  } else if ( !strcmp(k, "allinfo") ) {
624   server_oinfo(&con);
625   printf("\n");
626   list_clients(&con);
627   printf("\n");
628   list_streams(&con);
629
630  } else if ( !strcmp(k, "kick") ) {
631   k = argv[++i];
632   if ( !strcmp(k, "client") ) {
633    t = ROAR_OT_CLIENT;
634   } else if ( !strcmp(k, "stream") ) {
635    t = ROAR_OT_STREAM;
636   } else if ( !strcmp(k, "sample") ) {
637    t = ROAR_OT_SAMPLE;
638   } else if ( !strcmp(k, "source") ) {
639    t = ROAR_OT_SOURCE;
640   } else {
641    fprintf(stderr, "Error: unknown type: %s\n", k);
642    continue;
643   }
644   //t = atoi(argv[i++]);
645   if ( roar_kick(&con, t, atoi(argv[++i])) == -1 ) {
646    fprintf(stderr, "Error: can not kick %s\n", k);
647   } else {
648    printf("%s kicked\n", k);
649   }
650
651  } else if ( !strcmp(k, "volume") ) {
652   if ( set_mixer(&con, &i, argc, argv) == -1 ) {
653    fprintf(stderr, "Error: can not set volume\n");
654   } else {
655    printf("volume changed\n");
656   }
657
658  } else if ( !strcmp(k, "flag") ) {
659   i++;
660   if ( set_flags(&con, atoi(argv[i]), ROAR_SET_FLAG, argv[i+1]) == -1 ) {
661    fprintf(stderr, "Error: can not set flags\n");
662   } else {
663    printf("flags changed\n");
664   }
665   i++;
666  } else if ( !strcmp(k, "unflag") ) {
667   i++;
668   if ( set_flags(&con, atoi(argv[i]), ROAR_RESET_FLAG, argv[i+1]) == -1 ) {
669    fprintf(stderr, "Error: can not reset flags\n");
670   } else {
671    printf("flags changed\n");
672   }
673   i++;
674  } else if ( !strcmp(k, "metaset") ) {
675   i++;
676   if ( set_meta(&con, atoi(argv[i]), argv[i+1], argv[i+2], argv[i+3]) == -1 ) {
677    fprintf(stderr, "Error: can not set meta data\n");
678   } else {
679    printf("meta data changed\n");
680   }
681   i += 3;
682  } else if ( !strcmp(k, "metaget") ) {
683   i++;
684   if ( show_meta_type(&con, atoi(argv[i]), argv[i+1]) == -1 ) {
685    fprintf(stderr, "Error: can not get meta data\n");
686   }
687   i++;
688  } else if ( !strcmp(k, "metasave") ) {
689   i++;
690   if ( save_meta(&con, atoi(argv[i]), argv[i+1]) == -1 ) {
691    fprintf(stderr, "Error: can not get meta data\n");
692   } else {
693    printf("meta data saved\n");
694   }
695   i++;
696  } else if ( !strcmp(k, "metaload") ) {
697   i++;
698   if ( load_meta(&con, atoi(argv[i]), argv[i+1]) == -1 ) {
699    fprintf(stderr, "Error: can not set meta data\n");
700   } else {
701    printf("meta data saved\n");
702   }
703   i++;
704
705  } else {
706   fprintf(stderr, "Error: invalid command: %s\n", k);
707  }
708
709 }
710
711 roar_disconnect(&con);
712
713 return 0;
714}
715
716//ll
Note: See TracBrowser for help on using the repository browser.