source: trunk/libtransmission/tr-getopt.h @ 12918

Last change on this file since 12918 was 11709, checked in by jordan, 11 years ago

Update the copyright year in the source code comments.

The Berne Convention says that the copyright year is moot, so instead of adding another year to each file as in previous years, I've removed the year altogether from the source code comments in libtransmission, gtk, qt, utils, daemon, and cli.

Juliusz's copyright notice in tr-dht and Johannes' copyright notice in tr-lpd have been left alone; it didn't seem appropriate to modify them.

  • Property svn:keywords set to Date Rev Author Id
File size: 1.9 KB
RevLine 
[6297]1/*
[11709]2 * This file Copyright (C) Mnemosyne LLC
[6297]3 *
[11599]4 * This file is licensed by the GPL version 2. Works owned by the
[8637]5 * Transmission project are granted a special exemption to clause 2(b)
6 * so that the bulk of its code can remain under the MIT license.
7 * This exemption does not extend to derived works not owned by
8 * the Transmission project.
[6297]9 *
[8637]10 * $Id: tr-getopt.h 11709 2011-01-19 13:48:47Z jordan $
[6297]11 */
12
13#ifndef TR_GETOPT_H
14#define TR_GETOPT_H
15
[8071]16#ifdef __cplusplus
17extern "C" {
18#endif
19
[8561]20/**
21 * @addtogroup utils Utilities
[8903]22 * @{
[8561]23 */
24
[9845]25/** @brief Similar to optind, this is the current index into argv */
[6297]26extern int tr_optind;
27
28typedef struct tr_option
29{
[7888]30    int           val;          /* the value to return from tr_getopt() */
[7783]31    const char *  longName;     /* --long-form */
32    const char *  description;  /* option's description for tr_getopt_usage() */
33    const char *  shortName;    /* short form */
[7888]34    int           has_arg;      /* 0 for no argument, 1 for argument */
[7783]35    const char *  argName;      /* argument's description for tr_getopt_usage() */
[6297]36}
37tr_option;
38
39enum
40{
41    /* all options have been processed */
42    TR_OPT_DONE = 0,
43
44    /* a syntax error was detected, such as a missing
45     * argument for an option that requires one */
46    TR_OPT_ERR = -1,
47
48    /* an unknown option was reached */
49    TR_OPT_UNK = -2
50};
51
52/**
[9845]53 * @brief similar to getopt()
54 * @return TR_GETOPT_DONE, TR_GETOPT_ERR, TR_GETOPT_UNK, or the matching tr_option's `val' field
[6297]55 */
[9845]56int  tr_getopt( const char       * summary,
57                int                argc,
58                const char      ** argv,
59                const tr_option  * opts,
60                const char      ** setme_optarg );
[6297]61
[9845]62/** @brief prints the `Usage' help section to stdout */
63void tr_getopt_usage( const char       * appName,
64                      const char       * description,
65                      const tr_option  * opts );
[6297]66
[8071]67#ifdef __cplusplus
68} /* extern "C" */
69#endif
70
[8561]71/** @} */
72
[6297]73#endif /* TR_GETOPT_H */
Note: See TracBrowser for help on using the repository browser.