FreeCalypso > hg > freecalypso-sw
annotate target-utils/libprintf/sprintf.c @ 30:af6d763badfb
loadtools: install target added
author | Michael Spacefalcon <msokolov@ivan.Harhan.ORG> |
---|---|
date | Sat, 04 May 2013 07:23:01 +0000 |
parents | 40f607bb0a2c |
children |
rev | line source |
---|---|
4
5c7b3d5d5702
libprintf compiles with Anshit C GCC
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
3
diff
changeset
|
1 #include <stdarg.h> |
3
45bf8af5f061
libprintf brought in from older PPC/m68k code, but fucking GCC
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
2 |
45bf8af5f061
libprintf brought in from older PPC/m68k code, but fucking GCC
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
3 extern void _sprintf_putchar(); |
45bf8af5f061
libprintf brought in from older PPC/m68k code, but fucking GCC
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
4 |
45bf8af5f061
libprintf brought in from older PPC/m68k code, but fucking GCC
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
5 int |
4
5c7b3d5d5702
libprintf compiles with Anshit C GCC
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
3
diff
changeset
|
6 sprintf(char *strdest, char *fmt, ...) |
3
45bf8af5f061
libprintf brought in from older PPC/m68k code, but fucking GCC
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
7 { |
45bf8af5f061
libprintf brought in from older PPC/m68k code, but fucking GCC
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
8 va_list ap; |
45bf8af5f061
libprintf brought in from older PPC/m68k code, but fucking GCC
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
9 char *strptr; |
45bf8af5f061
libprintf brought in from older PPC/m68k code, but fucking GCC
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
10 int len; |
45bf8af5f061
libprintf brought in from older PPC/m68k code, but fucking GCC
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
11 |
4
5c7b3d5d5702
libprintf compiles with Anshit C GCC
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
3
diff
changeset
|
12 strptr = strdest; |
5c7b3d5d5702
libprintf compiles with Anshit C GCC
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
3
diff
changeset
|
13 va_start(ap, fmt); |
3
45bf8af5f061
libprintf brought in from older PPC/m68k code, but fucking GCC
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
14 len = _doprnt(fmt, ap, &_sprintf_putchar, &strptr); |
4
5c7b3d5d5702
libprintf compiles with Anshit C GCC
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
3
diff
changeset
|
15 va_end(ap); |
3
45bf8af5f061
libprintf brought in from older PPC/m68k code, but fucking GCC
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
16 *strptr = '\0'; |
45bf8af5f061
libprintf brought in from older PPC/m68k code, but fucking GCC
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
17 return(len); |
45bf8af5f061
libprintf brought in from older PPC/m68k code, but fucking GCC
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
18 } |