[PATCH] Test framework: prettyprint the failed command.
[git/dkf.git] / get-tar-commit-id.c
bloba1a17e53d29136df431d2a128292d7aefefaea41
1 #include <stdio.h>
2 #include <string.h>
3 #include <unistd.h>
5 #define HEADERSIZE 1024
7 int main(int argc, char **argv)
9 char buffer[HEADERSIZE];
10 ssize_t n;
12 n = read(0, buffer, HEADERSIZE);
13 if (n < HEADERSIZE) {
14 fprintf(stderr, "read error\n");
15 return 3;
17 if (buffer[156] != 'g')
18 return 1;
19 if (memcmp(&buffer[512], "52 comment=", 11))
20 return 1;
21 n = write(1, &buffer[523], 41);
22 if (n < 41) {
23 fprintf(stderr, "write error\n");
24 return 2;
26 return 0;