From 544da8c704c14f2fd2533711dbf710c34d873e32 Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Fri, 16 Aug 2002 03:28:20 +0000 Subject: [PATCH] set up a default rc file, and change teh user rc to ~./openbox/epistrc --- util/epist/Makefile.am | 11 ++++++++++- util/epist/epist.cc | 17 ++++++++++++++++- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/util/epist/Makefile.am b/util/epist/Makefile.am index fed2326c..ac2120cf 100644 --- a/util/epist/Makefile.am +++ b/util/epist/Makefile.am @@ -1,6 +1,8 @@ # util/epist/Makefile.am for Blackbox - an X11 Window manager -CPPFLAGS= @CPPFLAGS@ @DEBUG@ +DEFAULT_RC=$(pkgdatadir)/epistrc + +CPPFLAGS= @CPPFLAGS@ @DEBUG@ -DDEFAULTRC=\"$(DEFAULT_RC)\" #EXTRA_PROGRAMS = epist bin_PROGRAMS = epist @@ -17,6 +19,13 @@ MAINTAINERCLEANFILES = Makefile.in distclean-local: rm -f *\~ .\#* +install-data-local: epistrc + test -f $(DESTDIR)$(pkgdatadir)/epistrc || \ + $(INSTALL_DATA) epistrc $(DESTDIR)$(pkgdatadir) + +uninstall-am: + rm -f $(DESTDIR)$(pkgdatadir)/epistrc + # local dependencies actions.o: actions.cc actions.hh diff --git a/util/epist/epist.cc b/util/epist/epist.cc index a0b1666a..a5b829b0 100644 --- a/util/epist/epist.cc +++ b/util/epist/epist.cc @@ -41,6 +41,16 @@ extern "C" { #ifdef HAVE_LIBGEN_H # include #endif // HAVE_LIBGEN_H + +#ifdef HAVE_UNISTD_H +# include +# include +#endif // HAVE_UNISTD_H + +#ifdef HAVE_SYS_STAT_H +# include +# include +#endif // HAVE_SYS_STAT_H } #include @@ -66,7 +76,12 @@ epist::epist(char **argv, char *dpy_name, char *rc_file) if (rc_file) _rc_file = rc_file; else - _rc_file = expandTilde("~/.epistrc"); + _rc_file = expandTilde("~/.openbox/epistrc"); + + struct stat buf; + if (0 != stat(_rc_file.c_str(), &buf) || + !S_ISREG(buf.st_mode)) + _rc_file = DEFAULTRC; _xatom = new XAtom(getXDisplay()); -- 2.39.2