]> git.draconx.ca Git - liblbx.git/blobdiff - src/fops.c
liblbx: Make lbx_fopen more useful.
[liblbx.git] / src / fops.c
index 2ae6c61fc3658117b47485ce8a92981837d116d7..834c8b2e776ef0f7c22bdd0ff3b3cc080ced3e04 100644 (file)
@@ -66,7 +66,18 @@ static int pipe_seek(void *handle, long offset, int whence)
        struct lbx_pipe_state *state = handle;
        long distance;
 
-       distance = offset - state->offset;
+       switch (whence) {
+       case SEEK_SET:
+               distance = offset - state->offset;
+               break;
+       case SEEK_CUR:
+               distance = offset;
+               break;
+       case SEEK_END:
+               distance = -1;
+               break;
+       }
+
        if (distance < 0)
                return -1;