]> arthur.barton.de Git - bup.git/blob - dev/echo-argv-bytes
1be728866d7098a57f22614a5830604f7a331a66
[bup.git] / dev / echo-argv-bytes
1 #!/bin/sh
2 """": # -*-python-*-
3 # https://sourceware.org/bugzilla/show_bug.cgi?id=26034
4 export "BUP_ARGV_0"="$0"
5 arg_i=1
6 for arg in "$@"; do
7     export "BUP_ARGV_${arg_i}"="$arg"
8     shift
9     arg_i=$((arg_i + 1))
10 done
11 bup_python="$(dirname "$0")/../config/bin/python" || exit $?
12 exec "$bup_python" "$0"
13 """
14 # end of bup preamble
15
16 from __future__ import absolute_import, print_function
17
18 from os.path import abspath, dirname
19 from sys import stdout
20 import os, sys
21
22 script_home = abspath(dirname(__file__))
23 sys.path[:0] = [abspath(script_home + '/../lib'), abspath(script_home + '/..')]
24
25 from bup import compat
26
27 for arg in compat.argvb:
28     os.write(stdout.fileno(), arg)
29     os.write(stdout.fileno(), b'\0\n')
30     stdout.flush()