[Gnome-print] updated gnome-font-install patch
- From: Havoc Pennington <hp redhat com>
- To: gnome-print ximian com
- Subject: [Gnome-print] updated gnome-font-install patch
- Date: 08 Oct 2001 15:10:54 -0400
Hi,
I had an old tarball before, but the new tarball is still partially
broken. g_warning/g_return_if_fail should only be used for programmer
errors, not user error messages. Also, strerror() is useful if file
operations fail.
Havoc
--- gnome-print-0.30/installer/gnome-font-install.c.options Thu Oct 4 13:55:02 2001
+++ gnome-print-0.30/installer/gnome-font-install.c Mon Oct 8 15:07:31 2001
@@ -14,6 +14,7 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <dirent.h>
+#include <errno.h>
#include <string.h>
#include <stdio.h>
#include <popt-gnome.h>
@@ -168,6 +169,7 @@
char ** args;
FILE *of;
gint i;
+ int result;
/* Initialize dictionaries */
@@ -179,8 +181,15 @@
/* Parse arguments */
ctx = poptGetContext (NULL, argc, argv, options, 0);
- g_return_val_if_fail (ctx != NULL, 1);
- g_return_val_if_fail (poptGetNextOpt (ctx) == -1, 1);
+
+ result = poptGetNextOpt (ctx);
+ if (result != -1) {
+ fprintf(stderr, "%s: %s: %s\n",
+ "gnome-print-install",
+ poptBadOption(ctx, POPT_BADOPTION_NOALIAS),
+ poptStrerror(result));
+ return 1;
+ }
args = (char **) poptGetArgs (ctx);
/* Step 1: Read existing fontmap */
@@ -930,7 +939,9 @@
}
ostream = fopen (gfi_target, "w");
if (ostream) return ostream;
- g_warning ("Cannot create output file: %s", gfi_target);
+
+ fprintf (stderr, "gnome-font-install: Cannot open output file %s: %s\n",
+ gfi_target, g_strerror (errno));
return NULL;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]