forked from KolibriOS/kolibrios
Newlibc:
- Fixed bug with input to the console (when clicking on "backspace" characters were not deleted). - Added _NO_STDERR macro for redirecting "stderr" to the console git-svn-id: svn://kolibrios.org@8777 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
71343e1178
commit
707de77a80
@ -11,6 +11,7 @@ public _con_set_flags@4
|
|||||||
public _con_cls
|
public _con_cls
|
||||||
public _con_write_string@8
|
public _con_write_string@8
|
||||||
public _con_getch2@0
|
public _con_getch2@0
|
||||||
|
public _con_gets
|
||||||
|
|
||||||
section '.text' align 16
|
section '.text' align 16
|
||||||
|
|
||||||
@ -168,6 +169,9 @@ _con_write_string@8:
|
|||||||
_con_getch2@0:
|
_con_getch2@0:
|
||||||
jmp [con_getch2]
|
jmp [con_getch2]
|
||||||
|
|
||||||
|
_con_gets:
|
||||||
|
jmp [con_gets]
|
||||||
|
|
||||||
_con_get_flags:
|
_con_get_flags:
|
||||||
_con_set_flags@4:
|
_con_set_flags@4:
|
||||||
_con_cls:
|
_con_cls:
|
||||||
|
@ -146,12 +146,19 @@ typedef _fpos64_t fpos64_t;
|
|||||||
|
|
||||||
#define stdin (_REENT->_stdin)
|
#define stdin (_REENT->_stdin)
|
||||||
#define stdout (_REENT->_stdout)
|
#define stdout (_REENT->_stdout)
|
||||||
|
|
||||||
|
#ifndef _NO_STDERR
|
||||||
#define stderr (_REENT->_stderr)
|
#define stderr (_REENT->_stderr)
|
||||||
|
#else
|
||||||
|
#define stderr stdout
|
||||||
|
#endif
|
||||||
|
|
||||||
#define _stdin_r(x) ((x)->_stdin)
|
#define _stdin_r(x) ((x)->_stdin)
|
||||||
#define _stdout_r(x) ((x)->_stdout)
|
#define _stdout_r(x) ((x)->_stdout)
|
||||||
#define _stderr_r(x) ((x)->_stderr)
|
#define _stderr_r(x) ((x)->_stderr)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Functions defined in ANSI C standard.
|
* Functions defined in ANSI C standard.
|
||||||
*/
|
*/
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
#include <_ansi.h>
|
#include <_ansi.h>
|
||||||
|
#include <stdio.h>
|
||||||
#include <sys/unistd.h>
|
#include <sys/unistd.h>
|
||||||
#include "io.h"
|
#include "io.h"
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
|
||||||
void load_libconsole();
|
void load_libconsole();
|
||||||
void __stdcall con_init(unsigned w_w, unsigned w_h, unsigned s_w, unsigned s_h, const char* t);
|
void __stdcall con_init(unsigned w_w, unsigned w_h, unsigned s_w, unsigned s_h, const char* t);
|
||||||
@ -10,6 +13,7 @@ unsigned __stdcall con_set_flags(unsigned new_flags);
|
|||||||
void __stdcall con_cls(void);
|
void __stdcall con_cls(void);
|
||||||
void __stdcall con_write_string(const char* string, unsigned length);
|
void __stdcall con_write_string(const char* string, unsigned length);
|
||||||
short __stdcall con_getch2(void);
|
short __stdcall con_getch2(void);
|
||||||
|
char* __stdcall con_gets(char*, unsigned);
|
||||||
|
|
||||||
int __gui_mode;
|
int __gui_mode;
|
||||||
|
|
||||||
@ -17,15 +21,18 @@ static int console_read(const char *path, void *buff,
|
|||||||
size_t offset, size_t count, size_t *done)
|
size_t offset, size_t count, size_t *done)
|
||||||
{
|
{
|
||||||
char *p = buff;
|
char *p = buff;
|
||||||
int cnt = 0;
|
/*int cnt = 0;
|
||||||
short c;
|
short c;
|
||||||
char ch;
|
char ch;*/
|
||||||
|
con_gets(p, count+1);
|
||||||
|
*done = strlen(p);
|
||||||
|
|
||||||
// __asm__ volatile("int3");
|
// __asm__ volatile("int3");
|
||||||
|
/*
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
c = con_getch2();
|
c = con_getch2();
|
||||||
|
printf("%d\n",(char)c);
|
||||||
ch = (char)c;
|
ch = (char)c;
|
||||||
if(ch != 0)
|
if(ch != 0)
|
||||||
{
|
{
|
||||||
@ -34,12 +41,11 @@ static int console_read(const char *path, void *buff,
|
|||||||
cnt++;
|
cnt++;
|
||||||
}
|
}
|
||||||
}while(ch != 0x0D);
|
}while(ch != 0x0D);
|
||||||
|
|
||||||
*done = cnt;
|
*done = cnt;
|
||||||
|
*/
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int console_write(const char *path, const void *buff,
|
static int console_write(const char *path, const void *buff,
|
||||||
size_t offset, size_t count, size_t *writes)
|
size_t offset, size_t count, size_t *writes)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user