root/op/1.30/defs.h

Revision 232, 1.9 kB (checked in by athomas, 4 years ago)
  • Added patch by Pierre fixing strnprintf issues.
  • Added patch by Pierre fixing wildcard constraint bug.
Line 
1 /* +-------------------------------------------------------------------+ */
2 /* | Copyright 1991, David Koblas.                                     | */
3 /* |   Permission to use, copy, modify, and distribute this software   | */
4 /* |   and its documentation for any purpose and without fee is hereby | */
5 /* |   granted, provided that the above copyright notice appear in all | */
6 /* |   copies and that both that copyright notice and this permission  | */
7 /* |   notice appear in supporting documentation.  This software is    | */
8 /* |   provided "as is" without express or implied warranty.           | */
9 /* +-------------------------------------------------------------------+ */
10
11 #include <unistd.h>
12 #include <limits.h>
13
14 typedef struct cmd_s {
15         char            *name;
16         int             nargs, nopts;
17         int             margs, mopts;
18         char            **args, **opts;
19         struct cmd_s    *next;
20 } cmd_t;
21
22 typedef struct var_s {
23         char *name, *value;
24         struct var_s *next;
25 } var_t;
26
27 typedef struct array_s {
28         void **data;
29         int size, capacity;
30 } array_t;
31
32 /* functions to manage a dynamically extensible array of pointers */
33 #define ARRAY_CHUNK     32
34 array_t *array_alloc();
35 void array_free(array_t *array);
36 array_t *array_free_contents(array_t *array);
37 void *array_push(array_t *array, void *object);
38 void *array_pop(array_t *array);
39 int array_extend(array_t *array, int capacity);
40
41 extern cmd_t    *First, *Build(), *BuildSingle();
42 extern var_t    *Variables;
43 extern unsigned minimum_logging_level;
44
45 void fatal(int logit, const char *format, ...);
46 int logger(unsigned flags, const char *format, ...);
47 void strnprintf(char *out, int len, const char *format, va_list ap);
48 char *strtolower(char *in);
49
50 int ReadFile(char *file);
51 int ReadDir(char *dir);
52 int CountArgs(cmd_t *cmd);
53 int atov(char *str, int type);
54
55 #define MAXSTRLEN       2048
56 #define OP_ACCESS       "/etc/op.conf"
57 #define OP_ACCESS_DIR   "/etc/op.d"
58 #define VERSION     "1.30"
59
60 #define VAR_EXPAND_LEN  8192
61 #define VAR_NAME_LEN    64     
62
63 #ifndef HOST_NAME_MAX
64 #define HOST_NAME_MAX   255
65 #endif
Note: See TracBrowser for help on using the browser.