ack/util/ceg/ce_back/obj_back/mysprint.c

29 lines
578 B
C
Raw Normal View History

1987-11-20 10:41:03 +00:00
#include <system.h>
#include "data.h"
1988-10-20 13:06:10 +00:00
#include <varargs.h>
1987-11-20 10:41:03 +00:00
1987-11-25 13:54:01 +00:00
/* Mysprint() stores the string directly in the string_arae. This saves
* a copy action. It is assumed that the strings stored in the string-table
* are never longer than MAXSTRLEN bytes.
1987-11-25 13:54:01 +00:00
*/
#define MAXSTRLEN 1024
1988-10-20 13:06:10 +00:00
/*VARARGS*/
int mysprint(va_alist)
va_dcl
1987-11-20 10:41:03 +00:00
{
char *fmt;
1988-10-20 13:06:10 +00:00
va_list args;
int retval;
va_start(args);
fmt = va_arg(args, char *);
while (string + MAXSTRLEN - string_area > size_string)
1988-10-20 13:06:10 +00:00
mem_string();
retval = _format(string, fmt, args);
string[retval] = '\0';
va_end(args);
return retval;
1987-11-20 10:41:03 +00:00
}