~ubuntu-branches/ubuntu/jaunty/gnupg2/jaunty

« back to all changes in this revision

Viewing changes to tools/mk-tdata.c

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Urlichs
  • Date: 2006-01-24 04:31:42 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20060124043142-pbg192or6qxv3yk2
Tags: 1.9.20-1
* New Upstream version. Closes:#306890,#344530
  * Closes:#320490: gpg-protect-tool fails to decrypt PKCS-12 files 
* Depend on libopensc2-dev, not -1-. Closes:#348106

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* mk-tdata.c -  Create some simple random testdata
 
2
 * Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
 
3
 *
 
4
 * This file is free software; as a special exception the author gives
 
5
 * unlimited permission to copy and/or distribute it, with or without
 
6
 * modifications, as long as this notice is preserved.
 
7
 *
 
8
 * This program is distributed in the hope that it will be useful, but
 
9
 * WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
 
10
 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
11
 */
 
12
 
 
13
#include <config.h>
 
14
#include <stdio.h>
 
15
#include <stdlib.h>
 
16
#include <unistd.h>
 
17
 
 
18
 
 
19
#ifndef RAND_MAX   /* for SunOS */
 
20
  #define RAND_MAX 32767
 
21
#endif
 
22
 
 
23
int
 
24
main(int argc, char **argv)
 
25
{
 
26
    int i, c;
 
27
    int limit =0;
 
28
 
 
29
    limit = argc > 1 ? atoi(argv[1]) : 0;
 
30
 
 
31
    srand(getpid());
 
32
 
 
33
    for(i=0; !limit || i < limit; i++ ) {
 
34
      #ifdef HAVE_RAND
 
35
        c = ((unsigned)(1 + (int) (256.0*rand()/(RAND_MAX+1.0)))-1);
 
36
      #else
 
37
        c = ((unsigned)(1 + (int) (256.0*random()/(RAND_MAX+1.0)))-1);
 
38
      #endif
 
39
        putchar(c);
 
40
    }
 
41
    return 0;
 
42
}
 
43