Strip output when loading .conf files.

If not standard finit.conf, then we want to show just the base name.
E.g., loading first /etc/finit.conf then /etc/finit.d/services.conf

Loading configuration ............. vs
Loading services configuration ....

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson committed 2014-04-21 15:46:09 +02:00
1 parent 292a3be515
commit 720f1b0e5b
1 file changed
+16 -2
+16 -2
View File
@@ -89,7 +89,7 @@ int parse_runlevels(char *runlevels)
static int parse_conf(char *file) static int parse_conf(char *file)
{ {
FILE *fp; FILE *fp;
char line[LINE_SIZE]; char line[LINE_SIZE] = "";
char cmd[CMD_SIZE]; char cmd[CMD_SIZE];
char *x; char *x;
const char *err = NULL; const char *err = NULL;
@@ -98,7 +98,21 @@ static int parse_conf(char *file)
if (!fp) if (!fp)
return 1; return 1;
print(2, "Loading %s", file); /*
* If not standard finit.conf, then we want to show just the base name
* Loading configuration ............. vs
* Loading services configuration ....
*/
if (!string_match (file, FINIT_CONF)) {
x = strrchr(file, '/');
if (!x) x = file;
else x++;
strlcpy(line, x, sizeof(line));
x = strstr(line, ".conf");
if (x) *x = 0;
}
print(0, "Loading %sconfiguration", line);
while (!feof(fp)) { while (!feof(fp)) {
if (!fgets(line, sizeof(line), fp)) if (!fgets(line, sizeof(line), fp))
continue; continue;