Coverage Report

Created: 2026-10-28 06:30

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/rtpproxy/src/librtpp_main.c
Line
Count
Source
1
/*
2
 * Copyright (c) 2006-2025 Sippy Software, Inc., http://www.sippysoft.com
3
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24
 * SUCH DAMAGE.
25
 *
26
 */
27
28
#include <unistd.h>
29
30
#include "config.h"
31
32
#include "librtpproxy.h"
33
#include "librtpp_main.h"
34
35
struct opt_save {
36
    char *optarg;
37
    int optind;
38
    int optopt;
39
    int opterr;
40
    int optreset;
41
};
42
43
#if !HAVE_DECL_OPTRESET
44
static int optreset; /* Not present in glibc */
45
#endif
46
47
0
#define OPT_SAVE(sp) (*(sp) = (struct opt_save){optarg, optind, optopt, opterr, optreset})
48
0
#define OPT_RESTORE(sp) ({ \
49
0
    optarg = (sp)->optarg; \
50
0
    optind = (sp)->optind; \
51
0
    optopt = (sp)->optopt; \
52
0
    opterr = (sp)->opterr; \
53
0
    optreset = (sp)->optreset; \
54
0
})
55
56
struct rtpp_cfg *
57
rtpp_main(int argc, const char * const *argv)
58
0
{
59
0
    struct rtpp_cfg *r;
60
0
    const struct opt_save opt_zero = {.optind = 1};
61
0
    struct opt_save opt_saved;
62
63
0
    OPT_SAVE(&opt_saved);
64
0
    OPT_RESTORE(&opt_zero);
65
0
    r = _rtpp_main(argc, argv);
66
0
    OPT_RESTORE(&opt_saved);
67
0
    return r;
68
0
}