
In short, there seem to be two good public domain printfs out there, just use those. Or, better yet, read them and figure out how they work, then do your own.

That's a very bad assumption to make, and IMHO.. and illegal one..Jeremiah Griffin wrote:There doesn't seem to be a copyright anywhere, so I'm assuming it's public domain.
My point exactly. A common misbelief (especially among hobbyist coders) is that if a license doesn't forbid something, it's implicitly allowed. The contrary is the case in most countries. The original Linux license said you are allowed to redistribute the kernel as long as you provide source and don't ask a commercial fee for it. It doesn't say zilch about modifying, using parts of it or anything. Linus might agree to you using early code snippets under GPL terms, but legally speaking that would still require written consent of all authors involved...Brynet-Inc wrote:That's a very bad assumption to make, and IMHO.. and illegal one..Jeremiah Griffin wrote:There doesn't seem to be a copyright anywhere, so I'm assuming it's public domain.![]()
Code: Select all
void printf (char format[], ... )
{
va_list arguments; // A place to store the list of arguments
int i, dz_fl=0;
char ch;
unsigned char uctmp;
signed char sctmp;
unsigned short ustmp;
signed short sstmp;
unsigned int uitmp;
signed int sitmp;
va_start(arguments, format);
for(i=0;i<strlen(format);i++)
{
ch = format[i];
if(dz_fl)
{
switch(ch)
{
case '%':
putch('%');
break;
case 'c':
putch(va_arg(arguments, char));
break;
case 's':
puts(va_arg(arguments, char));
break;
default:
break;
}
}
else
{
switch(ch)
{
case '%':
dz_fl=1;
break;
default:
if(ch != '%')
putch(ch);
break;
}
}
}
va_end(arguments);
}