X-Git-Url: https://git.realraum.at/?p=svn42.git;a=blobdiff_plain;f=dart%2Feet.c;h=aaab7dd15ae7ecb381cc1b6c3c767a1a92b253ba;hp=af33b702116d216e62a2f2eda4728ede37d1c02a;hb=ae63af1c2a2512719f2d31a9ac87518edab6ca4d;hpb=8784283787d570fead3e8797eeaf1e1961204e6f diff --git a/dart/eet.c b/dart/eet.c index af33b70..aaab7dd 100644 --- a/dart/eet.c +++ b/dart/eet.c @@ -3,7 +3,7 @@ * * * Copyright (C) 2011 Christian Pointner - * + * * This file is part of eet. * * eet is free software: you can redistribute it and/or modify @@ -21,8 +21,10 @@ */ #include +#include +#include +#include #include - #include int write_buf(char* buf, int len) @@ -32,7 +34,7 @@ int write_buf(char* buf, int len) int w = write(1, &(buf[i]), len - i); if(w < 0) return w; - + i+=w; } return 0; @@ -41,12 +43,12 @@ int write_buf(char* buf, int len) int main(int argc, char* argv[]) { if(argc < 2) { - fprintf(stderr, "Please specify fd number\n"); + fprintf(stderr, "Please specify a path to the fifo\n"); return 1; } - int fd = atoi(argv[1]); - if(fd < 3) { - fprintf(stderr, "the specified fd is not valid (must be higher than 2\n"); + int fd = open(argv[1], O_RDONLY); + if(fd < 0) { + perror("open()"); return 2; } @@ -75,7 +77,7 @@ int main(int argc, char* argv[]) ret = write_buf(buf, r); if(ret) return ret; } - } + } } }