- paps-0.6.6-exitcode.patch: exit immediately with proper exit code when

unrecoverable error occurs. (#208592)
This commit is contained in:
Akira TAGOH 2006-09-29 18:18:36 +00:00
parent 3d73139a94
commit 158e47ea2b
3 changed files with 91 additions and 15 deletions

66
paps-0.6.6-exitcode.patch Normal file
View File

@ -0,0 +1,66 @@
diff -ruN paps-0.6.6.orig/src/paps.c paps-0.6.6/src/paps.c
--- paps-0.6.6.orig/src/paps.c 2006-09-30 02:51:39.000000000 +0900
+++ paps-0.6.6/src/paps.c 2006-09-30 03:00:26.000000000 +0900
@@ -346,7 +346,7 @@
if (!IN)
{
fprintf(stderr, "Failed to open %s!\n", filename_in);
- exit(-1);
+ exit(1);
}
}
else
@@ -457,7 +457,7 @@
if (cvh == NULL)
{
fprintf(stderr, "%s: Invalid encoding: %s\n", g_get_prgname (), encoding);
- exit(-1);
+ exit(1);
}
}
@@ -517,7 +517,7 @@
{
fprintf(stderr, "%s: Error reading file.\n", g_get_prgname ());
g_string_free (inbuf, TRUE);
- return NULL;
+ exit(1);
}
else if (bp == NULL)
break;
@@ -531,7 +531,7 @@
if (g_iconv (handle, &ib, &iblen, &ob, &oblen) == -1)
{
fprintf (stderr, "%s: Error while converting strings.\n", g_get_prgname ());
- return NULL;
+ exit(1);
}
obuffer[BUFSIZE * 6 - 1 - oblen] = 0;
}
@@ -591,7 +591,7 @@
if (wtext == NULL)
{
fprintf (stderr, "Failed to convert UTF-8 to UCS-4.\n");
- return NULL;
+ exit(1);
}
len = wcswidth (wtext);
@@ -604,7 +604,7 @@
{
fprintf (stderr, "Failed to allocate a memory.\n");
g_free (wtext);
- return NULL;
+ exit(1);
}
for (i = 0; i < len; i++)
{
@@ -619,7 +619,7 @@
if (newtext == NULL)
{
fprintf (stderr, "Failed to convert UCS-4 to UTF-8.\n");
- return NULL;
+ exit(1);
}
pango_layout_set_text (para->layout, newtext, -1);

View File

@ -1,5 +1,6 @@
--- paps-0.6.6.orig/configure.in 2006-09-14 15:04:03.000000000 +0900 diff -ruN paps-0.6.6.orig/configure.in paps-0.6.6/configure.in
+++ paps-0.6.6/configure.in 2006-09-14 14:58:18.000000000 +0900 --- paps-0.6.6.orig/configure.in 2006-04-28 04:41:36.000000000 +0900
+++ paps-0.6.6/configure.in 2006-09-30 03:13:29.000000000 +0900
@@ -7,4 +7,17 @@ @@ -7,4 +7,17 @@
AC_PROG_CC AC_PROG_CC
AM_PROG_LIBTOOL AM_PROG_LIBTOOL
@ -18,8 +19,9 @@
+AC_SUBST(CUPS_LIBS) +AC_SUBST(CUPS_LIBS)
+ +
AC_OUTPUT(Makefile src/Makefile doc/Makefile) AC_OUTPUT(Makefile src/Makefile doc/Makefile)
--- paps-0.6.6.orig/src/Makefile.am 2006-09-14 15:04:03.000000000 +0900 diff -ruN paps-0.6.6.orig/src/Makefile.am paps-0.6.6/src/Makefile.am
+++ paps-0.6.6/src/Makefile.am 2006-09-14 14:58:18.000000000 +0900 --- paps-0.6.6.orig/src/Makefile.am 2006-09-30 03:13:05.000000000 +0900
+++ paps-0.6.6/src/Makefile.am 2006-09-30 03:13:29.000000000 +0900
@@ -5,10 +5,10 @@ @@ -5,10 +5,10 @@
libpaps_a_incdir = $(includedir) libpaps_a_incdir = $(includedir)
@ -33,8 +35,9 @@
paps_DEPENDENCIES = $(noinst_LIBRARIES) paps_DEPENDENCIES = $(noinst_LIBRARIES)
EXTRA_DIST = test_libpaps.c paps.1 EXTRA_DIST = test_libpaps.c paps.1
--- paps-0.6.6/src/paps.c 2006-09-14 15:03:50.000000000 +0900 diff -ruN paps-0.6.6.orig/src/paps.c paps-0.6.6/src/paps.c
+++ paps-0.6.6/src/paps.c 2006-09-29 15:51:26.000000000 +0100 --- paps-0.6.6.orig/src/paps.c 2006-09-30 03:13:05.000000000 +0900
+++ paps-0.6.6/src/paps.c 2006-09-30 03:16:10.000000000 +0900
@@ -31,6 +31,7 @@ @@ -31,6 +31,7 @@
#include <time.h> #include <time.h>
#include <locale.h> #include <locale.h>
@ -66,7 +69,7 @@
int do_tumble = -1; /* -1 means not initialized */ int do_tumble = -1; /* -1 means not initialized */
int do_duplex = -1; int do_duplex = -1;
gchar *paps_header = NULL; gchar *paps_header = NULL;
@@ -323,12 +326,123 @@ @@ -323,12 +326,124 @@
int header_sep = 20; int header_sep = 20;
int max_width = 0, w; int max_width = 0, w;
GIConv cvh = NULL; GIConv cvh = NULL;
@ -89,6 +92,7 @@
+ +
+ if (strncmp(prgname, "texttopaps", 10) == 0 || + if (strncmp(prgname, "texttopaps", 10) == 0 ||
+ getenv ("CUPS_SERVER") != NULL) { + getenv ("CUPS_SERVER") != NULL) {
+ g_set_prgname(prgname);
+ /* argument format should be job-id user title copies options [file] */ + /* argument format should be job-id user title copies options [file] */
+ cups_mode = TRUE; + cups_mode = TRUE;
+ if (argc < 6 || argc > 7) { + if (argc < 6 || argc > 7) {
@ -190,7 +194,7 @@
/* Parse command line */ /* Parse command line */
if (!g_option_context_parse(ctxt, &argc, &argv, &error)) if (!g_option_context_parse(ctxt, &argc, &argv, &error))
{ {
@@ -355,6 +469,8 @@ @@ -355,6 +470,8 @@
IN = stdin; IN = stdin;
} }
title = filename_in; title = filename_in;
@ -199,7 +203,7 @@
paps = paps_new(); paps = paps_new();
pango_context = paps_get_pango_context (paps); pango_context = paps_get_pango_context (paps);
@@ -373,8 +489,10 @@ @@ -373,8 +490,10 @@
pango_context_set_font_description (pango_context, font_description); pango_context_set_font_description (pango_context, font_description);
/* Page layout */ /* Page layout */
@ -212,7 +216,7 @@
if (num_columns == 1) if (num_columns == 1)
total_gutter_width = 0; total_gutter_width = 0;
@@ -435,6 +553,8 @@ @@ -435,6 +554,8 @@
page_layout.pango_dir = pango_dir; page_layout.pango_dir = pango_dir;
page_layout.filename = filename_in; page_layout.filename = filename_in;
page_layout.header_font_desc = header_font_desc; page_layout.header_font_desc = header_font_desc;
@ -221,7 +225,7 @@
/* calculate x-coordinate scale */ /* calculate x-coordinate scale */
if (cpi > 0.0L) if (cpi > 0.0L)
@@ -571,6 +691,12 @@ @@ -571,6 +692,12 @@
if (wc == (gunichar)-1) if (wc == (gunichar)-1)
{ {
fprintf (stderr, "%s: Invalid character in input\n", g_get_prgname ()); fprintf (stderr, "%s: Invalid character in input\n", g_get_prgname ());
@ -234,7 +238,7 @@
wc = 0; wc = 0;
} }
if (!*p || !wc || wc == '\n' || wc == '\f') if (!*p || !wc || wc == '\n' || wc == '\f')
@@ -784,6 +910,7 @@ @@ -784,6 +911,7 @@
int orientation = page_layout->page_width > page_layout->page_height; int orientation = page_layout->page_width > page_layout->page_height;
int bb_page_width = page_layout->page_width; int bb_page_width = page_layout->page_width;
int bb_page_height = page_layout->page_height; int bb_page_height = page_layout->page_height;
@ -242,7 +246,7 @@
/* Keep bounding box non-rotated to make ggv happy */ /* Keep bounding box non-rotated to make ggv happy */
if (orientation) if (orientation)
@@ -793,12 +920,20 @@ @@ -793,12 +921,20 @@
bb_page_height = tmp; bb_page_height = tmp;
} }
@ -264,7 +268,7 @@
"%%%%BeginProlog\n" "%%%%BeginProlog\n"
"%%%%Orientation: %s\n" "%%%%Orientation: %s\n"
"/papsdict 1 dict def\n" "/papsdict 1 dict def\n"
@@ -848,8 +983,10 @@ @@ -848,8 +984,10 @@
title, title,
bb_page_width, bb_page_width,
bb_page_height, bb_page_height,

View File

@ -1,6 +1,6 @@
Name: paps Name: paps
Version: 0.6.6 Version: 0.6.6
Release: 15%{?dist} Release: 16%{?dist}
License: LGPL License: LGPL
URL: http://paps.sourceforge.net/ URL: http://paps.sourceforge.net/
@ -24,6 +24,7 @@ Patch7: paps-0.6.6-lcctype.patch
Patch8: paps-0.6.6-wordwrap.patch Patch8: paps-0.6.6-wordwrap.patch
## fixed in CVS ## fixed in CVS
Patch9: paps-0.6.6-cpilpi.patch Patch9: paps-0.6.6-cpilpi.patch
Patch10: paps-0.6.6-exitcode.patch
Patch50: paps-cups.patch Patch50: paps-cups.patch
Summary: Plain Text to PostScript converter Summary: Plain Text to PostScript converter
@ -43,6 +44,7 @@ paps is a PostScript converter from plain text file using Pango.
%patch7 -p1 -b .lcctype %patch7 -p1 -b .lcctype
%patch8 -p1 -b .wordwrap %patch8 -p1 -b .wordwrap
%patch9 -p1 -b .cpilpi %patch9 -p1 -b .cpilpi
%patch10 -p1 -b .exitcode
%patch50 -p1 -b .cups %patch50 -p1 -b .cups
aclocal aclocal
automake automake
@ -76,6 +78,10 @@ rm -rf $RPM_BUILD_ROOT
%changelog %changelog
* Sat Sep 30 2006 Akira TAGOH <tagoh@redhat.com> - 0.6.6-16
- paps-0.6.6-exitcode.patch: exit immediately with proper exit code
when unrecoverable error occurs. (#208592)
* Fri Sep 29 2006 Tim Waugh <twaugh@redhat.com> - 0.6.6-15 * Fri Sep 29 2006 Tim Waugh <twaugh@redhat.com> - 0.6.6-15
- Avoid using iconv when not needed (bug #206259). - Avoid using iconv when not needed (bug #206259).