no message

svn path=/trunk/; revision=509
This commit is contained in:
Boudewijn Dekker 1999-05-24 14:47:21 +00:00
parent 4b60f335f5
commit d21b624ded
6 changed files with 129 additions and 18 deletions

View file

@ -1,5 +1,15 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
* FILE: lib/crtdll/conio/kbhit.c
* PURPOSE: Checks for keyboard hits
* PROGRAMER: Boudewijn Dekker
* UPDATE HISTORY:
* 28/12/98: Created
*/
#include <crtdll/stdlib.h>
#include <crtdll/stdio.h>
#include <crtdll/string.h>
int _aexit_rtn_dll(int exitcode)
{
@ -8,7 +18,7 @@ int _aexit_rtn_dll(int exitcode)
void _amsg_exit (int errnum)
{
fprintf(stdout,strerror(errnum));
fprintf(stderr,strerror(errnum));
_aexit_rtn_dll(-1);
}

View file

@ -1,3 +1,12 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
* FILE: lib/crtdll/process/cwait.c
* PURPOSE: Waits for a process to exit
* PROGRAMER: Boudewijn Dekker
* UPDATE HISTORY:
* 04/03/99: Created
*/
#include <windows.h>
#include <crtdll/process.h>
#include <crtdll/errno.h>

View file

@ -1,18 +1,83 @@
#include <crtdll/process.h>
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
* FILE: lib/crtdll/process/system.c
* PURPOSE: Excutes a shell command
* PROGRAMER: Boudewijn Dekker
* UPDATE HISTORY:
* 04/03/99: Created
*/
#include <windows.h>
#include <crtdll/stdlib.h>
#include <crtdll/string.h>
#include <crtdll/process.h>
int system(const char *command)
{
char CmdLine[MAX_PATH];
char *comspec = getenv("COMSPEC");
if ( comspec == NULL )
comspec = "cmd.exe";
strcpy(CmdLine,comspec);
strcat(CmdLine," /C ");
if ( !WinExec(CmdLine,SW_SHOWNORMAL) < 31 )
return -1;
char szCmdLine[MAX_PATH];
char *szComSpec;
return 0;
PROCESS_INFORMATION ProcessInformation;
STARTUPINFO StartupInfo;
int nStatus;
szComSpec = getenv("COMSPEC");
// system should return 0 if command is null and the shell is found
if ( command == NULL ) {
if ( szComspec == NULL )
return 0;
else
return -1;
}
// should return 127 or 0 ( MS ) if the shell is not found
// __set_errno(ENOENT);
if ( szComSpec == NULL )
szComSpec = "cmd.exe";
strcpy(szCmdLine," /C ");
strncat(szCmdLine,command,MAX_PATH-5);
//check for a too long argument E2BIG
//command file has invalid format ENOEXEC
StartupInfo.cb = sizeof(STARTUPINFO);
StartupInfo.lpReserved= NULL;
StartupInfo.dwFlags = 0;
StartupInfo.wShowWindow = SW_SHOWDEFAULT;
StartupInfo.lpReserved2 = NULL;
StartupInfo.cbReserved2 = 0;
// According to ansi standards the new process should ignore SIGINT and SIGQUIT
// In order to disable ctr-c the process is created with CREATE_NEW_PROCESS_GROUP,
// thus SetConsoleCtrlHandler(NULL,TRUE) is made on behalf of the new process.
//SIGCHILD should be blocked aswell
if ( CreateProcessA(szComSpec,szCmdLine,NULL,NULL,TRUE,CREATE_NEW_PROCESS_GROUP,NULL,NULL,&StartupInfo,&ProcessInformation) == FALSE) {
return -1;
}
// system should wait untill the calling process is finished
_cwait(&nStatus,(int)ProcessInformation.hProcess,0);
// free the comspec [ if the COMSPEC == NULL provision is removed
// free(szComSpec);
return nStatus;
}

View file

@ -1,3 +1,12 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
* FILE: lib/crtdll/conio/kbhit.c
* PURPOSE: Checks for keyboard hits
* PROGRAMER: Boudewijn Dekker
* UPDATE HISTORY:
* 28/12/98: Created
*/
/* Copyright (C) 1998 DJ Delorie, see COPYING.DJ for details */
/* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */

View file

@ -6,6 +6,7 @@
#include <crtdll/fcntl.h>
#include <crtdll/internal/file.h>
//might change fopen(file,mode) -> fsopen(file,mode,_SH_DENYNO);
FILE * __alloc_file(void);

View file

@ -1,3 +1,12 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
* FILE: lib/crtdll/conio/kbhit.c
* PURPOSE: Checks for keyboard hits
* PROGRAMER: Boudewijn Dekker
* UPDATE HISTORY:
* 28/12/98: Created
*/
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
#include <crtdll/sys/types.h>
@ -5,6 +14,7 @@
#include <crtdll/io.h>
#include <crtdll/fcntl.h>
#include <crtdll/internal/file.h>
#include <crtdll/share.h>
FILE * __alloc_file(void);
@ -16,6 +26,8 @@ FILE* _fsopen(const char *file, const char *mode, int shflag)
int fd, rw, oflags = 0;
char tbchar;
int shf;
if (file == 0)
return 0;
if (mode == 0)
@ -53,14 +65,19 @@ FILE* _fsopen(const char *file, const char *mode, int shflag)
oflags |= (_fmode & (O_TEXT|O_BINARY));
//_SH_COMPAT Sets Compatibility mode for 16-bit applications
//_SH_DENYNO Permits read and write access
//_SH_DENYRD Denies read access to file
//_SH_DENYRW Denies read and write access to file
//_SH_DENYWR Denies write access to file
fd = _open(file, oflags, shflag);
if ( shflag == _SH_DENYNO )
shf = _S_IREAD | _S_IWRITE;
else if( shflag == _SH_DENYRD )
shf = _S_IWRITE;
else if( shflag == _SH_DENYRW )
shf = 0;
else if( shflag == _SH_DENYWR )
shf = _S_IREAD;
else
shf = _S_IREAD | _S_IWRITE;
fd = _open(file, oflags, shf);
if (fd < 0)
return NULL;