2 from __future__ import absolute_import
5 from bup import options, _helpers
6 from bup.helpers import handle_ctrl_c, log, parse_num
10 bup random [-S seed] <numbytes>
12 S,seed= optional random number seed [1]
13 f,force print random data to stdout even if it's a tty
14 v,verbose print byte counter to stderr
18 o = options.Options(optspec)
19 opt, flags, extra = o.parse_bytes(argv[1:])
22 o.fatal("exactly one argument expected")
24 total = parse_num(extra[0])
28 if opt.force or (not os.isatty(1) and
29 not int(os.environ.get('BUP_FORCE_TTY', 0)) & 1):
30 _helpers.write_random(sys.stdout.fileno(), total, opt.seed,
31 opt.verbose and 1 or 0)
33 log('error: not writing binary data to a terminal. Use -f to force.\n')