LCOV - code coverage report
Current view: top level - lib/dpkg - options-parsers.c (source / functions) Coverage Total Hit
Test: dpkg 1.22.7-3-g89f48 C code coverage Lines: 0.0 % 6 0
Test Date: 2024-07-17 02:53:43 Functions: 0.0 % 1 0
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0.0 % 2 0

             Branch data     Line data    Source code
       1                 :             : /*
       2                 :             :  * libdpkg - Debian packaging suite library routines
       3                 :             :  * options-parsers.c - command-line options parser helpers
       4                 :             :  *
       5                 :             :  * Copyright © 2014 Guillem Jover <guillem@debian.org>
       6                 :             :  *
       7                 :             :  * This is free software; you can redistribute it and/or modify
       8                 :             :  * it under the terms of the GNU General Public License as published by
       9                 :             :  * the Free Software Foundation; either version 2 of the License, or
      10                 :             :  * (at your option) any later version.
      11                 :             :  *
      12                 :             :  * This is distributed in the hope that it will be useful,
      13                 :             :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      14                 :             :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      15                 :             :  * GNU General Public License for more details.
      16                 :             :  *
      17                 :             :  * You should have received a copy of the GNU General Public License
      18                 :             :  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
      19                 :             :  */
      20                 :             : 
      21                 :             : #include <config.h>
      22                 :             : #include <compat.h>
      23                 :             : 
      24                 :             : #include <dpkg/i18n.h>
      25                 :             : #include <dpkg/dpkg-db.h>
      26                 :             : #include <dpkg/error.h>
      27                 :             : #include <dpkg/pkg-spec.h>
      28                 :             : #include <dpkg/options.h>
      29                 :             : 
      30                 :             : /**
      31                 :             :  * Parse an argument as a package name.
      32                 :             :  *
      33                 :             :  * The string is parsed as a singleton package name, and a #pkginfo instance
      34                 :             :  * is returned.
      35                 :             :  *
      36                 :             :  * @param cmd  The command information structure currently parsed.
      37                 :             :  * @param name The package name argument
      38                 :             :  *
      39                 :             :  * @return A package instance.
      40                 :             :  */
      41                 :             : struct pkginfo *
      42                 :           0 : dpkg_options_parse_pkgname(const struct cmdinfo *cmd, const char *name)
      43                 :             : {
      44                 :             :         struct pkginfo *pkg;
      45                 :             :         struct dpkg_error err;
      46                 :             : 
      47                 :           0 :         pkg = pkg_spec_parse_pkg(name, &err);
      48         [ #  # ]:           0 :         if (pkg == NULL)
      49                 :           0 :                 badusage(_("--%s needs a valid package name but '%.250s' is not: %s"),
      50                 :           0 :                          cmd->olong, name, err.str);
      51                 :             : 
      52                 :           0 :         return pkg;
      53                 :             : }
        

Generated by: LCOV version 2.0-1