diff options
author | Alan Coopersmith <alan.coopersmith@sun.com> | 2009-09-17 18:08:06 -0700 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@sun.com> | 2009-09-17 18:08:06 -0700 |
commit | a7e166298a94c012420713dbfcd0b1628f5c7062 (patch) | |
tree | fa38a0cb59342b3acf0f79eb68c47f18bdaf9490 | |
parent | e60cf4a084951e697516a6c26dcb5ad14e6f14b8 (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.h | 1 | ||||
-rw-r--r-- | error.c | 15 | ||||
-rw-r--r-- | resource.c | 4 |
3 files changed, 18 insertions, 2 deletions
@@ -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); @@ -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]; @@ -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); } |