This file is indexed.

/usr/include/dballe/cmdline/cmdline.h is in libdballe-dev 6.8-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
/*
 * Copyright (C) 2005--2010  ARPA-SIM <urpsim@smr.arpa.emr.it>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
 *
 * Author: Enrico Zini <enrico@enricozini.com>
 */

#ifndef DBA_CMDLINE_H
#define DBA_CMDLINE_H

/** @file
 * @ingroup dballe
 * Common functions for commandline tools
 */

#include <wreport/error.h>
#include <dballe/core/rawmsg.h>
#include <popt.h>
#include <list>
#include <string>

namespace dballe {
struct Record;

namespace cmdline {

struct op_dispatch_table
{
    int (*func)(poptContext);
    const char* aliases[3];
    const char* usage;
    const char* desc;
    const char* longdesc;
    struct poptOption* optable;
};

#define ODT_END { NULL, NULL, NULL, NULL, NULL, NULL }

struct tool_desc
{
    const char* desc;
    const char* longdesc;
    struct op_dispatch_table* ops;  
};

struct program_info
{
    const char* name;
    const char* manpage_examples_section;
    const char* manpage_files_section;
    const char* manpage_seealso_section;
};

/// Report an error with command line options
struct error_cmdline : public std::exception
{
    std::string msg; ///< error message returned by what()

    /// @param msg error message
    error_cmdline(const std::string& msg) : msg(msg) {}
    ~error_cmdline() throw () {}

    virtual const char* what() const throw () { return msg.c_str(); }

    /// Throw the exception, building the message printf-style
    static void throwf(const char* fmt, ...) WREPORT_THROWF_ATTRS(1, 2);
};


/**
 * Print informations about the last error to stderr
 */
void dba_cmdline_print_dba_error();

/**
 * Print an error that happened when parsing commandline arguments, then add
 * usage informations and exit
 */
void dba_cmdline_error(poptContext optCon, const char* fmt, ...) __attribute__ ((noreturn));

/**
 * Return the ::dba_encoding that corresponds to the name in the string
 */
Encoding dba_cmdline_stringToMsgType(const char* type);

/**
 * Process commandline arguments and perform the action requested
 */
int dba_cmdline_dispatch_main(const struct program_info* pinfo, const struct tool_desc* desc, int argc, const char* argv[]);

/**
 * Get a DB-ALLe query from commandline parameters in the form key=value
 *
 * @return the number of key=value pairs found
 */
unsigned dba_cmdline_get_query(poptContext optCon, Record& query);

/**
 * List available output templates
 */
void list_templates();

/// Read all the command line arguments and return them as a list
std::list<std::string> get_filenames(poptContext optCon);

} // namespace cmdline
} // namespace dballe

/* vim:set ts=4 sw=4: */
#endif