LCOV - code coverage report
Current view: top level - src - triggers.c (source / functions) Hit Total Coverage
Test: rapport Lines: 6 15 40.0 %
Date: 2021-12-10 16:22:55 Functions: 1 2 50.0 %
Branches: 1 4 25.0 %

           Branch data     Line data    Source code
       1                 :            : /*-
       2                 :            :  * Copyright (c) 2021 Baptiste Daroussin <bapt@FreeBSD.org>
       3                 :            :  * 
       4                 :            :  * Redistribution and use in source and binary forms, with or without
       5                 :            :  * modification, are permitted provided that the following conditions
       6                 :            :  * are met:
       7                 :            :  * 1. Redistributions of source code must retain the above copyright
       8                 :            :  *    notice, this list of conditions and the following disclaimer
       9                 :            :  *    in this position and unchanged.
      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(S) ``AS IS'' AND ANY EXPRESS OR
      15                 :            :  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
      16                 :            :  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
      17                 :            :  * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
      18                 :            :  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
      19                 :            :  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
      20                 :            :  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
      21                 :            :  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
      22                 :            :  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
      23                 :            :  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
      24                 :            :  */
      25                 :            : 
      26                 :            : #ifdef HAVE_CONFIG_H
      27                 :            : #include "pkg_config.h"
      28                 :            : #endif
      29                 :            : 
      30                 :            : #include <getopt.h>
      31                 :            : #include <pkg.h>
      32                 :            : 
      33                 :            : #include "pkgcli.h"
      34                 :            : 
      35                 :            : void
      36                 :          0 : usage_triggers(void)
      37                 :            : {
      38                 :          0 :         fprintf(stderr, "Usage: pkg triggers [-q]\n\n");
      39                 :          0 :         fprintf(stderr, "For more information see 'pkg help triggers'.\n");
      40                 :          0 : }
      41                 :            : 
      42                 :            : int
      43                 :          4 : exec_triggers(int argc, char **argv)
      44                 :            : {
      45                 :            :         int ch;
      46                 :            : 
      47                 :          4 :         struct option longopts[] = {
      48                 :            :                 { "quiet",    no_argument,    NULL,   'q' },
      49                 :            :                 { NULL,         0,              NULL,   0   },
      50                 :            :         };
      51                 :            :         
      52         [ -  + ]:          4 :         while ((ch = getopt_long(argc, argv, "+q", longopts, NULL)) != -1) {
      53         [ #  # ]:          0 :                 switch (ch) {
      54                 :            :                 case 'q':
      55                 :          0 :                         quiet = true;
      56                 :          0 :                         break;
      57                 :            :                 default:
      58                 :          0 :                         usage_triggers();
      59                 :          0 :                         return (EXIT_FAILURE);
      60                 :            :                 }
      61                 :            :         }
      62                 :            :         // argv += optind;
      63                 :            : 
      64                 :          4 :         pkg_execute_deferred_triggers();
      65                 :            : 
      66                 :          4 :         return (EXIT_SUCCESS);
      67                 :          4 : }

Generated by: LCOV version 1.15