Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Factory:Rebuild
a2ps
a2ps-4.13-utf8.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File a2ps-4.13-utf8.patch of Package a2ps
--- etc/a2ps_cfg.in | 3 ++ sheets/sheets.map | 3 ++ src/buffer.c | 29 +++++++++++++++++++++ src/generate.c | 74 +++++++++++++++++++++++++++++++++++++++++++++++++++++- 4 files changed, 108 insertions(+), 1 deletion(-) --- etc/a2ps_cfg.in +++ etc/a2ps_cfg.in 2023-03-10 13:06:52.122978624 +0000 @@ -199,6 +199,9 @@ $3p<-$3p> $4l# lines\n|| # rm is done by a2ps itself. No need to quote. # +########## UTF-8 filter for patched a2ps only +Delegation: utf8 utf8:plain iconv -c -f UTF-8 -t $x + ########## Compressed files # A compressed file should be decompressed and processed by a2ps # A consequence is that the decompressed file may be delegated. --- sheets/sheets.map +++ sheets/sheets.map 2023-03-10 13:06:52.122978624 +0000 @@ -146,6 +146,9 @@ gmake: /GNUmakefile/ /*\/GNUmakefile/ plain: /*.doc/ /*.txt/ +# UTF-8 type for patched a2ps only +utf8: <UTF-8 Unicode text*> + # Ada files ada: /*.ad[abs]/ --- src/buffer.c +++ src/buffer.c 2023-03-10 13:15:24.785647598 +0000 @@ -175,6 +175,35 @@ buffer_self_print (buffer_t * buffer, FI fprintf (stream, "Content = `%s'\n", buffer->content); } +/* + * It frees the content, not the pointer + */ +void +buffer_release (buffer_t * buffer) +{ + /* VALUE is malloc'd only if BUFFER->LOWER_CASE */ + if (buffer->lower_case) + { + free (buffer->value); + buffer->value = NULL; + buffer->allocsize = 0; + } + + /* I don't know how this one should be used */ + if (buffer->buf) + { + free(buffer->buf); + buffer->buf = NULL; + buffer->bufsize = 0; + buffer->bufoffset = 0; + } + if (buffer->len == 0) + { + buffer->content = obstack_finish(&buffer->obstack); + } + obstack_free (&buffer->obstack, NULL); +} + void buffer_set_lower_case (buffer_t * buffer, bool sensitive) { --- src/generate.c +++ src/generate.c 2023-03-10 13:17:27.919406928 +0000 @@ -29,7 +29,7 @@ char *sample_tmpname = NULL; */ enum style_kind_e { - no_style, binary, sshparser, unprintable, delegate + no_style, binary, sshparser, unprintable, delegate, utf8 }; static enum style_kind_e @@ -43,6 +43,8 @@ string_to_style_kind (const char * strin return no_style; else if (STREQ (string, "delegate")) return delegate; + else if (STREQ (string, "utf8")) + return utf8; return sshparser; } /************************************************************************/ @@ -350,6 +352,76 @@ print (char * filename, int * native_job msg_file_pages_printed (job, _("plain")); (*native_jobs)++; break; + + case utf8: + { + char * argv[21], * ptr; + int n, argc, pfd[2]; + pid_t pid; + + if ((contract = get_subcontract(file_job->type, "plain")) == (struct delegation*)0) + goto plain_print; + + argc = 1; + argv[0] = ptr = contract->command; + while ((ptr = (strchr(ptr, ' ')))) + { + *ptr++ = '\0'; + if (argc < 20) + argv[argc++] = ptr; + } + + for (n = 0; n < argc; n++) + if (strstr(argv[n], "$x")) + argv[n] = job->requested_encoding_name; + argv[argc] = (char*)0; + + if (pipe(pfd) < 0) + { + message (msg_report2, (stderr, _("[%s (%s): failed. Ignored]\n"), file_job->name, buf)); + break; + } + + switch ((pid = fork())) + { + case -1: + close(pfd[0]); + close(pfd[1]); + goto err; + break; + case 0: + if ((n = fileno(input_buffer->stream)) == 0) + { + char * tmpfile = NULL; + FILE * tmp; + tempname_ensure(tmpfile); + buffer_save(input_buffer, tmpfile); + tmp = xrfopen(tmpfile); + n = fileno(tmp); + free(tmpfile); + } + close(0); + if (dup(n) < 0) + goto err; + close(1); + if (dup(pfd[1]) < 0) + goto err; + close(n); + close(pfd[0]); + close(pfd[1]); + execvp(argv[0], argv); + err: + message (msg_report2, (stderr, _("[%s (%s): failed. Ignored]\n"), file_job->name, buf)); + break; + default: + close(pfd[1]); + input_buffer->bufoffset = input_buffer->bufsize; + input_buffer->stream = fdopen(pfd[0], "r"); + input_buffer->pipe_p = true; + goto plain_print; + } + break; + } } input_end (input_buffer);
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