File: options.h

package info (click to toggle)
buici-clock 0.3.7
  • links: PTS
  • area: main
  • in suites: slink
  • size: 736 kB
  • ctags: 840
  • sloc: cpp: 4,551; makefile: 397; sh: 224; yacc: 175; lex: 127
file content (88 lines) | stat: -rw-r--r-- 2,397 bytes parent folder | download | duplicates (5)
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
/* options.h
     $Id: options.h,v 1.3 1997/10/14 09:11:26 elf Exp $

   written by Marc Singer
   20 April 1996
   
   This file is part of the project CurVeS.  See the file README for
   more information.

   Copyright (C) 1996 Marc Singer

   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, or (at your option) any later version.

   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
   in a file called COPYING along with this program; if not, write to
   the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA
   02139, USA.

*/

#ifndef __OPTIONS_H__
#define __OPTIONS_H__

// ----- Inclusions

// ----- Constants

// ----- Typedefs

typedef enum {
  OptNonoption	= 0x0001,	// Option to use for non-options
  OptDefault	= 0x0002,	// Option to use when no other found
  OptArg	= 0x0004,	// Option has an argument
  OptCommand	= 0x0008,	// Option is a command, no dash prefix
  OptAllDash	= 0x0010,	// Long option recognized after one dash or two
  OptSetType	= 0x0f00,
  OptSetMask	= 0xff00,
  OptSetString	= 0x0100,
  OptSetInt	= 0x0200,
  OptSetShort	= 0x0400,
  OptSetLong	= 0x0800,
  OptClear	= 0x8000,
} E_Opt;

typedef enum {
  OptErrOk		= 0,
  OptErrFail		= 1,	// Option function failed
  OptErrUnrecognized	= 2,	// Unrecognized option
  OptErrNoArgument	= 3,	// Argument missing
  OptErrBadOption	= 4,	// Error in option descriptions
  OptErrAmbiguous	= 5,	// Ambiguous partial
  OptErrExit		= 9,	// Used internally for quick exit
} E_OptErr;

struct _OPTION;

typedef int (*PFN_OPTION) (struct _OPTION* pOption, const char* pch);

typedef struct _OPTION {
  const char* sz;		// Text of option
  unsigned flags;
  void* pv;			// Pointer to option result
  PFN_OPTION pfn;		// Callback function
} OPTION;

// ----- Classes

// ----- Macros

// ----- Globals / Externals

// ----- Prototypes

char* parse_application (char* pch);
int parse_options (int argc, char** argv, OPTION* rgOptions, int* argc_used);


// ----- Inline

#endif		// __OPTIONS_H__