diff options
author | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2022-09-28 02:22:32 +0000 |
---|---|---|
committer | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2022-09-28 02:22:32 +0000 |
commit | 0d782c278caeb9e70b1a5635d018168b09ecf2ba (patch) | |
tree | b807f4ee6b4ce6b9cbafb66768d09c106a71040d /converter/ppm | |
parent | 4616d7d06bc2ee200a7f40cee107fbbbf5d0cae9 (diff) | |
download | netpbm-mirror-0d782c278caeb9e70b1a5635d018168b09ecf2ba.tar.gz netpbm-mirror-0d782c278caeb9e70b1a5635d018168b09ecf2ba.tar.xz netpbm-mirror-0d782c278caeb9e70b1a5635d018168b09ecf2ba.zip |
Copy current Development release as Advanced
git-svn-id: http://svn.code.sf.net/p/netpbm/code/advanced@4444 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'converter/ppm')
-rwxr-xr-x | converter/ppm/hpcdtoppm/pcdovtoppm | 25 | ||||
-rw-r--r-- | converter/ppm/ppmtompeg/specifics.c | 48 |
2 files changed, 38 insertions, 35 deletions
diff --git a/converter/ppm/hpcdtoppm/pcdovtoppm b/converter/ppm/hpcdtoppm/pcdovtoppm index b86048cc..1c6cb430 100755 --- a/converter/ppm/hpcdtoppm/pcdovtoppm +++ b/converter/ppm/hpcdtoppm/pcdovtoppm @@ -144,7 +144,7 @@ tempdir=$(mktemp -d "${TMPDIR:-/tmp}/pcdovtoppm.XXXXXXXX") || { echo "Could not create temporary file. Exiting." 1>&2; exit 1; } trap 'rm -rf $tempdir' 0 -tmpfile=`tempfile -p pi -m 600` +tmpfile=$(tempfile -p pi -m 600) # Convert the PCD overview file to many PPM images if [ -f $1 ] ; then @@ -183,11 +183,12 @@ do ttext="$i:t" if [ "$back" = "-white" ] ; then - pbmtext $font "$ttext" | pnmcrop -quiet | pnmmargin -white 2| \ - pnmcat $back -tb $tmpfile - > $imagefile + pbmtext $font "$ttext" | pnmcrop -quiet | pnmmargin -white 2 | \ + pamcat $back -topbottom $tmpfile - > $imagefile else pbmtext $font "$ttext" | pnmcrop -quiet | pnmmargin -white 2 | \ - pnminvert | pnmcat $back -tb $tmpfile - > $imagefile + pnminvert | \ + pamcat $back -topbottom $tmpfile - > $imagefile fi rm -f $tmpfile @@ -199,9 +200,9 @@ do rowfile=${tempdir}/pi.${row} rm -f $rowfile if [ "$colors" = "n" ] ; then - pnmcat $back -lr -jbottom $imagefiles > $rowfile + pamcat $back -leftright -jbottom $imagefiles > $rowfile else - pnmcat $back -lr -jbottom $imagefiles | \ + pamcat $back -leftright -jbottom $imagefiles | \ ppmquant -quiet $colors > $rowfile fi rm -f $imagefiles @@ -219,10 +220,10 @@ if [ -n $imagefiles ] ; then rowfile=${tempdir}/pi.${row} rm -f $rowfile if [ "$colors" = "n" ] ; then - pnmcat $back -lr -jbottom $imagefiles > $rowfile + pamcat $back -leftright -jbottom $imagefiles > $rowfile else - pnmcat $back -lr -jbottom $imagefiles | \ - ppmquant -quiet $colors > $rowfile + pamcat $back -leftright -jbottom $imagefiles | \ + ppmquant -quiet $colors > $rowfile fi rm -f $imagefiles rowfiles="$rowfiles $rowfile" @@ -232,9 +233,11 @@ if [ $(echo $rowfiles|wc -w) -eq 1 ] ; then ppmtoppm $plainopt < $rowfiles else if [ "$colors" = "n" ] ; then - pnmcat $back -tb $plainopt $rowfiles + pamcat $back -topbottom $rowfiles | \ + ppmtoppm $plainopt else - pnmcat $back -tb $rowfiles | ppmquant $plainopt -quiet $colors + pamcat $back -tb $rowfiles | \ + ppmquant $plainopt -quiet $colors fi fi diff --git a/converter/ppm/ppmtompeg/specifics.c b/converter/ppm/ppmtompeg/specifics.c index aa3d7b18..bd74e805 100644 --- a/converter/ppm/ppmtompeg/specifics.c +++ b/converter/ppm/ppmtompeg/specifics.c @@ -41,6 +41,7 @@ #include "netpbm/mallocvar.h" #include "netpbm/nstring.h" +#include "netpbm/pm_system.h" #include "all.h" #include "mtypes.h" @@ -152,38 +153,37 @@ static char version = -1; void Specifics_Init() { - FILE *specificsFP; + /* 'specificsFile' is a global variable whose value is the name of the + specifics file, given by the parameter file. + */ + + FILE * specificsFP; + const char * preprocessedFileNm; + + pm_message("Specifics file: %s", specificsFile); + + pm_asprintf(&preprocessedFileNm, "%s.cpp", specificsFile); + + pm_system_lp("rm", NULL, NULL, NULL, NULL, "-f", preprocessedFileNm); { const char * command; - pm_asprintf(&command, "rm -f %s.cpp", specificsFile); - system(command); - pm_strfree(command); - } - { - const char * command; - pm_asprintf(&command, "cpp -P %s %s %s.cpp", - specificsDefines, specificsFile, specificsFile); - system(command); + pm_asprintf(&command, "cpp -P %s '%s' -o '%s'", + specificsDefines, specificsFile, preprocessedFileNm); + pm_system(NULL, NULL, NULL, NULL, command); pm_strfree(command); } - strcat(specificsFile, ".cpp"); - if ((specificsFP = fopen(specificsFile, "r")) == NULL) { - fprintf(stderr, "Error with specifics file, cannot open %s\n", - specificsFile); - exit(1); - } - printf("Specifics file: %s\n", specificsFile); + + specificsFP = pm_openr(preprocessedFileNm); + + pm_system_lp("rm", NULL, NULL, NULL, NULL, "-f", preprocessedFileNm); Parse_Specifics_File(specificsFP); - { - const char * command; - pm_asprintf(&command, "rm -f %s.cpp", specificsFile); - system(command); - pm_strfree(command); - } -} + pm_close(specificsFP); + + pm_strfree(preprocessedFileNm); +} |