diff options
| author | Michael R Sweet <michael.r.sweet@gmail.com> | 2005-04-16 00:01:49 +0000 |
|---|---|---|
| committer | Michael R Sweet <michael.r.sweet@gmail.com> | 2005-04-16 00:01:49 +0000 |
| commit | b41cf28662fe5734530f280cc0dbb34bbf6aa25a (patch) | |
| tree | e6afdba0c544657c7a60198d5ed984feb5edf90c /test/file_chooser.cxx | |
| parent | 91c3b8231de57e381d33b154852092c04ab96f14 (diff) | |
Update "clean" targets to properly handle core files, remove backup files,
etc.
Add "install" target to test directory which installs the example programs.
Install the config.h file in the examples directory.
Make sure the example programs compile outside the FLTK source dir.
Add example programs to fltk.list.in.
Fix missing redraw() in x_cb() in FLUID...
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@4287 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'test/file_chooser.cxx')
| -rw-r--r-- | test/file_chooser.cxx | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/test/file_chooser.cxx b/test/file_chooser.cxx index f0867b627..a595e4df6 100644 --- a/test/file_chooser.cxx +++ b/test/file_chooser.cxx @@ -44,7 +44,7 @@ #include <FL/Fl_Shared_Image.H> #include <FL/Fl_PNM_Image.H> #include <FL/Fl_Light_Button.H> -#include "../src/flstring.h" +#include <string.h> // @@ -220,12 +220,12 @@ pdf_check(const char *name, // I - Name of file return 0; home = getenv("HOME"); - snprintf(preview, sizeof(preview), "%s/.preview.ppm", home ? home : ""); + sprintf(preview, "%s/.preview.ppm", home ? home : ""); - snprintf(command, sizeof(command), - "gs -r100 -dFIXED -sDEVICE=ppmraw -dQUIET -dNOPAUSE -dBATCH " - "-sstdout=\"%%stderr\" -sOUTPUTFILE=\'%s\' " - "-dFirstPage=1 -dLastPage=1 \'%s\' 2>/dev/null", preview, name); + sprintf(command, + "gs -r100 -dFIXED -sDEVICE=ppmraw -dQUIET -dNOPAUSE -dBATCH " + "-sstdout=\"%%stderr\" -sOUTPUTFILE=\'%s\' " + "-dFirstPage=1 -dLastPage=1 \'%s\' 2>/dev/null", preview, name); if (system(command)) return 0; @@ -256,11 +256,11 @@ ps_check(const char *name, // I - Name of file return 0; home = getenv("HOME"); - snprintf(preview, sizeof(preview), "%s/.preview.ppm", home ? home : ""); + sprintf(preview, "%s/.preview.ppm", home ? home : ""); if (memcmp(header, "%!PS", 4) == 0) { // PS file has DSC comments; extract the first page... - snprintf(outname, sizeof(outname), "%s/.preview.ps", home ? home : ""); + sprintf(outname, "%s/.preview.ps", home ? home : ""); if (strcmp(name, outname) != 0) { in = fopen(name, "rb"); @@ -281,13 +281,14 @@ ps_check(const char *name, // I - Name of file } } else { // PS file doesn't have DSC comments; do the whole file... - strlcpy(outname, name, sizeof(outname)); + strncpy(outname, name, sizeof(outname) - 1); + outname[sizeof(outname) - 1] = '\0'; } - snprintf(command, sizeof(command), - "gs -r100 -dFIXED -sDEVICE=ppmraw -dQUIET -dNOPAUSE -dBATCH " - "-sstdout=\"%%stderr\" -sOUTPUTFILE=\'%s\' \'%s\' 2>/dev/null", - preview, outname); + sprintf(command, + "gs -r100 -dFIXED -sDEVICE=ppmraw -dQUIET -dNOPAUSE -dBATCH " + "-sstdout=\"%%stderr\" -sOUTPUTFILE=\'%s\' \'%s\' 2>/dev/null", + preview, outname); if (system(command)) return 0; |
