Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:11.4
ghostscript-library
ghostscript-8.61-pipe.dif
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File ghostscript-8.61-pipe.dif of Package ghostscript-library
--- base/gsdevice.c +++ base/gsdevice.c 2005-03-17 00:00:00.000000000 +0100 @@ -921,7 +921,7 @@ gx_device_open_output_file(const gx_devi if (!parsed.fname) return_error(gs_error_undefinedfilename); strcpy(fmode, gp_fmode_wb); - if (positionable) + if (positionable && strcmp(parsed.iodev->dname, "%pipe%")) strcat(fmode, "+"); code = parsed.iodev->procs.fopen(parsed.iodev, parsed.fname, fmode, pfile, NULL, 0); --- psi/imainarg.c +++ psi/imainarg.c 2007-11-06 10:42:50.073965358 +0000 @@ -236,9 +236,10 @@ gs_main_run_start(gs_main_instance * min static int swproc(gs_main_instance * minst, const char *arg, arg_list * pal) { + struct stat rstat; char sw = arg[1]; ref vtrue; - int code = 0; + int code = 0, fd; #undef initial_enter_name #define initial_enter_name(nstr, pvalue)\ i_initial_enter_name(minst->i_ctx_p, nstr, pvalue) @@ -250,7 +251,10 @@ swproc(gs_main_instance * minst, const c return 1; case 0: /* read stdin as a file char-by-char */ /* This is a ******HACK****** for Ghostview. */ + fd = fileno(minst->heap->gs_lib_ctx->fstdin); minst->heap->gs_lib_ctx->stdin_is_interactive = true; + if ((fd == 0) && (fstat(fd, &rstat) == 0) && !S_ISCHR(rstat.st_mode)) + minst->heap->gs_lib_ctx->stdin_is_interactive = false; goto run_stdin; case '_': /* read stdin with normal buffering */ minst->heap->gs_lib_ctx->stdin_is_interactive = false; --- psi/ziodevsc.c +++ psi/ziodevsc.c 2007-11-06 11:30:32.369550149 +0000 @@ -26,6 +26,8 @@ #include "ifilter.h" #include "store.h" +#include <sys/ioctl.h> + /* Define the special devices. */ const char iodev_dtype_stdio[] = "Special"; #define iodev_special(dname, init, open) {\ @@ -95,11 +97,19 @@ s_stdin_read_process(stream_state * st, if (wcount <= 0) return 0; + count = 0; + if (mem->gs_lib_ctx->stdin_is_interactive) { + (void)ioctl(fileno(mem->gs_lib_ctx->fstdin), FIONREAD, &count); + if (count == 0) + count++; + if (wcount > count) + wcount = count; + } + /* do the callout */ if (mem->gs_lib_ctx->stdin_fn) count = (*mem->gs_lib_ctx->stdin_fn) - (mem->gs_lib_ctx->caller_handle, (char *)pw->ptr + 1, - mem->gs_lib_ctx->stdin_is_interactive ? 1 : wcount); + (mem->gs_lib_ctx->caller_handle, (char *)pw->ptr + 1, wcount); else count = gp_stdin_read((char *)pw->ptr + 1, wcount, mem->gs_lib_ctx->stdin_is_interactive, --- psi/ziodevs.c +++ psi/ziodevs.c 2007-11-06 11:31:28.124646326 +0000 @@ -24,6 +24,8 @@ #include "files.h" #include "store.h" +#include <sys/ioctl.h> + /* Define the special devices. */ const char iodev_dtype_stdio[] = "Special"; #define iodev_special(dname, init, open) {\ @@ -92,6 +94,16 @@ s_stdin_read_process(stream_state * st, if (wcount <= 0) return 0; + + count = 0; + if (st->memory->gs_lib_ctx->stdin_is_interactive) { + (void)ioctl(fileno(st->memory->gs_lib_ctx->fstdin), FIONREAD, &count); + if (count == 0) + count++; + if (wcount > count) + wcount = count; + } + count = gp_stdin_read( (char*) pw->ptr + 1, wcount, st->memory->gs_lib_ctx->stdin_is_interactive, file); pw->ptr += (count < 0) ? 0 : count;
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor