support %c for sprintf and make sprintf return a return string rather than a temp string

This commit is contained in:
Bill Currie 2006-12-19 14:15:27 +00:00 committed by Jeff Teunissen
parent d084264c3a
commit 4dba10d613
2 changed files with 7 additions and 2 deletions

View file

@ -586,8 +586,8 @@ PF_sprintf (progs_t *pr)
str = PR_NewMutableString (pr);
dstr = PR_GetMutableString (pr, str);
PR_Sprintf (pr, dstr, "PF_sprintf", fmt, count, args);
PR_MakeTempString (pr, str);
R_STRING (pr) = str;
RETURN_STRING (pr, dstr->str);
dstring_delete (dstr);
}
/*

View file

@ -571,6 +571,10 @@ I_DoPrint (dstring_t *result, fmt_item_t *formatting)
dstring_appendstr (tmp, "s");
PRINT (string);
break;
case 'c':
dstring_appendstr (tmp, "c");
PRINT (integer);
break;
case 'i':
dstring_appendstr (tmp, "d");
PRINT (integer);
@ -723,6 +727,7 @@ PR_Sprintf (progs_t *pr, dstring_t *result, const char *name,
fi = &(*fi)->next;
break;
case 'i':
case 'c':
// integer
(*fi)->type = *c;
(*fi)->data.integer_var = P_INT (pr, fmt_count);