diff options
author | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2007-08-25 23:10:44 +0000 |
---|---|---|
committer | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2007-08-25 23:10:44 +0000 |
commit | 7138a888b4bcd448a06ab818e51919249fcc030b (patch) | |
tree | 393062cf7bceae334dbf3b9eebfc50db7179732c /editor | |
parent | a7df43157443608716ad22badc18e5ba5f26e0f3 (diff) | |
download | netpbm-mirror-7138a888b4bcd448a06ab818e51919249fcc030b.tar.gz netpbm-mirror-7138a888b4bcd448a06ab818e51919249fcc030b.tar.xz netpbm-mirror-7138a888b4bcd448a06ab818e51919249fcc030b.zip |
Use pm_system_lp() instead of fork and exec
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@384 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'editor')
-rw-r--r-- | editor/pnmsmooth.c | 39 |
1 files changed, 4 insertions, 35 deletions
diff --git a/editor/pnmsmooth.c b/editor/pnmsmooth.c index a18511c7..fa525e14 100644 --- a/editor/pnmsmooth.c +++ b/editor/pnmsmooth.c @@ -23,12 +23,12 @@ #include <unistd.h> #include <string.h> #include <errno.h> -#include <sys/wait.h> #include "pm_c_util.h" #include "mallocvar.h" #include "shhopt.h" #include "nstring.h" +#include "pm_system.h" #include "pnm.h" @@ -36,7 +36,7 @@ struct cmdlineInfo { /* All the information the user supplied in the command line, in a form easy for the program to use. */ - const char *inputFilespec; /* Filespec of input file */ + const char * inputFilespec; /* Filespec of input file */ unsigned int width; unsigned int height; const char * dump; @@ -176,38 +176,6 @@ writeConvolutionImage(FILE * const cofp, -static void -runPnmconvol(const char * const inputFilespec, - const char * const convolutionImageFilespec) { - - /* fork a Pnmconvol process */ - pid_t rc; - - rc = fork(); - if (rc < 0) - pm_error("fork() failed. errno=%d (%s)", errno, strerror(errno)); - else if (rc == 0) { - /* child process executes following code */ - - execlp("pnmconvol", - "pnmconvol", convolutionImageFilespec, inputFilespec, - NULL); - - pm_error("error executing pnmconvol command. errno=%d (%s)", - errno, strerror(errno)); - } else { - /* This is the parent */ - pid_t const childPid = rc; - - int status; - - /* wait for child to finish */ - while (wait(&status) != childPid); - } -} - - - int main(int argc, char ** argv) { @@ -232,7 +200,8 @@ main(int argc, char ** argv) { if (cmdline.dump) { /* We're done. Convolution image is in user's file */ } else { - runPnmconvol(cmdline.inputFilespec, tempfileName); + pm_system_lp("pnmconvol", NULL, NULL, NULL, NULL, + tempfileName, cmdline.inputFilespec, NULL); unlink(tempfileName); strfree(tempfileName); |