forked from KolibriOS/kolibrios
release ktcc 0.9.26
git-svn-id: svn://kolibrios.org@6424 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
25
programs/develop/ktcc/trunk/libc/stdio/fgets.c
Normal file
25
programs/develop/ktcc/trunk/libc/stdio/fgets.c
Normal file
@@ -0,0 +1,25 @@
|
||||
#include <stdio.h>
|
||||
|
||||
char * fgets ( char * str, int num, FILE * stream )
|
||||
{
|
||||
int rd = 0;
|
||||
char c;
|
||||
while (rd < num - 1)
|
||||
{
|
||||
c = fgetc(stream);
|
||||
if (EOF == c) break;
|
||||
if ('\n' == c)
|
||||
{
|
||||
str[rd++] = c;
|
||||
break;
|
||||
}
|
||||
else
|
||||
str[rd++] = c;
|
||||
}
|
||||
if (0 == rd) return NULL;
|
||||
else
|
||||
{
|
||||
str[rd] = '\0';
|
||||
return str;
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@@ -1,8 +1,6 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int format_print(char *dest, size_t maxlen, const char *fmt,va_list argp);
|
||||
|
||||
int fprintf(FILE* file, const char* format, ...)
|
||||
{
|
||||
va_list arg;
|
||||
@@ -15,7 +13,10 @@ int printed;
|
||||
//data[0]=(int)&arg-(int)&format;
|
||||
|
||||
printed=format_print(buf,8191, format,arg);
|
||||
fwrite(buf,printed,1,file);
|
||||
if (file == stderr)
|
||||
debug_out_str(buf);
|
||||
else
|
||||
fwrite(buf,printed,1,file);
|
||||
free(buf);
|
||||
|
||||
return(printed);
|
||||
|
@@ -7,7 +7,11 @@ char* dllname="/sys/lib/console.obj";
|
||||
int console_init_status;
|
||||
|
||||
char* imports[] = {"START","version","con_init","con_write_asciiz","con_printf","con_exit",NULL};
|
||||
char* caption = "Console test - colors";
|
||||
char* caption = "Console app";
|
||||
extern int __argc;
|
||||
extern char** __argv;
|
||||
extern char* __path;
|
||||
|
||||
|
||||
dword* dll_ver;
|
||||
void stdcall (* con_init)(dword wnd_width, dword wnd_height, dword scr_width, dword scr_height, const char* title);
|
||||
@@ -32,6 +36,7 @@ void printf_link(struct import *exp, char** imports){
|
||||
_ksys_cofflib_getproc(exp, imports[5]);
|
||||
}
|
||||
|
||||
|
||||
int init_console(void)
|
||||
{
|
||||
struct import * hDll;
|
||||
@@ -41,15 +46,15 @@ int init_console(void)
|
||||
return 1;
|
||||
}
|
||||
printf_link(hDll, imports);
|
||||
debug_out_str("dll loaded\n");
|
||||
// debug_out_str("dll loaded\n");
|
||||
|
||||
con_init(-1, -1, -1, -1, caption);
|
||||
con_init(-1, -1, -1, -1, caption); //__argv[0] && __path dont work
|
||||
return(0);
|
||||
}
|
||||
|
||||
int printf(const char *format,...)
|
||||
{
|
||||
int i;
|
||||
int i = 0;
|
||||
int printed_simbols;
|
||||
va_list arg;
|
||||
char simbol[]={"%s"};
|
||||
|
7
programs/develop/ktcc/trunk/libc/stdio/putchar.c
Normal file
7
programs/develop/ktcc/trunk/libc/stdio/putchar.c
Normal file
@@ -0,0 +1,7 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int putchar ( int ch )
|
||||
{
|
||||
printf("%c", ch);
|
||||
return ch;
|
||||
}
|
Reference in New Issue
Block a user