Mercurial > geeqie.yaz
annotate src/misc.c @ 1643:704ab52b3ac5
fixed problems with floor/ceil
- introduce macros ROUND_DOWN, ROUND_UP
- fixed incorrect usage of floor/ceil functions on int arguments
patch by Yuriy Kaminskiy
author | nadvornik |
---|---|
date | Wed, 17 Jun 2009 18:19:11 +0000 |
parents | 15208b140481 |
children |
rev | line source |
---|---|
1022
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
diff
changeset
|
1 /* |
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
diff
changeset
|
2 * Geeqie |
1284 | 3 * Copyright (C) 2008 - 2009 The Geeqie Team |
1022
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
diff
changeset
|
4 * |
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
diff
changeset
|
5 * Authors: Vladimir Nadvornik / Laurent Monin |
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
diff
changeset
|
6 * |
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
diff
changeset
|
7 * This software is released under the GNU General Public License (GNU GPL). |
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
diff
changeset
|
8 * Please read the included file COPYING for more information. |
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
diff
changeset
|
9 * This software comes with no warranty of any kind, use at your own risk! |
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
diff
changeset
|
10 */ |
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
diff
changeset
|
11 |
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
diff
changeset
|
12 #include "main.h" |
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
diff
changeset
|
13 #include "misc.h" |
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
diff
changeset
|
14 |
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
diff
changeset
|
15 gdouble get_zoom_increment(void) |
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
diff
changeset
|
16 { |
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
diff
changeset
|
17 return ((options->image.zoom_increment != 0) ? (gdouble)options->image.zoom_increment / 10.0 : 1.0); |
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
diff
changeset
|
18 } |
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
diff
changeset
|
19 |
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
diff
changeset
|
20 gchar *utf8_validate_or_convert(const gchar *text) |
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
diff
changeset
|
21 { |
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
diff
changeset
|
22 gint len; |
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
diff
changeset
|
23 |
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
diff
changeset
|
24 if (!text) return NULL; |
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
diff
changeset
|
25 |
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
diff
changeset
|
26 len = strlen(text); |
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
diff
changeset
|
27 if (!g_utf8_validate(text, len, NULL)) |
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
diff
changeset
|
28 return g_convert(text, len, "UTF-8", "ISO-8859-1", NULL, NULL, NULL); |
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
diff
changeset
|
29 |
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
diff
changeset
|
30 return g_strdup(text); |
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
diff
changeset
|
31 } |
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
diff
changeset
|
32 |
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
diff
changeset
|
33 gint utf8_compare(const gchar *s1, const gchar *s2, gboolean case_sensitive) |
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
diff
changeset
|
34 { |
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
diff
changeset
|
35 gchar *s1_key, *s2_key; |
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
diff
changeset
|
36 gchar *s1_t, *s2_t; |
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
diff
changeset
|
37 gint ret; |
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
diff
changeset
|
38 |
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
diff
changeset
|
39 g_assert(g_utf8_validate(s1, -1, NULL)); |
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
diff
changeset
|
40 g_assert(g_utf8_validate(s2, -1, NULL)); |
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
diff
changeset
|
41 |
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
diff
changeset
|
42 if (!case_sensitive) |
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
diff
changeset
|
43 { |
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
diff
changeset
|
44 s1_t = g_utf8_casefold(s1, -1); |
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
diff
changeset
|
45 s2_t = g_utf8_casefold(s2, -1); |
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
diff
changeset
|
46 } |
1259
3a0bb56adf8e
Fix a major bug in utf8_compare(): when case_sensitive is true, s1_t and s2_t were uninitialized, leading to unpredicable results.
zas_
parents:
1144
diff
changeset
|
47 else |
3a0bb56adf8e
Fix a major bug in utf8_compare(): when case_sensitive is true, s1_t and s2_t were uninitialized, leading to unpredicable results.
zas_
parents:
1144
diff
changeset
|
48 { |
3a0bb56adf8e
Fix a major bug in utf8_compare(): when case_sensitive is true, s1_t and s2_t were uninitialized, leading to unpredicable results.
zas_
parents:
1144
diff
changeset
|
49 s1_t = (gchar *) s1; |
3a0bb56adf8e
Fix a major bug in utf8_compare(): when case_sensitive is true, s1_t and s2_t were uninitialized, leading to unpredicable results.
zas_
parents:
1144
diff
changeset
|
50 s2_t = (gchar *) s2; |
3a0bb56adf8e
Fix a major bug in utf8_compare(): when case_sensitive is true, s1_t and s2_t were uninitialized, leading to unpredicable results.
zas_
parents:
1144
diff
changeset
|
51 } |
1022
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
diff
changeset
|
52 |
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
diff
changeset
|
53 s1_key = g_utf8_collate_key(s1_t, -1); |
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
diff
changeset
|
54 s2_key = g_utf8_collate_key(s2_t, -1); |
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
diff
changeset
|
55 |
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
diff
changeset
|
56 ret = strcmp(s1_key, s2_key); |
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
diff
changeset
|
57 |
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
diff
changeset
|
58 g_free(s1_key); |
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
diff
changeset
|
59 g_free(s2_key); |
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
diff
changeset
|
60 |
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
diff
changeset
|
61 if (!case_sensitive) |
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
diff
changeset
|
62 { |
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
diff
changeset
|
63 g_free(s1_t); |
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
diff
changeset
|
64 g_free(s2_t); |
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
diff
changeset
|
65 } |
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
diff
changeset
|
66 |
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
diff
changeset
|
67 return ret; |
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
diff
changeset
|
68 } |
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
diff
changeset
|
69 |
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
diff
changeset
|
70 /* Borrowed from gtkfilesystemunix.c */ |
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
diff
changeset
|
71 gchar *expand_tilde(const gchar *filename) |
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
diff
changeset
|
72 { |
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
diff
changeset
|
73 #ifndef G_OS_UNIX |
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
diff
changeset
|
74 return g_strdup(filename); |
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
diff
changeset
|
75 #else |
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
diff
changeset
|
76 const gchar *notilde; |
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
diff
changeset
|
77 const gchar *slash; |
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
diff
changeset
|
78 const gchar *home; |
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
diff
changeset
|
79 |
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
diff
changeset
|
80 if (filename[0] != '~') |
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
diff
changeset
|
81 return g_strdup(filename); |
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
diff
changeset
|
82 |
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
diff
changeset
|
83 notilde = filename + 1; |
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
diff
changeset
|
84 slash = strchr(notilde, G_DIR_SEPARATOR); |
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
diff
changeset
|
85 if (slash == notilde || !*notilde) |
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
diff
changeset
|
86 { |
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
diff
changeset
|
87 home = g_get_home_dir(); |
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
diff
changeset
|
88 if (!home) |
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
diff
changeset
|
89 return g_strdup(filename); |
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
diff
changeset
|
90 } |
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
diff
changeset
|
91 else |
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
diff
changeset
|
92 { |
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
diff
changeset
|
93 gchar *username; |
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
diff
changeset
|
94 struct passwd *passwd; |
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
diff
changeset
|
95 |
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
diff
changeset
|
96 if (slash) |
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
diff
changeset
|
97 username = g_strndup(notilde, slash - notilde); |
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
diff
changeset
|
98 else |
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
diff
changeset
|
99 username = g_strdup(notilde); |
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
diff
changeset
|
100 |
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
diff
changeset
|
101 passwd = getpwnam(username); |
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
diff
changeset
|
102 g_free(username); |
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
diff
changeset
|
103 |
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
diff
changeset
|
104 if (!passwd) |
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
diff
changeset
|
105 return g_strdup(filename); |
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
diff
changeset
|
106 |
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
diff
changeset
|
107 home = passwd->pw_dir; |
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
diff
changeset
|
108 } |
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
diff
changeset
|
109 |
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
diff
changeset
|
110 if (slash) |
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
diff
changeset
|
111 return g_build_filename(home, G_DIR_SEPARATOR_S, slash + 1, NULL); |
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
diff
changeset
|
112 else |
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
diff
changeset
|
113 return g_build_filename(home, G_DIR_SEPARATOR_S, NULL); |
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
diff
changeset
|
114 #endif |
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
diff
changeset
|
115 } |
1023
650c02c0c8ff
Move quoted_value() and escquote_value() to misc.[ch].
zas_
parents:
1022
diff
changeset
|
116 |
1144
5fe3b8b3a612
Add a wrapper around system() call named runcmd() which allows easier debugging. Improve the code launching the help browser.
zas_
parents:
1055
diff
changeset
|
117 |
5fe3b8b3a612
Add a wrapper around system() call named runcmd() which allows easier debugging. Improve the code launching the help browser.
zas_
parents:
1055
diff
changeset
|
118 /* Run a command like system() but may output debug messages. */ |
5fe3b8b3a612
Add a wrapper around system() call named runcmd() which allows easier debugging. Improve the code launching the help browser.
zas_
parents:
1055
diff
changeset
|
119 int runcmd(gchar *cmd) |
5fe3b8b3a612
Add a wrapper around system() call named runcmd() which allows easier debugging. Improve the code launching the help browser.
zas_
parents:
1055
diff
changeset
|
120 { |
5fe3b8b3a612
Add a wrapper around system() call named runcmd() which allows easier debugging. Improve the code launching the help browser.
zas_
parents:
1055
diff
changeset
|
121 #if 1 |
5fe3b8b3a612
Add a wrapper around system() call named runcmd() which allows easier debugging. Improve the code launching the help browser.
zas_
parents:
1055
diff
changeset
|
122 return system(cmd); |
5fe3b8b3a612
Add a wrapper around system() call named runcmd() which allows easier debugging. Improve the code launching the help browser.
zas_
parents:
1055
diff
changeset
|
123 return 0; |
5fe3b8b3a612
Add a wrapper around system() call named runcmd() which allows easier debugging. Improve the code launching the help browser.
zas_
parents:
1055
diff
changeset
|
124 #else |
5fe3b8b3a612
Add a wrapper around system() call named runcmd() which allows easier debugging. Improve the code launching the help browser.
zas_
parents:
1055
diff
changeset
|
125 /* For debugging purposes */ |
5fe3b8b3a612
Add a wrapper around system() call named runcmd() which allows easier debugging. Improve the code launching the help browser.
zas_
parents:
1055
diff
changeset
|
126 int retval = -1; |
5fe3b8b3a612
Add a wrapper around system() call named runcmd() which allows easier debugging. Improve the code launching the help browser.
zas_
parents:
1055
diff
changeset
|
127 FILE *in; |
5fe3b8b3a612
Add a wrapper around system() call named runcmd() which allows easier debugging. Improve the code launching the help browser.
zas_
parents:
1055
diff
changeset
|
128 |
5fe3b8b3a612
Add a wrapper around system() call named runcmd() which allows easier debugging. Improve the code launching the help browser.
zas_
parents:
1055
diff
changeset
|
129 DEBUG_1("Running command: %s", cmd); |
5fe3b8b3a612
Add a wrapper around system() call named runcmd() which allows easier debugging. Improve the code launching the help browser.
zas_
parents:
1055
diff
changeset
|
130 |
5fe3b8b3a612
Add a wrapper around system() call named runcmd() which allows easier debugging. Improve the code launching the help browser.
zas_
parents:
1055
diff
changeset
|
131 in = popen(cmd, "r"); |
5fe3b8b3a612
Add a wrapper around system() call named runcmd() which allows easier debugging. Improve the code launching the help browser.
zas_
parents:
1055
diff
changeset
|
132 if (in) |
5fe3b8b3a612
Add a wrapper around system() call named runcmd() which allows easier debugging. Improve the code launching the help browser.
zas_
parents:
1055
diff
changeset
|
133 { |
5fe3b8b3a612
Add a wrapper around system() call named runcmd() which allows easier debugging. Improve the code launching the help browser.
zas_
parents:
1055
diff
changeset
|
134 int status; |
5fe3b8b3a612
Add a wrapper around system() call named runcmd() which allows easier debugging. Improve the code launching the help browser.
zas_
parents:
1055
diff
changeset
|
135 const gchar *msg; |
5fe3b8b3a612
Add a wrapper around system() call named runcmd() which allows easier debugging. Improve the code launching the help browser.
zas_
parents:
1055
diff
changeset
|
136 gchar buf[2048]; |
5fe3b8b3a612
Add a wrapper around system() call named runcmd() which allows easier debugging. Improve the code launching the help browser.
zas_
parents:
1055
diff
changeset
|
137 |
5fe3b8b3a612
Add a wrapper around system() call named runcmd() which allows easier debugging. Improve the code launching the help browser.
zas_
parents:
1055
diff
changeset
|
138 while (fgets(buf, sizeof(buf), in) != NULL ) |
5fe3b8b3a612
Add a wrapper around system() call named runcmd() which allows easier debugging. Improve the code launching the help browser.
zas_
parents:
1055
diff
changeset
|
139 { |
5fe3b8b3a612
Add a wrapper around system() call named runcmd() which allows easier debugging. Improve the code launching the help browser.
zas_
parents:
1055
diff
changeset
|
140 DEBUG_1("Output: %s", buf); |
5fe3b8b3a612
Add a wrapper around system() call named runcmd() which allows easier debugging. Improve the code launching the help browser.
zas_
parents:
1055
diff
changeset
|
141 } |
5fe3b8b3a612
Add a wrapper around system() call named runcmd() which allows easier debugging. Improve the code launching the help browser.
zas_
parents:
1055
diff
changeset
|
142 |
5fe3b8b3a612
Add a wrapper around system() call named runcmd() which allows easier debugging. Improve the code launching the help browser.
zas_
parents:
1055
diff
changeset
|
143 status = pclose(in); |
5fe3b8b3a612
Add a wrapper around system() call named runcmd() which allows easier debugging. Improve the code launching the help browser.
zas_
parents:
1055
diff
changeset
|
144 |
5fe3b8b3a612
Add a wrapper around system() call named runcmd() which allows easier debugging. Improve the code launching the help browser.
zas_
parents:
1055
diff
changeset
|
145 if (WIFEXITED(status)) |
5fe3b8b3a612
Add a wrapper around system() call named runcmd() which allows easier debugging. Improve the code launching the help browser.
zas_
parents:
1055
diff
changeset
|
146 { |
5fe3b8b3a612
Add a wrapper around system() call named runcmd() which allows easier debugging. Improve the code launching the help browser.
zas_
parents:
1055
diff
changeset
|
147 msg = "Command terminated with exit code"; |
5fe3b8b3a612
Add a wrapper around system() call named runcmd() which allows easier debugging. Improve the code launching the help browser.
zas_
parents:
1055
diff
changeset
|
148 retval = WEXITSTATUS(status); |
5fe3b8b3a612
Add a wrapper around system() call named runcmd() which allows easier debugging. Improve the code launching the help browser.
zas_
parents:
1055
diff
changeset
|
149 } |
5fe3b8b3a612
Add a wrapper around system() call named runcmd() which allows easier debugging. Improve the code launching the help browser.
zas_
parents:
1055
diff
changeset
|
150 else if (WIFSIGNALED(status)) |
5fe3b8b3a612
Add a wrapper around system() call named runcmd() which allows easier debugging. Improve the code launching the help browser.
zas_
parents:
1055
diff
changeset
|
151 { |
5fe3b8b3a612
Add a wrapper around system() call named runcmd() which allows easier debugging. Improve the code launching the help browser.
zas_
parents:
1055
diff
changeset
|
152 msg = "Command was killed by signal"; |
5fe3b8b3a612
Add a wrapper around system() call named runcmd() which allows easier debugging. Improve the code launching the help browser.
zas_
parents:
1055
diff
changeset
|
153 retval = WTERMSIG(status); |
5fe3b8b3a612
Add a wrapper around system() call named runcmd() which allows easier debugging. Improve the code launching the help browser.
zas_
parents:
1055
diff
changeset
|
154 } |
5fe3b8b3a612
Add a wrapper around system() call named runcmd() which allows easier debugging. Improve the code launching the help browser.
zas_
parents:
1055
diff
changeset
|
155 else |
5fe3b8b3a612
Add a wrapper around system() call named runcmd() which allows easier debugging. Improve the code launching the help browser.
zas_
parents:
1055
diff
changeset
|
156 { |
5fe3b8b3a612
Add a wrapper around system() call named runcmd() which allows easier debugging. Improve the code launching the help browser.
zas_
parents:
1055
diff
changeset
|
157 msg = "pclose() returned"; |
5fe3b8b3a612
Add a wrapper around system() call named runcmd() which allows easier debugging. Improve the code launching the help browser.
zas_
parents:
1055
diff
changeset
|
158 retval = status; |
5fe3b8b3a612
Add a wrapper around system() call named runcmd() which allows easier debugging. Improve the code launching the help browser.
zas_
parents:
1055
diff
changeset
|
159 } |
5fe3b8b3a612
Add a wrapper around system() call named runcmd() which allows easier debugging. Improve the code launching the help browser.
zas_
parents:
1055
diff
changeset
|
160 |
5fe3b8b3a612
Add a wrapper around system() call named runcmd() which allows easier debugging. Improve the code launching the help browser.
zas_
parents:
1055
diff
changeset
|
161 DEBUG_1("%s : %d\n", msg, retval); |
5fe3b8b3a612
Add a wrapper around system() call named runcmd() which allows easier debugging. Improve the code launching the help browser.
zas_
parents:
1055
diff
changeset
|
162 } |
5fe3b8b3a612
Add a wrapper around system() call named runcmd() which allows easier debugging. Improve the code launching the help browser.
zas_
parents:
1055
diff
changeset
|
163 |
5fe3b8b3a612
Add a wrapper around system() call named runcmd() which allows easier debugging. Improve the code launching the help browser.
zas_
parents:
1055
diff
changeset
|
164 return retval; |
5fe3b8b3a612
Add a wrapper around system() call named runcmd() which allows easier debugging. Improve the code launching the help browser.
zas_
parents:
1055
diff
changeset
|
165 #endif |
5fe3b8b3a612
Add a wrapper around system() call named runcmd() which allows easier debugging. Improve the code launching the help browser.
zas_
parents:
1055
diff
changeset
|
166 } |
5fe3b8b3a612
Add a wrapper around system() call named runcmd() which allows easier debugging. Improve the code launching the help browser.
zas_
parents:
1055
diff
changeset
|
167 |
5fe3b8b3a612
Add a wrapper around system() call named runcmd() which allows easier debugging. Improve the code launching the help browser.
zas_
parents:
1055
diff
changeset
|
168 |
1055
1646720364cf
Adding a vim modeline to all files - patch by Klaus Ethgen
nadvornik
parents:
1023
diff
changeset
|
169 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */ |