3 from bup import options, _helpers
4 from bup.helpers import *
7 bup random [-S seed] <numbytes>
9 S,seed= optional random number seed [1]
10 f,force print random data to stdout even if it's a tty
11 v,verbose print byte counter to stderr
13 o = options.Options(optspec)
14 (opt, flags, extra) = o.parse(sys.argv[1:])
17 o.fatal("exactly one argument expected")
19 total = parse_num(extra[0])
23 if opt.force or (not os.isatty(1) and
24 not atoi(os.environ.get('BUP_FORCE_TTY')) & 1):
25 _helpers.write_random(sys.stdout.fileno(), total, opt.seed,
26 opt.verbose and 1 or 0)
28 log('error: not writing binary data to a terminal. Use -f to force.\n')