#include <sys/stat.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

int main (int argc, char *argv[])
{
	if (argc != 2) {
		fprintf(stderr, "usage: %s file\n", argv[0]);
		exit(EXIT_FAILURE);
	}

	int f = open(argv[1], 0);
	if (-1 == f) {
		perror("could not open input file");
		exit(EXIT_FAILURE);
	}

	int rc;
	pid_t childpid = fork();
	if (childpid == fork()) {
		rc = lseek(f, 1, SEEK_CUR);
		if (-1 == rc) {
			perror("could not seek");
			exit (EXIT_FAILURE);
		}
		exit (EXIT_SUCCESS);
	} else {
		waitpid(childpid, &rc, 0);
		exit (WEXITSTATUS(rc));
	}
}
