1 /* cvm/cvm-v1benchclient.c - CVM benchmark client
2 * Copyright (C) 2010 Bruce Guenter <bruce@untroubled.org>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
18 #include <stdlib.h>
19 #include <bglibs/fmt.h>
20 #include <bglibs/msg.h>
21 #include "v1client.h"
22
23 const char program[] = "cvm-v1benchclient";
24 const int msg_show_pid = 0;
25
main(int argc,char ** argv)26 int main(int argc, char** argv)
27 {
28 int a;
29 unsigned long count;
30 unsigned long i;
31 char* ptr;
32 char num[FMT_ULONG_LEN];
33
34 if (argc < 6)
35 die3(1, "usage: ", program, " count cvmodule account domain credential [credential ...]\n");
36
37 if ((count = strtoul(argv[1], &ptr, 10)) == 0 || *ptr)
38 die2(1, "Invalid number for count: ", argv[1]);
39
40 for (i = 0; i < count; i++) {
41 if ((a = cvm_client_authenticate(argv[2], argv[3], argv[4],
42 (const char**)(argv+5), 0)) != 0) {
43 num[fmt_udec(num, a)] = 0;
44 die5(a, "Authentication failed, error #", num, " (",
45 (a < cvm_nerr) ? cvm_errlist[i] : "Unknown error code", ")");
46 }
47 }
48 return 0;
49 }
50