Merge tzcache utility into bongo-config

This commit is contained in:
alexhudson
2007-05-26 13:24:02 +00:00
parent 98639749ef
commit feeddba759
6 changed files with 27 additions and 68 deletions
-2
View File
@@ -132,7 +132,6 @@ include_subdirs := \
src/apps/manager \
src/apps/sendmail \
src/apps/setup \
src/apps/tzcache \
src/apps/mdbtool \
src/apps/queuetool \
src/apps/storetool \
@@ -198,7 +197,6 @@ include src/apps/config/Bongo.rules
include src/apps/manager/Bongo.rules
include src/apps/sendmail/Bongo.rules
include src/apps/setup/Bongo.rules
include src/apps/tzcache/Bongo.rules
include src/apps/mdbtool/Bongo.rules
# include src/apps/migrate/Bongo.rules
include src/apps/queuetool/Bongo.rules
-1
View File
@@ -693,7 +693,6 @@ src/apps/manager/Makefile
src/apps/admin/Makefile
src/apps/config/Makefile
src/apps/sendmail/Makefile
src/apps/tzcache/Makefile
src/apps/backup/Makefile
src/apps/mdbtool/Makefile
src/apps/queuetool/Makefile
+27
View File
@@ -24,11 +24,20 @@ usage() {
" install do the initial Bongo install\n"
" crypto generate data needed for encryption\n"
" checkversion see if a newer Bongo is available\n"
" tzcache regenerate cached timezone information\n"
"";
XplConsolePrintf("%s", usage);
}
void
RunAsBongoUser() {
if (XplSetRealUser(MsgGetUnprivilegedUser()) < 0) {
printf("bongotzcache: Could not drop to unpriviliged user '%s'\n", MsgGetUnprivilegedUser());
exit(-1);
}
}
BOOL
NMAPSimpleCommand(StoreClient *client, char *command) {
CCode ccode;
@@ -269,6 +278,19 @@ CheckVersion() {
}
}
void
TzCache() {
char path[PATH_MAX];
char *dbfdir = XPL_DEFAULT_DBF_DIR;
RunAsBongoUser();
snprintf(path, PATH_MAX, "%s/%s", dbfdir, "bongo-tz.cache");
unlink(path);
BongoCalInit(dbfdir);
}
int
main(int argc, char *argv[]) {
int next_arg = 0;
@@ -301,6 +323,8 @@ main(int argc, char *argv[]) {
command = 2;
} else if (!strcmp(argv[next_arg], "checkversion")) {
command = 3;
} else if (!strcmp(argv[next_arg], "tzcache")) {
command = 4;
} else {
printf("Unrecognized command: %s\n", argv[next_arg]);
}
@@ -327,6 +351,9 @@ main(int argc, char *argv[]) {
case 3:
CheckVersion();
break;
case 4:
TzCache();
break;
default:
break;
}
-23
View File
@@ -1,23 +0,0 @@
# -*- Makefile -*-
sbin_PROGRAMS += bongo-tzcache
bongo_tzcache_SOURCES := \
src/apps/tzcache/tzcache.c
bongo_tzcache_LDADD := \
libbongomdb.la \
libbongoconnio.la \
libbongomemmgr.la \
libbongoutil.la \
libbongoxpl.la \
libbongomsgapi.la \
libbongocal.la \
libbongoconnio.la \
$(top_builddir)/import/log4c/log4c/libbongolog4c.la \
$(PTHREAD_LIBS) \
$(ALL_LIBS)
src/apps/tzcache/all: bongo-tzcache
src/apps/tzcache/clean: clean
src/apps/tzcache/install:
@cd $(top_builddir) && $(MAKE) $(MFLAGS) sbin_PROGRAMS=bongo-tzcache install-sbinPROGRAMS
-17
View File
@@ -1,17 +0,0 @@
# -*- Makefile -*-
#
# Do not edit!
#
# (unless this is Makefile.am.subdir)
#
# This file is a copy of the toplevel Makefile.am.subdir. If changes
# need to be made, edit that file, and make update-makefiles, and
# check the new files in.
#
# This is a skeletal automake file. The real automake fules for
# building the targets for this directory can be found in the
# Bongo.rules file. This file is simply here so that 'make all' can
# work in each subdirectory.
all clean install:
@cd $(top_builddir) && $(MAKE) $(MFLAGS) $(subdir)/$@
-25
View File
@@ -1,25 +0,0 @@
#include <config.h>
#include <bongocal.h>
#include <msgapi.h>
int
main(int argc, char **argv)
{
char path[PATH_MAX];
if (XplSetRealUser(MsgGetUnprivilegedUser()) < 0) {
printf("bongotzcache: Could not drop to unpriviliged user '%s'\n", MsgGetUnprivilegedUser());
return 1;
}
MemoryManagerOpen("bongotzcache");
MsgInit();
snprintf(path, PATH_MAX, "%s/%s", MsgGetDBFDir(NULL), "bongo-tz.cache");
unlink(path);
BongoCalInit(MsgGetDBFDir(NULL));
return 0;
}