aboutsummaryrefslogtreecommitdiffstats
path: root/src/parse_10deg.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@member.fsf.org>2016-01-04 01:10:18 +0100
committerMattias Andrée <maandree@member.fsf.org>2016-01-04 01:10:18 +0100
commit766d936d60d11cef4d8b126cdd781a1828ae9964 (patch)
treeafa410968d7bc5b690c6caf36998f669fe4d905a /src/parse_10deg.c
parentrestart-radharc: only kill your own radharc, otherwise it is possible that root kills another user's radharc and replaces it with an instances own ... (diff)
downloadradharc-766d936d60d11cef4d8b126cdd781a1828ae9964.tar.gz
radharc-766d936d60d11cef4d8b126cdd781a1828ae9964.tar.bz2
radharc-766d936d60d11cef4d8b126cdd781a1828ae9964.tar.xz
haiku
Signed-off-by: Mattias Andrée <maandree@member.fsf.org>
Diffstat (limited to 'src/parse_10deg.c')
-rw-r--r--src/parse_10deg.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/parse_10deg.c b/src/parse_10deg.c
index aa82804..245814b 100644
--- a/src/parse_10deg.c
+++ b/src/parse_10deg.c
@@ -14,6 +14,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "haiku.h"
#include <stdio.h>
#include <unistd.h>
#include <math.h>
@@ -46,7 +47,7 @@ ciexyy_to_srgb(double x, double y, double Y, double *r, double *g, double *b)
}
-int main(void)
+int main(int argc, char *argv[])
{
double xyrgb[5];
struct stat attr;
@@ -54,15 +55,17 @@ int main(void)
while (fscanf(stdin, "%lf %lf\n", xyrgb + 0, xyrgb + 1) == 2) {
ciexyy_to_srgb(xyrgb[0], xyrgb[1], 1.0, xyrgb + 2, xyrgb + 3, xyrgb + 4);
if (write(1, xyrgb, sizeof(xyrgb)) < (ssize_t)sizeof(xyrgb))
- return perror(""), 1;
+ goto fail;
}
if (write(1, xyrgb, sizeof(xyrgb)) < (ssize_t)sizeof(xyrgb)) /* sugar */
- return perror(""), 1;
+ goto fail;
if (fstat(1, &attr))
- return perror(""), 1;
+ goto fail;
if ((size_t)(attr.st_size) != (EXPECTED_ELEMENTS + 1) * 5 * sizeof(double))
return 1;
return 0;
+fail:
+ return haiku(argc ? *argv : "parse_10deg"), -1;
}