3 #==============================================================================
5 # File ID: 2a4e251e-7b6f-11df-b25f-00219bfade9b
7 # Pack stdin with gzip and encapsulate it in base64.
9 # Author: Øyvind A. Holm <sunny@sunbase.org>
10 # License: GNU General Public License version 2 or later.
11 #==============================================================================
25 while test -n "$1"; do
27 -d|
--decode) opt_decode
=1; shift ;;
28 -h|
--help) opt_help
=1; shift ;;
29 -q|
--quiet) opt_quiet
=$
(($opt_quiet + 1)); shift ;;
30 -s|
--size) opt_size
="$2"; shift 2 ;;
31 -v|
--verbose) opt_verbose
=$
(($opt_verbose + 1)); shift ;;
32 -w|
--wrap) opt_wrap
="$2"; shift 2 ;;
33 --version) echo $progname $VERSION; exit 0 ;;
36 if printf '%s\n' "$1" |
grep -q ^
-; then
37 echo "$progname: $1: Unknown option" >&2
45 opt_verbose
=$
(($opt_verbose - $opt_quiet))
47 if test "$opt_help" = "1"; then
48 test $opt_verbose -gt 0 && { echo; echo $progname $VERSION; }
51 Pack stdin with gzip and encapsulate it in base64.
53 Usage: $progname [options]
58 Decode gzipped base64.
62 Be more quiet. Can be repeated to increase silence.
64 Create base64 using SIZE character chunks. To get one long chunk,
65 use 0. Default: $std_size.
67 Increase level of verbosity. Can be repeated.
68 -w WIDTH, --wrap WIDTH
69 Wrap lines to WIDTH length. If "-" is specified, use terminal size.
71 Print version information.
77 if [ "$opt_decode" = "1" ]; then
78 base64
-di | gunzip
--stdout --force
82 (gzip -9 | base64
-w $opt_size |
tr '\n' ' ' |
sed 's/ $//'; echo) \
83 |
if [ "$opt_wrap" = "0" ]; then
86 [ "$opt_wrap" = "-" ] && opt_wrap
=$
(tput cols
)
90 # vim: set ts=8 sw=8 sts=8 noet fo+=w tw=79 fenc=UTF-8 :