void pdebug (char *s, int a, int b, int c, int d, int e, int f, int g, int h);
void topini (void);
void clreol (int linep, int colp);
-void topmsg (int linep, char *buf, int a, int b, int c, int d, int e, int f, int g, int h);
-void topmsg1 (int linep, char *buf, char *a, int b, int c, int d, int e, int f, int g, int h);
-void topmsg2 (int linep, char *buf, char *a, int b, int c, int d, char *e, char *f, int g, int h);
+void topmsg (int linep, char *buf, ...);
+void topmsg1 (int linep, char *buf, ...);
+void topmsg2 (int linep, char *buf, ...);
void prompt (char *buf, int a, int b, int c, int d, int e, int f, int g, int h);
void prompt1 (char *buf, char *a, int b, int c, int d, int e, int f, int g, int h);
void prompt2 (char *buf, char *a, int b, int c, int d, char *e, char *f, int g, int h);
#include <stdlib.h>
#include <curses.h>
#include <ctype.h>
+#include <stdarg.h>
#include "empire.h"
#include "extern.h"
Write a message to one of the top lines.
*/
-void
-/* VARARGS2 */
-topmsg(int linep, char *buf,
- int a, int b, int c, int d, int e, int f, int g, int h)
+static void vtopmsg(int line, const char *fmt, va_list varglist)
+/* assemble command in printf(3) style, print to a top line */
{
- if (linep < 1 || linep > NUMTOPS)
- linep = 1;
- (void) move (linep - 1, 0);
+ char junkbuf[STRSIZE];
- if (buf != NULL && strlen (buf) > 0)
- addprintf (buf, a, b, c, d, e, f, g, h);
-
- (void) clrtoeol ();
+ if (line < 1 || line > NUMTOPS)
+ line = 1;
+ (void) move (line - 1, 0);
+ vsprintf(junkbuf, fmt, varglist);
+ (void) addstr (junkbuf);
+ (void) clrtoeol();
}
void
-topmsg1(int linep, char *buf, char *a,
- int b, int c, int d, int e, int f, int g, int h)
+topmsg(int line, char *fmt, ...)
{
- if (linep < 1 || linep > NUMTOPS)
- linep = 1;
- (void) move (linep - 1, 0);
-
- if (buf != NULL && strlen (buf) > 0)
- addprintf1 (buf, a, b, c, d, e, f, g, h);
-
- (void) clrtoeol ();
+ va_list ap;
+
+ va_start(ap, fmt);
+ vtopmsg(line, fmt, ap);
+ va_end(ap);
}
void
-topmsg2(int linep, char *buf,
- char *a, int b, int c, int d, char *e, char *f, int g, int h)
+topmsg1(int line, char *fmt, ...)
{
- if (linep < 1 || linep > NUMTOPS)
- linep = 1;
- (void) move (linep - 1, 0);
-
- if (buf != NULL && strlen (buf) > 0)
- addprintf2 (buf, a, b, c, d, e, f, g, h);
-
- (void) clrtoeol ();
+ va_list ap;
+
+ va_start(ap, fmt);
+ vtopmsg(line, fmt, ap);
+ va_end(ap);
+}
+
+void
+topmsg2(int line, char *fmt, ...)
+{
+ va_list ap;
+
+ va_start(ap, fmt);
+ vtopmsg(line, fmt, ap);
+ va_end(ap);
}
/*