~ifolder-dev/simias/trunk-packaging

« back to all changes in this revision

Viewing changes to tools/gsoap/gsoap-linux-2.7/samples/calc/.svn/text-base/calcclient.c.svn-base

  • Committer: Jorge O. Castro
  • Date: 2007-12-03 06:56:46 UTC
  • Revision ID: jorge@ubuntu.com-20071203065646-mupcnjcwgm5mnhyt
* Remove a bunch of .svn directories we no longer need.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#include "soapH.h"
2
 
#include "calc.nsmap"
3
 
 
4
 
const char server[] = "http://websrv.cs.fsu.edu/~engelen/calcserver.cgi";
5
 
 
6
 
int main(int argc, char **argv)
7
 
{ struct soap soap;
8
 
  double a, b, result;
9
 
  if (argc < 4)
10
 
  { fprintf(stderr, "Usage: [add|sub|mul|div|pow] num num\n");
11
 
    exit(0);
12
 
  }
13
 
  soap_init(&soap);
14
 
  a = strtod(argv[2], NULL);
15
 
  b = strtod(argv[3], NULL);
16
 
  switch (*argv[1])
17
 
  { case 'a':
18
 
      soap_call_ns__add(&soap, server, "", a, b, &result);
19
 
      break;
20
 
    case 's':
21
 
      soap_call_ns__sub(&soap, server, "", a, b, &result);
22
 
      break;
23
 
    case 'm':
24
 
      soap_call_ns__mul(&soap, server, "", a, b, &result);
25
 
      break;
26
 
    case 'd':
27
 
      soap_call_ns__div(&soap, server, "", a, b, &result);
28
 
      break;
29
 
    case 'p':
30
 
      soap_call_ns__pow(&soap, server, "", a, b, &result);
31
 
      break;
32
 
    default:
33
 
      fprintf(stderr, "Unknown command\n");
34
 
      exit(0);
35
 
  }
36
 
  if (soap.error)
37
 
  { soap_print_fault(&soap, stderr);
38
 
    exit(1);
39
 
  }
40
 
  else
41
 
    printf("result = %g\n", result);
42
 
  soap_destroy(&soap);
43
 
  soap_end(&soap);
44
 
  soap_done(&soap);
45
 
  return 0;
46
 
}