[Hugs-bugs] Source corrections

Per Johansson per at johansson.name
Thu Sep 30 14:15:04 EDT 2004


Hello.

I have compiled HUGS ( hugs98-Nov2003.tar.gz) using GCC 3.2.2 on OS/2. It was
rather easy, but there are two declarations (vsnprintf, snprintf) in the source
that don't conform with ISO C, since int is used instead of size_t (which is
unsigned int). I had make the following changes to compile. Replaced lines
marked // PJ.

In prelude.h:

// PJ extern int snprintf   Args((char*, int, const char*, ...));
extern int snprintf   Args((char*, size_t, const char*, ...));

// PJ extern int vsnprintf  Args((char*, int, const char*, va_list));
extern int vsnprintf  Args((char*, size_t, const char*, va_list));

In machdep.c:

// PJ int vsnprintf(char* buffer, int count, const char* fmt, va_list ap);
int vsnprintf(char* buffer, size_t count, const char* fmt, va_list ap);

// PJ int         count;
size_t         count;

// PJ int snprintf(char* buffer, int count, const char* fmt, ...);
int snprintf(char* buffer, size_t count, const char* fmt, ...);

// PJ int snprintf(char* buffer, int count, const char* fmt, ...) 
int snprintf(char* buffer, size_t count, const char* fmt, ...) {

-- 
Mr Per Johansson
mail: Oljekvarnsgatan 14B, SE-414 65 Göteborg, Suede
mobile phone: int +46 70 796 08 48
uri: http://per.johansson.name/
"it's a great idea, but possibly not, and I'm not being indecisive"


More information about the Hugs-Bugs mailing list