[BACK]Return to mdocterm.c CVS log [TXT][DIR] Up to [cvsweb.bsd.lv] / mandoc

Annotation of mandoc/mdocterm.c, Revision 1.2

1.2     ! kristaps    1:        /* $Id: mdocterm.c,v 1.1 2009/02/21 21:00:06 kristaps Exp $ */
1.1       kristaps    2: /*
                      3:  * Copyright (c) 2008 Kristaps Dzonsons <kristaps@kth.se>
                      4:  *
                      5:  * Permission to use, copy, modify, and distribute this software for any
                      6:  * purpose with or without fee is hereby granted, provided that the
                      7:  * above copyright notice and this permission notice appear in all
                      8:  * copies.
                      9:  *
                     10:  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
                     11:  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
                     12:  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
                     13:  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
                     14:  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
                     15:  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
                     16:  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
                     17:  * PERFORMANCE OF THIS SOFTWARE.
                     18:  */
                     19: #include <assert.h>
                     20: #include <err.h>
                     21: #include <getopt.h>
                     22: #include <stdlib.h>
                     23:
1.2     ! kristaps   24: #include "mmain.h"
1.1       kristaps   25: #include "term.h"
                     26:
                     27: int
                     28: main(int argc, char *argv[])
                     29: {
1.2     ! kristaps   30:        struct mmain    *p;
        !            31:        const struct mdoc *mdoc;
1.1       kristaps   32:        int              c;
1.2     ! kristaps   33:
        !            34:        extern int       optreset;
1.1       kristaps   35:        extern int       optind;
                     36:
1.2     ! kristaps   37:        p = mmain_alloc();
1.1       kristaps   38:
1.2     ! kristaps   39:        if ( ! mmain_getopt(p, argc, argv, ""))
        !            40:                mmain_exit(p, 1);
1.1       kristaps   41:
1.2     ! kristaps   42:        optreset = optind = 1;
1.1       kristaps   43:
1.2     ! kristaps   44:        while (-1 != (c = getopt(argc, argv, "")))
        !            45:                switch (c) {
1.1       kristaps   46:                default:
1.2     ! kristaps   47:                        mmain_usage("");
        !            48:                        mmain_exit(p, 1);
        !            49:                        /* NOTREACHED */
1.1       kristaps   50:                }
                     51:
1.2     ! kristaps   52:        if (NULL == (mdoc = mmain_mdoc(p)))
        !            53:                mmain_exit(p, 1);
1.1       kristaps   54:
1.2     ! kristaps   55:        termprint(mdoc_node(mdoc), mdoc_meta(mdoc));
        !            56:        mmain_exit(p, 0);
        !            57:        /* NOTREACHED */
1.1       kristaps   58: }
                     59:
                     60:

CVSweb