(#4925) - com_pipefile to create a named pipe for sending commands from other processes, patch by Chris Schwarz
This commit is contained in:
parent
a3def2744f
commit
3bf8ec2dab
6 changed files with 122 additions and 0 deletions
|
@ -905,6 +905,50 @@ fileHandle_t FS_FOpenFileAppend( const char *filename ) {
|
|||
return f;
|
||||
}
|
||||
|
||||
/*
|
||||
===========
|
||||
FS_FCreateOpenPipeFile
|
||||
|
||||
===========
|
||||
*/
|
||||
fileHandle_t FS_FCreateOpenPipeFile( const char *filename ) {
|
||||
char *ospath;
|
||||
FILE *fifo;
|
||||
fileHandle_t f;
|
||||
|
||||
if ( !fs_searchpaths ) {
|
||||
Com_Error( ERR_FATAL, "Filesystem call made without initialization\n" );
|
||||
}
|
||||
|
||||
f = FS_HandleForFile();
|
||||
fsh[f].zipFile = qfalse;
|
||||
|
||||
Q_strncpyz( fsh[f].name, filename, sizeof( fsh[f].name ) );
|
||||
|
||||
// don't let sound stutter
|
||||
S_ClearSoundBuffer();
|
||||
|
||||
ospath = FS_BuildOSPath( fs_homepath->string, fs_gamedir, filename );
|
||||
|
||||
if ( fs_debug->integer ) {
|
||||
Com_Printf( "FS_FCreateOpenPipeFile: %s\n", ospath );
|
||||
}
|
||||
|
||||
FS_CheckFilenameIsNotExecutable( ospath, __func__ );
|
||||
|
||||
fifo = Sys_Mkfifo( ospath );
|
||||
if( fifo ) {
|
||||
fsh[f].handleFiles.file.o = fifo;
|
||||
fsh[f].handleSync = qfalse;
|
||||
}
|
||||
else
|
||||
{
|
||||
f = 0;
|
||||
}
|
||||
|
||||
return f;
|
||||
}
|
||||
|
||||
/*
|
||||
===========
|
||||
FS_FilenameCompare
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue