link-grammar-5.8.0/link-grammar/tokenize/wg-display.c
/**
 * popen a command with the given input.
 * If the system doesn't have fork(), popen() is used to launch "dot".
 * This is an inferior implementation than the one below that uses
 * fork(), in which the window remains open and is updated automatically
 * when new sentences are entered. With popen(), the program blocks at
 * pclose() and the user needs to close the window after each sentence.
 */
popen a command with the given input.
If the system doesn't have fork(), popen() is used to launch "dot".
This is an inferior implementation than the one below that uses
fork(), in which the window remains open and is updated automatically
when new sentences are entered. With popen(), the program blocks at
pclose() and the user needs to close the window after each sentence.
popen a command with the given input . If the system doesn ' t have fork () popen () is used to launch " dot " . This is an inferior implementation than the one below that uses fork () in which the window remains open and is updated automatically when new sentences are entered . With popen () the program blocks at pclose () and the user needs to close the window after each sentence .
static bool x_popen(const char *cmd, const char *wgds)
{
	lgdebug(+3, "Invoking: %s\n", cmd);
	FILE *const cmdf = popen(cmd, "w");
	bool rc = true;
	if (NULL == cmdf)
	{
		prt_error("Error: popen of '%s' failed: %s\n", cmd, strerror(errno));
		rc = false;
	}
	else
	{
		if (fputs(wgds, cmdf) == EOF) 
		{
			prt_error("Error: x_popen(): fputs() error: %s\n", strerror(errno));
			rc = false;
		}
		if (pclose(cmdf) == -1)
		{
			prt_error("Error: x_popen(): pclose() error: %s\n", strerror(errno));
			rc = false;
		}
	}
	return rc;
}
static bool x_popen ( const char * cmd , const char * wgds ) { lgdebug ( +3 , " \n " , cmd ) ; FILE * const cmdf = popen ( cmd , " " ) ; bool rc = true ; if ( NULL == cmdf ) { prt_error ( " \n " , cmd , strerror ( errno ) ) ; rc = false ; } else { if ( fputs ( wgds , cmdf ) == EOF ) { prt_error ( " \n " , strerror ( errno ) ) ; rc = false ; } if ( pclose ( cmdf ) == -1 ) { prt_error ( " \n " , strerror ( errno ) ) ; rc = false ; } } return rc ; }
popen a command with the given input.
popen a command with the given input .
/* see default_error_handler() */