Commit 3cb583d2 authored by Peter Pentchev's avatar Peter Pentchev

Assume that we have proper variadic argument functions

parent 83fbb77d
......@@ -296,23 +296,12 @@ calc_sprint(char *s, struct calc_object_s object)
/* calc_print */
static int
#if USE_STDARG
calc_error(struct calc_object_s *x, const char *fmt, ...)
#else
calc_error(x, fmt, va_alist)
struct calc_object_s *x;
char *fmt;
va_dcl
#endif
{
va_list ap;
char buf[256];
#if USE_STDARG
va_start(ap, fmt);
#else
va_start(ap);
#endif
vsprintf(buf, fmt, ap);
if (x->type != CO_ERROR) {
x->type = CO_ERROR;
......
......@@ -13,6 +13,3 @@
#define NEED_ALLOCA_H 0
#define HAVE_STRERROR 0
#define HAVE_VASPRINTF 0
#define USE_STDARG 0
......@@ -13,6 +13,3 @@
#define NEED_ALLOCA_H 0
#define HAVE_STRERROR 1
#define HAVE_VASPRINTF 0
#define USE_STDARG 1
......@@ -13,6 +13,3 @@
#define NEED_ALLOCA_H 1
#define HAVE_STRERROR 1
#define HAVE_VASPRINTF 1
#define USE_STDARG 1
......@@ -13,6 +13,3 @@
#define NEED_ALLOCA_H 0
#define HAVE_STRERROR 1
#define HAVE_VASPRINTF 0
#define USE_STDARG 1
......@@ -13,6 +13,3 @@
#define NEED_ALLOCA_H 1
#define HAVE_STRERROR 1
#define HAVE_VASPRINTF 0
#define USE_STDARG 0
......@@ -80,26 +80,14 @@ struct he_message_s *he_messages;
char *alternate_buffer;
const char *he_pagerprg;
#if USE_STDARG
void
he_message(int beep, const char *fmt, ...)
#else
void
he_message(beep, fmt, va_alist)
int beep;
const char *fmt;
va_dcl
#endif
{
va_list ap;
struct he_message_s *m;
/* int length; */
#if USE_STDARG
va_start(ap, fmt);
#else
va_start(ap);
#endif
/* length = tio_nprintf(fmt, ap); */
m = (struct he_message_s *)malloc(sizeof(struct he_message_s));
m->next = he_messages;
......@@ -537,26 +525,14 @@ he_query_command(prompt, dfl, context)
}
/* he_query_command */
#if USE_STDARG
int
he_query_yn(int dfl, const char *fmt, ...)
#else
int
he_query_yn(dfl, fmt, va_alist)
int dfl;
const char *fmt;
va_dcl
#endif
{
va_list ap;
int key;
int choice;
#if USE_STDARG
va_start(ap, fmt);
#else
va_start(ap);
#endif
tio_keypad(0);
restart:
tio_goto_line(hx_lines - 1);
......
......@@ -50,11 +50,7 @@
#include "defs.h"
#include <stdio.h>
#ifdef USE_STDARG
#include <stdarg.h>
#else
#include <varargs.h>
#endif
#if HAVE_ALLOCA
#if NEED_ALLOCA_H
#include <alloca.h>
......@@ -125,11 +121,7 @@ struct he_message_s {
extern struct he_message_s *he_messages;
void
#if USE_STDARG
he_message( int beep, const char *fmt, ... );
#else
he_message( );
#endif
void
he_refresh_part(struct he_s *hedit, long pos1, long pos2);
......@@ -348,11 +340,7 @@ char *
he_query_command(const char *, const char *, int);
int
#if USE_STDARG
he_query_yn( int dfl, const char *fmt, ... );
#else
he_query_yn( );
#endif
int
he_mainloop(struct he_s *hedit);
......
......@@ -135,28 +135,15 @@ s_delete_option(option)
}
/* s_delete_option */
#if USE_STDARG
static void
s_append(struct option_s *last,
const char *option,
const enum s_option_e type, ...)
#else
static void
s_append(last, option, type, va_alist)
struct option_s *last;
const char *option;
const enum s_option_e type;
va_dcl
#endif
{
va_list ap;
struct option_s *i;
#if USE_STDARG
va_start(ap, type);
#else
va_start(ap);
#endif
i = (struct option_s *)malloc(sizeof(struct option_s));
i->type = type;
i->next = 0;
......
......@@ -495,24 +495,13 @@ vtencode(cmd, ap)
}
/* vtencode */
#if USE_STDARG
static char *
tencode(char *cmd, ...)
#else
static char *
tencode(cmd, va_alist)
char *cmd;
va_dcl
#endif
{
va_list ap;
char *buf;
#if USE_STDARG
va_start(ap, cmd);
#else
va_start(ap);
#endif
buf = vtencode(cmd, ap);
va_end(ap);
return buf;
......
......@@ -185,17 +185,10 @@ int tio_tite_f = 0;
* terminal.
*/
#if USE_STDARG
static void tio_error_msg( const char *fmt, ... );
static void tio_warning_msg( const char *fmt, ... );
void (*error_msg)( const char *, ... ) = tio_error_msg;
void (*warning_msg)( const char *, ... ) = tio_warning_msg;
#else
static void tio_error_msg( /* const char *fmt, ... */ );
static void tio_warning_msg( /* const char *fmt, ... */ );
void (*error_msg)( /* const char *, ... */ ) = tio_error_msg;
void (*warning_msg)( /* const char *, ... */ ) = tio_warning_msg;
#endif
void (*tio_winch)(void);
int hx_lines; /* Number of lines. */
......@@ -544,23 +537,12 @@ tio_isprint(int x)
}
/* tio_isprint */
#if USE_STDARG
static void
tio_error_msg(const char *fmt, ...)
#else
static void
tio_error_msg(fmt, va_alist)
const char *fmt;
va_dcl
#endif
{
va_list ap;
#if USE_STDARG
va_start(ap, fmt);
#else
va_start(ap);
#endif
fprintf(stderr, "%s: ", program_name);
vfprintf(stderr, fmt, ap);
fprintf(stderr, "\n");
......@@ -568,23 +550,12 @@ tio_error_msg(fmt, va_alist)
}
/* tio_error_msg */
#if USE_STDARG
static void
tio_warning_msg(const char *fmt, ...)
#else
static void
tio_warning_msg(fmt, va_alist)
const char *fmt;
va_dcl
#endif
{
va_list ap;
#if USE_STDARG
va_start(ap, fmt);
#else
va_start(ap);
#endif
fprintf(stderr, "%s: warning: ", program_name);
vfprintf(stderr, fmt, ap);
fprintf(stderr, "\n");
......@@ -626,16 +597,8 @@ tio_listcaps(void)
/* tio_listcaps */
#endif
#if USE_STDARG
static int
tio_command(const char *cmd, int affcnt, ...)
#else
static int
tio_command(cmd, affcnt, va_alist)
const char *cmd;
int affcnt;
va_dcl
#endif
/* send the command `cmd' to the terminal.
* return value: 0 if all goes well and -1 on error.
*/
......@@ -644,11 +607,7 @@ tio_command(cmd, affcnt, va_alist)
int arg1, arg2;
if (!cmd) return -1;
#if USE_STDARG
va_start(ap, affcnt);
#else
va_start(ap);
#endif
arg1 = va_arg(ap, int);
arg2 = va_arg(ap, int);
tputs(tgoto(cmd, arg2, arg1), affcnt, outc);
......@@ -1976,24 +1935,13 @@ tio_message(char **message, int indent)
}
/* tio_message */
#if USE_STDARG
int
tio_printf(const char *fmt, ...)
#else
int
tio_printf(fmt, va_alist)
const char *fmt;
va_dcl
#endif
{
va_list ap;
int rval;
#if USE_STDARG
va_start(ap, fmt);
#else
va_start(ap);
#endif
rval = tio_vprintf(fmt, ap);
va_end(ap);
return rval;
......@@ -2027,24 +1975,13 @@ tio_vprintf(const char *fmt, va_list ap)
}
/* tio_vprintf */
#if USE_STDARG
int
tio_raw_printf(const char *fmt, ...)
#else
int
tio_raw_printf(fmt, va_alist)
const char *fmt;
va_dcl
#endif
{
va_list ap;
int rval;
#if USE_STDARG
va_start(ap, fmt);
#else
va_start(ap);
#endif
rval = tio_raw_vprintf(fmt, ap);
va_end(ap);
return rval;
......
......@@ -111,11 +111,7 @@ extern struct t_keynames_s {
char *name;
} t_keynames[];
#if USE_STDARG
void (*error_msg)( const char *, ... );
#else
void (*error_msg)(const char *, ...);
#endif
/* Pointer to the error message function.
*/
......@@ -352,11 +348,7 @@ tio_message(char **message, int indent);
*/
int
#if USE_STDARG
tio_printf( const char *fmt, ... );
#else
tio_printf( );
#endif
int
tio_vprintf(const char *fmt, va_list);
......@@ -367,11 +359,7 @@ tio_vprintf(const char *fmt, va_list);
*/
int
#if USE_STDARG
tio_raw_printf( const char *fmt, ... );
#else
tio_raw_printf(const char *fmt, ...);
#endif
int
tio_raw_vprintf(const char *fmt, va_list);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment