summaryrefslogtreecommitdiff
path: root/bin/mac/printenv.py
blob: 4d81c1fef76b103fcd25b6a91218404066a775a4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/usr/bin/python

# Dumps environment variables into specified file.
# Format: zero-separated "name=value" pairs in platform encoding.

import os
import sys

if len(sys.argv) != 2:
    raise Error('Exactly one argument expected')

with open(sys.argv[1], 'w') as f:
    for key, value in os.environ.items():
        f.writelines([key, '=', value, '\0'])