version 1.12, 2011/11/13 11:10:27 |
version 1.13, 2011/11/14 10:07:06 |
|
|
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
*/ |
*/ |
|
#ifdef HAVE_CONFIG_H |
|
#include "config.h" |
|
#endif |
|
|
#include <assert.h> |
#include <assert.h> |
#include <getopt.h> |
#include <getopt.h> |
#include <limits.h> |
#include <limits.h> |
|
|
main(int argc, char *argv[]) |
main(int argc, char *argv[]) |
{ |
{ |
int ch; |
int ch; |
|
size_t sz; |
|
char *buf; |
struct opts opts; |
struct opts opts; |
struct expr *e; |
struct expr *e; |
extern int optind; |
extern int optind; |
Line 66 main(int argc, char *argv[]) |
|
Line 72 main(int argc, char *argv[]) |
|
if (0 == argc) |
if (0 == argc) |
return(EXIT_SUCCESS); |
return(EXIT_SUCCESS); |
|
|
if (NULL == (e = exprcomp(argc, argv))) { |
/* |
|
* Collapse expressions into a single string. |
|
* First count up the contained strings, adding a space at the |
|
* end of each (plus nil-terminator). Then merge. |
|
*/ |
|
|
|
for (sz = 0, ch = 0; ch < argc; ch++) |
|
sz += strlen(argv[ch]) + 1; |
|
|
|
buf = mandoc_malloc(++sz); |
|
|
|
for (*buf = '\0', ch = 0; ch < argc; ch++) { |
|
strlcat(buf, argv[ch], sz); |
|
strlcat(buf, " ", sz); |
|
} |
|
|
|
buf[sz - 2] = '\0'; |
|
|
|
if (NULL == (e = exprcomp(buf))) { |
fprintf(stderr, "Bad expression\n"); |
fprintf(stderr, "Bad expression\n"); |
|
free(buf); |
return(EXIT_FAILURE); |
return(EXIT_FAILURE); |
} |
} |
|
|
|
free(buf); |
|
|
/* |
/* |
* Configure databases. |
* Configure databases. |