aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/fonts.src/font-util/bdftruncate.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-03-05 10:23:14 +0100
committermarha <marha@users.sourceforge.net>2012-03-05 10:23:14 +0100
commit8db4c7567d495ef6f6162406394ac192e6c2cfe7 (patch)
tree9d8233b2f54ad198da3354aa9dbd8d0082156a9c /xorg-server/fonts.src/font-util/bdftruncate.c
parentc14f2432d6bfb3de6c6289efd0471f038a289327 (diff)
parent50ace52bb8308fd62b8bad9ae912dc18c4ae32ff (diff)
downloadvcxsrv-8db4c7567d495ef6f6162406394ac192e6c2cfe7.tar.gz
vcxsrv-8db4c7567d495ef6f6162406394ac192e6c2cfe7.tar.bz2
vcxsrv-8db4c7567d495ef6f6162406394ac192e6c2cfe7.zip
Merge remote-tracking branch 'origin/released'
Diffstat (limited to 'xorg-server/fonts.src/font-util/bdftruncate.c')
-rw-r--r--xorg-server/fonts.src/font-util/bdftruncate.c30
1 files changed, 18 insertions, 12 deletions
diff --git a/xorg-server/fonts.src/font-util/bdftruncate.c b/xorg-server/fonts.src/font-util/bdftruncate.c
index a52730569..2b317c0b0 100644
--- a/xorg-server/fonts.src/font-util/bdftruncate.c
+++ b/xorg-server/fonts.src/font-util/bdftruncate.c
@@ -41,16 +41,19 @@
#include <stdlib.h>
#include <string.h>
-static int iswide(unsigned int);
-static void usage(void);
+#if (defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 205)) \
+ || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))
+# define ATTR_NORETURN __attribute((noreturn))
+#else
+# define ATTR_NORETURN
+#endif /* GNUC */
-static int opt_minus_w;
-static int opt_plus_w;
-static int removewide;
-static unsigned long threshold;
+static int iswide(unsigned int);
+static void usage(void) ATTR_NORETURN;
+static int parse_threshold(const char *str, unsigned long *threshold);
static int
-parse_threshold(const char *str)
+parse_threshold(const char *str, unsigned long *threshold)
{
int base;
char *end_ptr;
@@ -63,14 +66,14 @@ parse_threshold(const char *str)
base = 10;
errno = 0;
- threshold = strtoul(str, &end_ptr, base);
- if (errno != 0 || threshold == 0)
+ *threshold = strtoul(str, &end_ptr, base);
+ if (errno != 0 || *threshold == 0)
return 1;
return 0;
}
static void
-process_line(const char *line)
+process_line(const char *line, int removewide, unsigned long threshold)
{
if (strncmp(line, "ENCODING", 8) == 0) {
unsigned long enc;
@@ -120,6 +123,9 @@ int
main(int argc, char **argv)
{
int removewide;
+ unsigned long threshold;
+ int opt_minus_w = 0;
+ int opt_plus_w = 0;
char *line, *input_ptr;
size_t line_len, rest_len;
@@ -139,7 +145,7 @@ main(int argc, char **argv)
if (argc != 1 || (opt_plus_w && opt_minus_w))
usage();
- if (parse_threshold(*argv)) {
+ if (parse_threshold(*argv, &threshold)) {
fprintf(stderr, "Illegal threshold %s\n", *argv);
usage();
}
@@ -178,7 +184,7 @@ main(int argc, char **argv)
break;
}
}
- process_line(line);
+ process_line(line, removewide, threshold);
}
return EXIT_SUCCESS;