summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@sun.com>2009-09-17 18:08:06 -0700
committerAlan Coopersmith <alan.coopersmith@sun.com>2009-09-17 18:08:06 -0700
commita7e166298a94c012420713dbfcd0b1628f5c7062 (patch)
treefa38a0cb59342b3acf0f79eb68c47f18bdaf9490
parente60cf4a084951e697516a6c26dcb5ad14e6f14b8 (diff)
Unrecognized argument errors shouldn't print xdm error header repeatedly
Add LogAppend function to append to previous LogError/LogInfo without repeating the xdm error message header. Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
-rw-r--r--dm_error.h1
-rw-r--r--error.c15
-rw-r--r--resource.c4
3 files changed, 18 insertions, 2 deletions
diff --git a/dm_error.h b/dm_error.h
index d1f749d..e32ba0b 100644
--- a/dm_error.h
+++ b/dm_error.h
@@ -42,6 +42,7 @@ authorization.
extern void Debug (char * fmt, ...) GCC_PRINTFLIKE(1,2);
extern void InitErrorLog (void);
+extern void LogAppend (char * fmt, ...) GCC_PRINTFLIKE(1,2);
extern void LogError (char * fmt, ...) GCC_PRINTFLIKE(1,2);
extern void LogInfo (char * fmt, ...) GCC_PRINTFLIKE(1,2);
extern void LogOutOfMem (char * fmt, ...) GCC_PRINTFLIKE(1,2);
diff --git a/error.c b/error.c
index 9b43420..f1cb951 100644
--- a/error.c
+++ b/error.c
@@ -44,6 +44,21 @@ from The Open Group.
#define WRITES(fd, buf) write(fd, buf, strlen(buf))
+/* Append more text to the log without a new header, right after
+ having called LogInfo or LogError */
+void LogAppend(char * fmt, ...)
+{
+ char buf[1024];
+
+ {
+ va_list args;
+ va_start(args, fmt);
+ vsnprintf (buf, sizeof buf, fmt, args);
+ va_end(args);
+ }
+ WRITES(STDERR_FILENO, buf);
+}
+
void LogInfo(char * fmt, ...)
{
char buf[1024];
diff --git a/resource.c b/resource.c
index 2ccfd4b..5c02da7 100644
--- a/resource.c
+++ b/resource.c
@@ -432,8 +432,8 @@ ReinitResources (void)
{
LogError ("extra arguments on command line:");
for (a = argv + 1; *a; a++)
- LogError (" \"%s\"", *a);
- LogError ("\n");
+ LogAppend (" \"%s\"", *a);
+ LogAppend ("\n");
}
free (argv);
}