File: test_checksum.cpp

package info (click to toggle)
davix 0.8.10-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 37,184 kB
  • sloc: ansic: 164,612; cpp: 38,741; python: 17,726; perl: 14,124; sh: 13,458; xml: 3,567; makefile: 1,959; javascript: 885; pascal: 570; lisp: 7
file content (45 lines) | stat: -rw-r--r-- 912 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45

#include <davix.hpp>
#include <memory>
#include <string>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <cstring>

#include "davix_test_lib.h"


using namespace Davix;

int main(int argc, char** argv){
    if( argc < 3){
        std::cout << "Usage  : " << std::endl;
        std::cout <<"\t" << argv[0] << " [url] [algo]" << std::endl;
        std::cout <<"\t" << argv[0] << " [url] [algo] [CERTIFICATE_PATH] " << std::endl;
        return 0;
    }

    RequestParams  p;
    DavixError* tmp_err=NULL;

    Uri u(argv[1]);
    char* algo = argv[2];
    Context c;
    File f(c,u);

    if(argc > 3){
        configure_grid_env(argv[3], p);
    }

    std::string chk;
    int ret = f.checksum(&p, chk, algo, &tmp_err);

    if(ret ==0)
        std::cout << algo << " "<<  chk << std::endl;
    else
        std::cout << "checksum error "<< tmp_err->getErrMsg() << std::endl;

    return 0;
}