ctdlsh now has two working commands, 'date' and 'passwd'
[citadel.git] / ctdlsh / src / ctdlsh.h
1 #include <config.h>
2 #include <stdlib.h>
3 #include <unistd.h>
4 #include <stdio.h>
5 #include <signal.h>
6 #include <sys/types.h>
7 #include <sys/time.h>
8 #include <sys/socket.h>
9 #include <sys/un.h>
10 #include <string.h>
11 #include <pwd.h>
12 #include <time.h>
13 #include <errno.h>
14 #include <stdarg.h>
15 #include <fcntl.h>
16 #include <errno.h>
17 #include <readline/readline.h>
18
19 /*
20  * Set to the location of Citadel
21  * FIXME this needs to be configurable
22  */
23 #define CTDLDIR "/appl/citadel"
24
25 /*
26  * This is a small subset of 'struct config' ... don't worry about the rest; we
27  * only need to snarf the c_ipgm_secret.
28  */
29 struct partial_config {
30         char c_nodename[16];            /* Unqualified "short" nodename     */
31         char c_fqdn[64];                /* Fully Qualified Domain Name      */
32         char c_humannode[21];           /* Long name of system              */
33         char c_phonenum[16];            /* Dialup number of system          */
34         uid_t c_ctdluid;                /* UID under which we run Citadel   */
35         char c_creataide;               /* room creator = room aide  flag   */
36         int c_sleeping;                 /* watchdog timer setting           */
37         char c_initax;                  /* initial access level             */
38         char c_regiscall;               /* call number to register on       */
39         char c_twitdetect;              /* twit detect flag                 */
40         char c_twitroom[128];           /* twit detect msg move to room     */
41         char c_moreprompt[80];          /* paginator prompt                 */
42         char c_restrict;                /* restrict Internet mail flag      */
43         long c_niu_1;                   /* (not in use)                     */
44         char c_site_location[32];       /* physical location of server      */
45         char c_sysadm[26];              /* name of system administrator     */
46         char c_niu_2[15];               /* (not in use)                     */
47         int c_setup_level;              /* what rev level we've setup to    */
48         int c_maxsessions;              /* maximum concurrent sessions      */
49         char c_ip_addr[20];             /* IP address to listen on          */
50         int c_port_number;              /* Cit listener port (usually 504)  */
51         int c_ipgm_secret;              /* Internal program authentication  */
52 };
53
54 typedef int ctdlsh_cmdfunc_t(int, char *);
55
56 enum ctdlsh_cmdfunc_return_values {
57         cmdret_ok,
58         cmdret_exit,
59         cmdret_error
60 };
61
62 int cmd_help(int, char *);
63 int cmd_quit(int, char *);
64 int cmd_datetime(int, char *);
65 int cmd_passwd(int, char *);