ngc 1.5.0
 
Loading...
Searching...
No Matches
ngcbPipe.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <signal.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <ctype.h>
#include <netdb.h>
#include <netinet/in.h>
#include <sys/types.h>
#include <sys/resource.h>
#include <sys/wait.h>
#include <ngc/core/ngcb.h>
#include <ngc/core/ngcbSocket.h>

Macros

#define _GNU_SOURCE
 
#define _REENTRANT
 

Functions

void ngcbPipeInit (ngcb_pipe_t *p)
 
int ngcbPipeOpen (const char *cmd, ngcb_pipe_t *p, char *erms)
 
void ngcbPipeClose (ngcb_pipe_t *p)
 
void ngcbPipeError (char *erms, int n, ngcb_pipe_t *p)
 
int ngcbPipeIn (const char *cmd, char *msg, int n)
 

Detailed Description

Macro Definition Documentation

◆ _GNU_SOURCE

#define _GNU_SOURCE

◆ _REENTRANT

#define _REENTRANT

Function Documentation

◆ ngcbPipeClose()

void ngcbPipeClose ( ngcb_pipe_t * p)

Close the pipe and terminates the executed process.

◆ ngcbPipeError()

void ngcbPipeError ( char * erms,
int n,
ngcb_pipe_t * p )

Read the stderr output of the executed process up to a length of n-1 characters. The returned error message is then terminated with a null character.

◆ ngcbPipeIn()

int ngcbPipeIn ( const char * cmd,
char * msg,
int n )

Read up to n-1 characters from stdout of cmd, put them to msg and add a terminating NULL character. If an error occurs, stderr is read in the same way and copied to msg. In case of error the function returns (-1), otherwise zero is returned.

◆ ngcbPipeInit()

void ngcbPipeInit ( ngcb_pipe_t * p)

Initialize/reset pipe structure.

◆ ngcbPipeOpen()

int ngcbPipeOpen ( const char * cmd,
ngcb_pipe_t * p,
char * erms )

Execute command as a child process and create a pipe between caller and executed process.