Updated the copyright year.
[userinfo.git] / src / ui.h
blob6a58653dd609ddc6f874adc82c850572acf2615e
1 /*
2 Copyright (C) 2001-2011 Ben Kibbey <bjk@luxsci.net>
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02110-1301 USA
18 #ifndef UI_H
19 #define UI_H
21 #ifdef HAVE_LIBGEN_H
22 #include <libgen.h>
23 #endif
25 #ifdef HAVE_DLFCN_H
26 #include <dlfcn.h>
27 #endif
29 #ifdef HAVE_STRING_H
30 #include <string.h>
31 #endif
33 #ifdef HAVE_ERR_H
34 #include <err.h>
35 #endif
37 #ifdef HAVE_LIMITS_H
38 #include <limits.h>
39 #endif
41 #ifdef HAVE_PATHS_H
42 #include <paths.h>
43 #else
44 #ifndef _PATH_DEV
45 #define _PATH_DEV "/dev/"
46 #endif
47 #endif
49 #define COPYRIGHT "Copyright (C) 2001-2011 " PACKAGE_BUGREPORT
50 #define STAT(file, sstat) ((followsymlinks) ? stat(file, sstat) : lstat(file, sstat))
51 #define TIMEBUFSIZE 64
52 #define UNKNOWN "!"
53 #define NONE "-"
54 #define ON "1"
55 #define OFF "0"
56 #define MODULE_DUP 0x001
57 #define MODULE_OUTPUT 0x002
58 #define MODULE_CHAINED 0x004
59 #define MODULE_CHAINABLE 0x008
60 #define MODULE_VERBOSE 0x010
61 #define SET_FLAG(var, f) (var |= f)
62 #define TEST_FLAG(var, f) (var & f)
64 enum {
65 OUTPUT_DONE,
66 OUTPUT_APPEND
69 /* These are functions found in loadable modules. */
70 typedef void (module_init) (int *);
71 typedef void (module_exit) (void);
72 typedef void (module_help) (void);
73 typedef char *(module_options_init) (char **);
74 typedef int (module_options) (int argc, char **argv);
75 typedef int (module_exec) (char ***, const struct passwd *, const int,
76 const int, char *);
78 struct module {
79 char name[64]; /* The filename of the module. */
80 void *m; /* The module handle. */
81 unsigned flags; /* dup, chained, chainable, and output. */
82 } *modules;
84 static int verbose, delimchar, multichar, usefile;
85 static int followsymlinks;
86 static char tf[TIMEBUFSIZE];
87 static int chaining;
88 static int chain_output;
89 static int module_index;
91 #ifdef HAVE___PROGNAME
92 extern char *__progname;
93 #else
94 static char *__progname;
95 #endif
97 #ifdef WITH_DMALLOC
98 #include <dmalloc.h>
99 #endif
101 #endif