[Initng-svn] r3816 - in initng/trunk: plugins/iparser plugins/syslog
svn at initng.thinktux.net
svn at initng.thinktux.net
Tue Apr 18 11:10:00 CEST 2006
Author: jimmy
Date: Tue Apr 18 11:09:56 2006
New Revision: 3816
Added:
initng/trunk/tools/itype.c
Modified:
initng/trunk/plugins/iparser/initng_i_parser.c
initng/trunk/plugins/syslog/initng_syslog.c
initng/trunk/tools/CMakeLists.txt
initng/trunk/tools/Makefile.am
Log:
Adding an ifiles utility tool.
Modified: initng/trunk/plugins/iparser/initng_i_parser.c
==============================================================================
--- initng/trunk/plugins/iparser/initng_i_parser.c (original)
+++ initng/trunk/plugins/iparser/initng_i_parser.c Tue Apr 18 11:09:56 2006
@@ -42,8 +42,8 @@
#include <initng-paths.h>
#define ENDED(x) (!(x)[0] || (x)[0]=='\n')
-char *g_filename = NULL;
-char *g_pointer = NULL; /* a pointer to the first char we can back step to when printing line copies */
+const char *g_filename = NULL;
+const char *g_pointer = NULL; /* a pointer to the first char we can back step to when printing line copies */
/* set this to have a really verbose walking output */
@@ -55,10 +55,10 @@
static void err_print_line2t(char *point, const char *message, e_mt err,
const char *file, const char *func,
int codeline);
-static service_cache_h *parse_file(char *filename, const char *watch_for);
+static service_cache_h *parse_file(const char *filename, const char *watch_for);
static int parse_service_line(char **to_parse, const char *watch_for,
service_cache_h * father, stype_h * type,
- char *filename, service_cache_h ** match,
+ const char *filename, service_cache_h ** match,
service_cache_h ** exact_match);
static int parse_opt(char **where, stype_h * type, service_cache_h * srv);
@@ -156,6 +156,15 @@
return (NULL);
}
+ /* check if service to find is a filename */
+ if(service_to_find[0]=='/')
+ {
+ /* sending null returns the first found */
+ got_serv = parse_file(service_to_find, NULL);
+ if(got_serv)
+ return(got_serv);
+ }
+
/*
* now set up path and service.
* if service_to_find is system/initial/udevd
@@ -266,7 +275,7 @@
}
/* parse a file for services */
-static service_cache_h *parse_file(char *filename, const char *watch_for)
+static service_cache_h *parse_file(const char *filename, const char *watch_for)
{
/* Pointer to content read, and pointer to where we are reading */
char *file_content = NULL;
@@ -279,7 +288,6 @@
/* standard assertions */
assert(filename);
- assert(watch_for);
/* set the error message filename */
g_filename = filename;
@@ -388,7 +396,7 @@
}
#ifdef DEBUG
- if (!match)
+ if (!match && watch_for)
D_("%s - no match", watch_for);
#endif
@@ -399,7 +407,7 @@
static int parse_service_line(char **to_parse, const char *watch_for,
service_cache_h * father, stype_h * type,
- char *filename, service_cache_h ** match,
+ const char *filename, service_cache_h ** match,
service_cache_h ** exact_match)
{
char *name = NULL;
@@ -413,7 +421,6 @@
assert(to_parse);
assert(*to_parse);
- assert(watch_for);
/* for debugging */
DL_(*to_parse, "parse_service_line:");
@@ -667,6 +674,13 @@
set_string(&FROM_FILE, new_service, i_strdup(filename));
+ /* if not watching for anything special */
+ if(!watch_for)
+ {
+ (*exact_match) = new_service;
+ return (TRUE);
+ }
+
if (strcmp(new_service->name, watch_for) == 0)
{
Modified: initng/trunk/plugins/syslog/initng_syslog.c
==============================================================================
--- initng/trunk/plugins/syslog/initng_syslog.c (original)
+++ initng/trunk/plugins/syslog/initng_syslog.c Tue Apr 18 11:09:56 2006
@@ -320,7 +320,7 @@
/* Don't clutter syslog in fake mode */
if (getpid() != 1 || !g.i_am_init)
{
- W_("Pid is not 1, (%i), or g.i_am_init not set and the syslog plugin won't load when running in fake mode, to prevent cluttering up the log-files.\n", getpid());
+ D_("Pid is not 1, (%i), or g.i_am_init not set and the syslog plugin won't load when running in fake mode, to prevent cluttering up the log-files.\n", getpid());
return (TRUE);
}
D_("Initializing syslog plugin\n");
Modified: initng/trunk/tools/CMakeLists.txt
==============================================================================
--- initng/trunk/tools/CMakeLists.txt (original)
+++ initng/trunk/tools/CMakeLists.txt Tue Apr 18 11:09:56 2006
@@ -1,7 +1,12 @@
+INCLUDE_DIRECTORIES( ${CMAKE_SOURCE_DIR}/src ${CMAKE_BINARY_DIR} )
+
ADD_EXECUTABLE(killalli5 killall5.c)
+ADD_EXECUTABLE(itype itype.c)
INSTALL_TARGETS(/sbin killalli5)
INSTALL_PROGRAMS(/sbin initng-segfault)
+TARGET_LINK_LIBRARIES(itype initng)
+
IF (INSTALL_AS_INIT)
ADD_EXECUTABLE(mountpoint mountpoint.c)
INSTALL_TARGETS(/sbin mountpoint)
Modified: initng/trunk/tools/Makefile.am
==============================================================================
--- initng/trunk/tools/Makefile.am (original)
+++ initng/trunk/tools/Makefile.am Tue Apr 18 11:09:56 2006
@@ -1,6 +1,12 @@
+AM_CPPFLAGS = -I$(top_srcdir)/src
+
+itype_SOURCES = \
+ itype.c
+itype_LDADD = $(top_builddir)/src/libinitng.la
+
sbin_SCRIPTS = initng-segfault
-sbin_PROGRAMS = killalli5
+sbin_PROGRAMS = killalli5 itype
if INSTALL_AS_INIT
sbin_PROGRAMS += mountpoint sulogin
More information about the Initng-svn
mailing list