* Licensed under the GPL v2. For licencing details see COPYING.
*/
-/** \file adu.h Global definitions. */
+/** \file adu.h \brief Global definitions. */
#include <sys/stat.h>
#include <fcntl.h>
/** Log messages with lower priority than that will not be compiled in. */
#define COMPILE_TIME_LOGLEVEL 0
+/**
+ * A variant of static inline that requires the object being documented.
+ *
+ * If doxygen finds the \p static keyword in any context, that part will not be
+ * included in the documentation. However, we want static inline functions in
+ * header files to be documented while static functions in C files and
+ * statically declared variables should be left out. As a workaround for this
+ * flaw we use \p _static_inline_ for static inline functions declared in
+ * header files.
+ */
+#define _static_inline_ static inline
+
/** \cond */
#if DEBUG > COMPILE_TIME_LOGLEVEL
#define DEBUG_LOG(f,...) __log(DEBUG, "%s: " f, __FUNCTION__, ## __VA_ARGS__)
*
* \sa osl_compare_func, osl_hash_compare().
*/
-static inline int uint64_compare(const struct osl_object *obj1,
+_static_inline_ int uint64_compare(const struct osl_object *obj1,
const struct osl_object *obj2)
{
uint64_t d1 = read_u64((const char *)obj1->data);
* equal, the address of \a obj1 and \a obj2 are compared. So this compare function
* returns zero if and only if \a obj1 and \a obj2 point to the same memory area.
*/
-static inline int size_compare(const struct osl_object *obj1, const struct osl_object *obj2)
+_static_inline_ int size_compare(const struct osl_object *obj1, const struct osl_object *obj2)
{
uint64_t d1 = *(uint64_t *)obj1->data;
uint64_t d2 = *(uint64_t *)obj2->data;
return ret;
}
+/**
+ * The main function of the create mode.
+ *
+ * \return Standard.
+ */
int com_create(void)
{
uint64_t zero = 0ULL;
* Licensed under the GPL v2. For licencing details see COPYING.
*/
+/** \file error.h \brief Error handling functions and macros. */
+
/**
* This bit indicates whether a number is considered a system error code.
* If yes, the system errno is just the result of clearing this bit from
/** Set the system error bit for the given number. */
#define ERRNO_TO_ERROR(num) ((num) | (1 << SYSTEM_ERROR_BIT))
+/** The list of all adu error codes with descriptions. */
#define ALL_ERRORS \
_ERROR(SUCCESS, "success") \
_ERROR(SYNTAX, "syntax error") \
*/
#define _ERROR(err, msg) E_ ## err,
+/**
+ * \cond (doxygen can not handle multiple definitions of the same macro).
+ *
+ * This just creates an enum consisting of the first argument of the above
+ * error list.
+ */
enum error_codes {
ALL_ERRORS
};
#undef _ERROR
+
+/*
+ * Here we define the array of error texts used by adu_strerror().
+ */
#define _ERROR(err, msg) msg,
#define DEFINE_ERRLIST char *adu_errlist[] = {ALL_ERRORS}
+/** \endcond */
extern int osl_errno;
+
+/** Contains the description of all adu error codes. */
extern char *adu_errlist[];
*
* \return The error text of \a num.
*/
-static inline const char *adu_strerror(int num)
+_static_inline_ const char *adu_strerror(int num)
{
assert(num > 0);
if (num == E_OSL) {
/**
* Wrapper for osl library calls.
*
+ * \param ret The return value of an osl library function.
+ *
* This should be used for all calls to osl functions that return an osl error
* code. It changes the return value to \p -E_OSL appropriately so that it can
* be used for printing the correct error message.
*
* \return \a ret if \a ret >= 0, \p -E_OSL otherwise.
*/
-static inline int osl(int ret)
+_static_inline_ int osl(int ret)
{
if (ret >= 0)
return ret;
* Licensed under the GPL v2. For licencing details see COPYING.
*/
-/** \file fd.h exported symbols from fd.c */
+/** \file fd.h \brief Exported symbols from fd.c */
int adu_opendir(const char *dirname, DIR **dir, int *cwd);
int adu_fchdir(int fd);
#include "error.h"
#include "format.h"
+/** The three different alignment types. */
enum alignment {ALIGN_LEFT, ALIGN_RIGHT, ALIGN_CENTER};
struct num_format {
* Licensed under the GPL v2. For licencing details see COPYING.
*/
-/** \file format.h Exported symbols from \p format.c. */
+/** \file format.h \brief Exported symbols from \p format.c. */
/** The possible types of format string directives (aka atoms). */
enum atom_type {
* Licensed under the GPL v2. For licencing details see COPYING.
*/
+/** \file interactive.c \brief Commands for interactive mode. */
+
#include <ctype.h> /* isspace() */
#include "adu.h"
static struct uid_range *admissible_uids;
static struct format_info *fi;
+/** The set of supported interactive commands. */
#define INTERACTIVE_COMMANDS \
INTERACTIVE_COMMAND(set, "change the current configuration") \
INTERACTIVE_COMMAND(reset, "reset configuration to defaults") \
INTERACTIVE_COMMAND(source, "read and execute interactive commands from a file")
+/** \cond doxygen is not smart enough for this */
#define INTERACTIVE_COMMAND(name, desc) \
static int icom_ ## name (char *line);
INTERACTIVE_COMMANDS
{.name = NULL}
};
+/** \endcond */
+/** Iterate over the list of all interactive commands. */
#define FOR_EACH_COMMAND(c) for (c = icmds; c->name; c++)
static int read_input_line(char *line, size_t size)
return 1;
}
+/**
+ * Print the list of commands with short descriptions.
+ */
void print_interactive_help(void)
{
struct interactive_command *c;
return ret;
}
+/**
+ * The main function for interactive mode.
+ *
+ * \return Standard.
+ */
int com_interactive(void)
{
char line[255];
* Licensed under the GPL v2. For licencing details see COPYING.
*/
+/** \file select.h \brief Exported functions from string.c. */
int parse_select_options(char *string, struct select_cmdline_parser_params *params,
struct uid_range **admissible_uids, struct format_info **fi);
int run_select_query(struct uid_range *admissible_uids, struct format_info *fi);
}
/**
- * Split string and return pointers to its parts.
+ * Split a string and return pointers to its parts.
*
* \param args The string to be split.
* \param argv_ptr Pointer to the list of substrings.
* \param delim Delimiter.
*
* This function modifies \a args by replacing each occurance of \a delim by
- * zero. A \p NULL-terminated array of pointers to char* is allocated dynamically
+ * zero. A \p NULL terminated array of pointers to char* is allocated dynamically
* and these pointers are initialized to point to the broken-up substrings
* within \a args. A pointer to this array is returned via \a argv_ptr.
*
return n;
}
-enum line_state_flags {LSF_HAVE_WORD = 1, LSF_BACKSLASH = 2, LSF_QUOTE = 4};
static int get_next_word(const char *line, char **word)
{
+ enum line_state_flags {LSF_HAVE_WORD = 1, LSF_BACKSLASH = 2,
+ LSF_QUOTE = 4};
const char *in;
char *out;
int ret, state = 0;
return ret;
}
+/**
+ * Free an array of words created by create_argv().
+ *
+ * \param argv A pointer previously obtained by \ref create_argv().
+ */
void free_argv(char **argv)
{
int i;
}
/**
+ * Split a line into words which are separated by whitespace.
+ *
+ * In contrast to gengetopt's string parser, double quotes, backslash-escaped
+ * characters and special characters like \p \\n are honored. The result
+ * contains pointers to copies of the words contained in \line and has to be
+ * freed by using \ref free_argv().
+ *
+ * \param line The line to be split.
+ * \param result The array of words is returned here.
+ *
* \return Number of words in \a line, negative on errors.
*/
int create_argv(const char *line, char ***result)
* Licensed under the GPL v2. For licencing details see COPYING.
*/
-/** \file string.h exported sybmols from string.c */
+/** \file string.h \brief Exported sybmols from string.c */
__must_check __malloc void *adu_realloc(void *p, size_t size);
__must_check __malloc void *adu_malloc(size_t size);
* Licensed under the GPL v2. For licencing details see COPYING.
*/
+/** \file user.h \brief User structures and exported symbols from user.c. */
+
/** The columns of the id table. */
enum user_table_columns {
/** The numer of the directory. */