and some constants defined in `src/config.h`.
## Config files
-These have to go in IRCDDATADIR (`data` by default).
+These have to go in datadir (see below).
For TLS you gonna need to place your certificate and private key in
`cert.pem` and `key.pem` respectively.
With `--autojoin \#ircmoment` clients will automatically join the `#ircmoment`
channel. This option can be specified multiple times.
+
+Data directory can be configured with `--datadir` argument. The default can be
+configured at compile time via IRCDDATADIR define. Otherwise it deafults to
+LOCALSTATEDIR/lib/patchyircd if LOCALSTATEDIR is defined. Otherwise it's "data"
+in the working directory.
#ifndef IRCDHOSTNAME
#define IRCDHOSTNAME "example.com"
#endif
-#ifndef IRCDDATADIR
-#define IRCDDATADIR "data"
-#endif
return fprintf(stderr, "not enough parameters\n"), 1;
autojoin.add(argv[i+1]);
i += 1;
+ } else if(!strcmp(argv[i], "--datadir")) {
+ if (i + 1 >= argc)
+ return fprintf(stderr, "not enough parameters\n"), 1;
+ datadir = argv[i+1];
+ i += 1;
} else {
return fprintf(stderr, "unknown flag '%s'\n", argv[i]), 1;
}
return 1;
}
-static const char *datadir = IRCDDATADIR;
+#ifndef IRCDDATADIR
+# ifdef LOCALSTATEDIR
+# define IRCDDATADIR LOCALSTATEDIR "/lib/patchyircd"
+# else
+# define IRCDDATADIR "data"
+# endif
+#endif
+const char *datadir = IRCDDATADIR;
const char *getdatafile(const char *fn)
{
static char buf[256];
time_t get_time(void);
void set_time(time_t t);
int irc_glob(const char *key, const char *mask);
+extern const char *datadir;
const char *getdatafile(const char *fn);
#endif