+void start_log(int argc, char **argv)
+{
+ char logname[2048];
+ if (!argv)
+ return;
+ if (!argv[0])
+ return;
+ sprintf(logname, "%s.log", argv[0]);
+ yaz_log_init_file(logname);
+ log_level = yaz_log_mask_str_x(argv[0],0);
+ yaz_log_init_level(YLOG_DEFAULT_LEVEL | log_level);
+ yaz_log(log_level,"starting %s",argv[0]);
+}
+
+/**
+ * start_up : do common start things, and a zebra_start
+ * - nmem_init
+ * - build the name of logfile from argv[0], and open it
+ * if no argv passed, do not open a log
+ * - read zebra.cfg from env var srcdir if it exists; otherwise current dir
+ * default to zebra.cfg, if no name is given
+ */
+ZebraService start_up(char *cfgname, int argc, char **argv)
+{
+ nmem_init();
+ start_log(argc, argv);
+ return start_service(cfgname);
+}
+
+/**
+ * get_srcdir: return env srcdir or . (if does does not exist)
+ */
+const char *get_srcdir()
+{
+ const char *srcdir = getenv("srcdir");
+ if (!srcdir || ! *srcdir)
+ srcdir=".";
+ return srcdir;
+
+}
+/** start_service - do a zebra_start with a decent config name */