|
Lines 51-64
Link Here
|
| 51 |
* \param[out] serverinfo A pointer to a servinfo_t struct |
51 |
* \param[out] serverinfo A pointer to a servinfo_t struct |
| 52 |
* \return Returns 0 if everything went ok, 2 if we got -H (print long_help) and 1 in case of error |
52 |
* \return Returns 0 if everything went ok, 2 if we got -H (print long_help) and 1 in case of error |
| 53 |
*/ |
53 |
*/ |
| 54 |
int parse_options(int argc,char *argv[], servinfo_t *serverinfo) |
54 |
int parse_options(int argc, char *argv[], servinfo_t *serverinfo, |
|
|
55 |
string_t **rcpts) |
| 55 |
{ |
56 |
{ |
| 56 |
int c; |
57 |
int c; |
| 57 |
char buffer[BUF_SIZE]; |
58 |
char buffer[BUF_SIZE]; |
| 58 |
bool_t read_syswide = True; |
59 |
bool_t read_syswide = True; |
| 59 |
bool_t read_localconf = True; |
60 |
bool_t read_localconf = True; |
| 60 |
|
61 |
|
| 61 |
for (c = 0 ; c < argc ; c++) |
62 |
/* argv[0] = "nbsmtp" or whatever name was used to call the program. |
|
|
63 |
* We don't need to check it as an option */ |
| 64 |
for (c = 1 ; c < argc ; c++) |
| 62 |
{ |
65 |
{ |
| 63 |
if (strncmp("-n",argv[c],strlen("-n"))==0) |
66 |
if (strncmp("-n",argv[c],strlen("-n"))==0) |
| 64 |
{ |
67 |
{ |
|
Lines 78-84
Link Here
|
| 78 |
} |
81 |
} |
| 79 |
|
82 |
|
| 80 |
/* Then read the options */ |
83 |
/* Then read the options */ |
| 81 |
while ((c = getopt(argc,argv,"h:d:f:c:p:U:P:M:sSvVDHnN")) != -1) |
84 |
while ((c = getopt(argc,argv,"h:d:f:c:p:U:P:M:t:sSvVDHnN")) != -1) |
| 82 |
{ |
85 |
{ |
| 83 |
switch(c) |
86 |
switch(c) |
| 84 |
{ |
87 |
{ |
|
Lines 157-162
Link Here
|
| 157 |
break; |
160 |
break; |
| 158 |
} |
161 |
} |
| 159 |
break; |
162 |
break; |
|
|
163 |
case 't': |
| 164 |
serverinfo->num_rcpts += 1; |
| 165 |
*rcpts = (string_t*) realloc(*rcpts, |
| 166 |
(serverinfo->num_rcpts * |
| 167 |
sizeof(string_t))); |
| 168 |
if (! *rcpts) { |
| 169 |
perror("realloc in parsing -t"); |
| 170 |
return 1; |
| 171 |
} |
| 172 |
(*rcpts)[serverinfo->num_rcpts-1].str = |
| 173 |
(char *)strdup(optarg); |
| 174 |
(*rcpts)[serverinfo->num_rcpts-1].len = |
| 175 |
strlen((*rcpts)[serverinfo->num_rcpts-1].str); |
| 176 |
break; |
| 160 |
case 'H': |
177 |
case 'H': |
| 161 |
print_help(argv[0]); |
178 |
print_help(argv[0]); |
| 162 |
return 2; |
179 |
return 2; |