1AutoGen Definitions options;
2
3export = <<- _EOExport_
4	#include <stddef.h>
5
6	extern size_t       separator_str_len;
7	_EOExport_;
8
9include = <<- _EOInclude_
10	size_t separator_str_len = 6;
11
12	extern void init_unshar (void);
13	_EOInclude_;
14
15#define NEED_AUTHORS
16prog-name   = `progname=unshar; echo $progname`;
17#include shar-std.def
18
19prog-title  = 'unpack a shar archive';
20argument    = '[<file>...]';
21
22detail = <<- _EODetail_
23	Unshar scans the input files (typically email messages) looking for
24	the start of a shell archive.  If no files are given, then standard
25	input is processed instead.  It then passes each archive discovered
26	through an invocation of the shell program to unpack it.
27	_EODetail_;
28
29main = {
30    main-type    = for-each;
31    handler-proc = unshar_file;
32    handler-type = file-r;
33    stdin-input;
34    main-init    = '    init_unshar ();';
35};
36
37exit-desc[1]  = 'There was an error in command usage.';
38
39exit-name[2]  = popen-problem;
40exit-desc[2]  = 'cannot spawn or write to a shell process';
41
42exit-name[3]  = cannot-create;
43exit-desc[3]  = 'cannot create output file';
44
45exit-name[4]  = bad-directory;
46exit-desc[4]  = 'the working directory structure is invalid';
47
48exit-name[5]  = NOMEM;
49exit-desc[5]  = 'memory allocation failure';
50
51exit-name[6]  = invalid;
52exit-desc[6]  = 'invalid input, does not contain a shar file';
53
54help-value;
55
56flag = {
57    name        = directory;
58    value       = d;
59    arg-type    = string;
60    arg-name    = dir;
61    descrip     = 'unpack into the directory @file{dir}';
62
63    doc = <<- _EODoc_
64	The input file names are relative to the current directory
65	when the program was started.  This option tells @command{unshar}
66	to insert a @code{cd <dir>} commad at the start of the
67	@command{shar} text written to the shell.
68	_EODoc_;
69};
70
71flag = {
72    name        = overwrite;
73    value       = c;
74    descrip     = 'overwrite any pre-existing files';
75    doc = <<- _EODoc_
76	This option is passed through as an option to the shar file.  Many
77	shell archive scripts accept a @option{-c} argument to indicate that
78	existing files should be overwritten.
79	_EODoc_;
80};
81
82flag = {
83    name        = force;
84    value       = f;
85    aliases     = overwrite;
86};
87
88flag = {
89    name        = split-at;
90    value       = E;
91    arg-type    = string;
92    arg-name    = split-mark;
93    descrip     = 'split input on @var{split-mark} lines';
94    arg-default = "exit 0";
95    flag-code   =
96        '    separator_str_len = strlen (pOptDesc->optArg.argString);';
97    settable;
98
99    doc = <<- _EODoc_
100	With this option, @command{unshar} isolates each different shell archive
101	from the others which have been placed in the same file, unpacking each
102	in turn, from the beginning of the file to the end.  Its proper
103	operation relies on the fact that many shar files are terminated by a
104	readily identifiable string at the start of the last line.
105
106	For example, noticing that most `.signatures' have a double hyphen
107	("--") on a line right before them, one can then sometimes use
108	@code{--split-at=--}.  The signature will then be skipped, along with
109	the headers of the following message.
110	_EODoc_;
111};
112
113flag = {
114    name        = exit-0;
115    value       = e;
116    flags-cant  = split-at;
117    descrip     = 'split input on "exit 0" lines';
118    flag-code   = '    SET_OPT_SPLIT_AT("exit 0");';
119
120    doc = <<- _EODoc_
121	Most shell archives end with a line consisting of simply "exit 0".
122	This option is equivalent to (and conflicts with)
123	@code{--split-at="exit 0"}.
124	_EODoc_;
125};
126
127flag = {
128    name        = debug;
129    value       = D;
130    descrip     = 'debug the shell code';
131    doc = <<- _EODoc_
132	"set -x" will be emitted into the code the shell interprets.
133	_EODoc_;
134};
135
136doc-section = {
137    ds-type = 'SEE ALSO';
138    ds-text = 'shar(1)';
139};
140