source: zzuf/trunk/src/opts.c @ 4264

Last change on this file since 4264 was 4264, checked in by Sam Hocevar, 9 years ago

Rename -t/--max-time to -U/--max-usertime, and add -t/--max-time to
roughly mean "maximum zzuf run time". Fixes bug #45.

  • Property svn:keywords set to Id
File size: 1.6 KB
Line 
1/*
2 *  zzuf - general purpose fuzzer
3 *  Copyright (c) 2002-2010 Sam Hocevar <sam@hocevar.net>
4 *                All Rights Reserved
5 *
6 *  This program is free software. It comes without any warranty, to
7 *  the extent permitted by applicable law. You can redistribute it
8 *  and/or modify it under the terms of the Do What The Fuck You Want
9 *  To Public License, Version 2, as published by Sam Hocevar. See
10 *  http://sam.zoy.org/wtfpl/COPYING for more details.
11 */
12
13/*
14 *  opts.c: configuration handling
15 */
16
17#include "config.h"
18
19#if defined HAVE_STDINT_H
20#   include <stdint.h>
21#elif defined HAVE_INTTYPES_H
22#   include <inttypes.h>
23#endif
24
25#include <sys/types.h>
26#include <stdio.h>
27#include <stdlib.h>
28
29#include "common.h"
30#include "timer.h"
31#include "opts.h"
32
33void _zz_opts_init(struct opts *opts)
34{
35    opts->fuzzing = opts->bytes = opts->list = opts->ports = NULL;
36    opts->allow = NULL;
37    opts->protect = opts->refuse = NULL;
38    opts->seed = DEFAULT_SEED;
39    opts->endseed = DEFAULT_SEED + 1;
40    opts->minratio = opts->maxratio = DEFAULT_RATIO;
41    opts->quiet = 0;
42    opts->maxbytes = -1;
43    opts->md5 = 0;
44    opts->checkexit = 0;
45    opts->verbose = 0;
46    opts->maxmem = DEFAULT_MEM;
47    opts->starttime = _zz_time();
48    opts->maxtime = 0;
49    opts->maxusertime = -1;
50    opts->maxcpu = -1;
51    opts->delay = 0;
52    opts->lastlaunch = 0;
53
54    opts->newargv = NULL;
55    opts->maxchild = 1;
56    opts->nchild = 0;
57    opts->maxcrashes = 1;
58    opts->crashes = 0;
59    opts->child = NULL;
60}
61
62void _zz_opts_fini(struct opts *opts)
63{
64    if(opts->child)
65        free(opts->child);
66    if(opts->newargv)
67        free(opts->newargv);
68}
69
Note: See TracBrowser for help on using the repository browser.