Updated email address and copyright.
[userinfo.git] / src / ui.h
blob735b6d11f827770466717ed8a851454365ac0d2d
1 /*
2 Copyright (C) 2001-2006 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 02111-1307 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-2006 " 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)
65 enum {
66 OUTPUT_DONE,
67 OUTPUT_APPEND
70 /* These are functions found in loadable modules. */
71 typedef void (module_init) (int *);
72 typedef void (module_exit) (void);
73 typedef void (module_help) (void);
74 typedef char *(module_options_init) (char **);
75 typedef int (module_options) (int argc, char **argv);
76 typedef int (module_exec) (char ***, const struct passwd *, const int,
77 const int, char *);
79 struct module {
80 char name[64]; /* The filename of the module. */
81 void *m; /* The module handle. */
82 unsigned flags; /* dup, chained, chainable, and output. */
83 } *modules;
85 static int verbose, delimchar, multichar, usefile;
86 static int followsymlinks;
87 static char tf[TIMEBUFSIZE];
88 static int chaining;
89 static int chain_output;
90 static int module_index;
92 #ifdef HAVE___PROGNAME
93 extern char *__progname;
94 #else
95 static char *__progname;
96 #endif
98 #ifdef WITH_DMALLOC
99 #include <dmalloc.h>
100 #endif
102 #endif