The Meson Build System http://mesonbuild.com/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
736 B

#include <stdio.h>
#include <string.h>
#include <fcntl.h>
#include <errno.h>
#ifndef _MSC_VER
#include <unistd.h>
#endif
int main(int argc, char **argv) {
char data[10];
int fd, size;
if (argc != 2) {
fprintf(stderr, "Incorrect number of arguments, got %i\n", argc);
return 1;
}
fd = open(argv[1], O_RDONLY);
if (fd < 0) {
fprintf(stderr, "First argument is wrong.\n");
return 1;
}
size = read(fd, data, 8);
if (size < 0) {
fprintf(stderr, "Failed to read: %s\n", strerror(errno));
return 1;
}
if (strncmp(data, "contents", 8) != 0) {
fprintf(stderr, "Contents don't match, got %s\n", data);
return 1;
}
return 0;
}