Annotation of embedaddon/miniupnpd/testgetifstats.c, revision 1.1.1.2

1.1.1.2 ! misho       1: /* $Id: testgetifstats.c,v 1.6 2012/06/22 16:11:58 nanard Exp $ */
1.1       misho       2: /* MiniUPnP project
                      3:  * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
1.1.1.2 ! misho       4:  * (c) 2006 Thomas Bernard
1.1       misho       5:  * This software is subject to the conditions detailed
                      6:  * in the LICENCE file provided within the distribution */
                      7: 
                      8: #include <stdio.h>
                      9: #include <string.h>
                     10: #include <syslog.h>
                     11: 
                     12: #include "getifstats.h"
                     13: 
1.1.1.2 ! misho      14: #if defined(__sun)
        !            15: /* solaris 10 does not define LOG_PERROR */
        !            16: #define LOG_PERROR 0
        !            17: #endif
        !            18: 
1.1       misho      19: int
                     20: main(int argc, char **argv)
                     21: {
                     22:        int r;
                     23:        struct ifdata data;
                     24:        if(argc<2)
                     25:        {
                     26:                fprintf(stderr, "usage : %s <ifname>\n", argv[0]);
                     27:                return 1;
                     28:        }
                     29:        openlog("testgetifstats", LOG_CONS|LOG_PERROR, LOG_USER);
                     30:        memset(&data, 0, sizeof(data));
                     31:        r = getifstats(argv[1], &data);
                     32:        printf("getifstats() returned %d\n", r);
                     33:        printf("stats for interface %s :\n", argv[1]);
                     34:        printf("bitrate = %lu\n", data.baudrate);
                     35:        printf(" input packets : %9lu\t input bytes : %9lu\n",
                     36:               data.ipackets, data.ibytes);
                     37:        printf("output packets : %9lu\toutput bytes : %9lu\n",
                     38:               data.opackets, data.obytes);
                     39:        return 0;
                     40: }
                     41: 

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>