]> git.sur5r.net Git - freertos/blob - FreeRTOS-Plus/Source/Reliance-Edge/include/redgetopt.h
Update version numbers in preparation for new release.
[freertos] / FreeRTOS-Plus / Source / Reliance-Edge / include / redgetopt.h
1 /*-\r
2  * Copyright (c) 2000 The NetBSD Foundation, Inc.\r
3  * All rights reserved.\r
4  *\r
5  * This code is derived from software contributed to The NetBSD Foundation\r
6  * by Dieter Baron and Thomas Klausner.\r
7  *\r
8  * Redistribution and use in source and binary forms, with or without\r
9  * modification, are permitted provided that the following conditions\r
10  * are met:\r
11  * 1. Redistributions of source code must retain the above copyright\r
12  *    notice, this list of conditions and the following disclaimer.\r
13  * 2. Redistributions in binary form must reproduce the above copyright\r
14  *    notice, this list of conditions and the following disclaimer in the\r
15  *    documentation and/or other materials provided with the distribution.\r
16  *\r
17  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS\r
18  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED\r
19  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\r
20  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS\r
21  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\r
22  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\r
23  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r
24  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\r
25  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r
26  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r
27  * POSSIBILITY OF SUCH DAMAGE.\r
28  */\r
29 /** @file\r
30     @brief Interfaces for getopt() and getopt_long() work-alike functions.\r
31 \r
32     This code was taken from FreeBSD and slightly modified, mostly to rename\r
33     symbols with external linkage to avoid naming conflicts in systems where\r
34     there are real getopt()/getopt_long() implementations.  Changed to use\r
35     fixed-width types to allow code using these interfaces to be consistent\r
36     with the rest of the product.\r
37 */\r
38 #ifndef REDGETOPT_H\r
39 #define REDGETOPT_H\r
40 \r
41 \r
42 #define red_no_argument         0\r
43 #define red_required_argument   1\r
44 #define red_optional_argument   2\r
45 \r
46 \r
47 /** @brief Specifies a long option.\r
48 */\r
49 typedef struct\r
50 {\r
51     /* name of long option */\r
52     const char *name;\r
53     /*\r
54      * one of red_no_argument, red_required_argument, and red_optional_argument:\r
55      * whether option takes an argument\r
56      */\r
57     int32_t has_arg;\r
58     /* if not NULL, set *flag to val when option found */\r
59     int32_t *flag;\r
60     /* if flag not NULL, value to set *flag to; else return value */\r
61     int32_t val;\r
62 } REDOPTION;\r
63 \r
64 \r
65 int32_t RedGetopt(int32_t nargc, char * const *nargv, const char *options);\r
66 int32_t RedGetoptLong(int32_t nargc, char * const *nargv, const char *options, const REDOPTION *long_options, int32_t *idx);\r
67 \r
68 \r
69 extern const char *red_optarg;\r
70 extern int32_t red_optind;\r
71 extern int32_t red_opterr;\r
72 extern int32_t red_optopt;\r
73 extern int32_t red_optreset;\r
74 \r
75 \r
76 #endif\r
77 \r