~ubuntu-branches/ubuntu/vivid/cctools/vivid

« back to all changes in this revision

Viewing changes to parrot/src/parrot_md5.c

  • Committer: Bazaar Package Importer
  • Author(s): Michael Hanke
  • Date: 2011-05-07 09:05:00 UTC
  • Revision ID: james.westby@ubuntu.com-20110507090500-lqpmdtwndor6e7os
Tags: upstream-3.3.2
ImportĀ upstreamĀ versionĀ 3.3.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
Copyright (C) 2008- The University of Notre Dame
 
3
This software is distributed under the GNU General Public License.
 
4
See the file COPYING for details.
 
5
*/
 
6
 
 
7
#include "md5.h"
 
8
#include "parrot_client.h"
 
9
 
 
10
#include <stdio.h>
 
11
#include <string.h>
 
12
#include <errno.h>
 
13
#include <unistd.h>
 
14
 
 
15
int main( int argc, char *argv[] )
 
16
{
 
17
        int i;
 
18
        unsigned char digest[16];
 
19
 
 
20
        if(argc<2) {
 
21
                printf("use: parrot_md5 <file> ...\n");
 
22
                return 1;
 
23
        }
 
24
 
 
25
        for(i=1;i<argc;i++) {
 
26
                if(parrot_md5(argv[i],digest)>=0 || md5_file(argv[i],digest)) {
 
27
                        printf("%s %s\n",md5_string(digest),argv[i]);
 
28
                } else {
 
29
                        fprintf(stderr,"parrot_md5: %s: %s\n",argv[i],strerror(errno));
 
30
                }
 
31
        }
 
32
 
 
33
        return 0;
 
34
}