interim commit

- fixed wrong enum definitions of qse_pio_hid_t
- changed code to use a static buffer if the command is short enough in qse_pio_init().
This commit is contained in:
2009-01-08 08:14:06 +00:00
parent 37344d7e09
commit 86a1d88307
5 changed files with 68 additions and 9 deletions

View File

@ -179,6 +179,7 @@ qse_pio_t* qse_pio_init (
mcmd = cmd;
#else
qse_size_t n, mn;
qse_mchar_t buf[64];
n = qse_wcstombslen (cmd, &mn);
if (cmd[n] != QSE_WT('\0'))
@ -188,9 +189,18 @@ qse_pio_t* qse_pio_init (
}
mn = mn + 1;
mcmd = QSE_MMGR_ALLOC (
pio->mmgr, mn*QSE_SIZEOF(*mcmd));
if (mcmd == QSE_NULL) goto child_oops;
if (mn <= QSE_COUNTOF(buf))
{
mcmd = buf;
mn = QSE_COUNTOF(buf);
}
else
{
mcmd = QSE_MMGR_ALLOC (
pio->mmgr, mn*QSE_SIZEOF(*mcmd));
if (mcmd == QSE_NULL) goto child_oops;
}
n = qse_wcstombs (cmd, mcmd, &mn);
@ -199,6 +209,7 @@ qse_pio_t* qse_pio_init (
else
{
/* TODO: need to parse the command in a simple manner */
//execl ("full path needed", mcmd, marg1, marg2, QSE_NULL);
}
child_oops:

View File

@ -224,7 +224,7 @@ qse_size_t qse_wcstombs (
qse_size_t qse_wcstombslen (const qse_wchar_t* wcs, qse_size_t* mbslen)
{
const qse_wchar_t* p = wcs;
qse_mchar_t mbs[128];
qse_mchar_t mbs[32];
qse_size_t mlen = 0;
while (*p != QSE_WT('\0'))

View File

@ -105,6 +105,11 @@
#define QSE_FORK() fork()
#endif
#ifdef SYS_execve
#define QSE_EXECVE(path,argv,envp) syscall(SYS_execve,path,argv,envp)
#else
#define QSE_EXECVE(path,argv,envp) execve(path,argv,envp)
#endif
#ifdef SYS_waitpid
#define QSE_WAITPID(pid,status,options) syscall(SYS_waitpid,pid,status,options)