]> git.ipfire.org Git - thirdparty/git.git/blob - get-tar-commit-id.c
Merge refs/heads/master from paulus
[thirdparty/git.git] / get-tar-commit-id.c
1 #include <stdio.h>
2 #include <string.h>
3 #include <unistd.h>
4
5 #define HEADERSIZE 1024
6
7 int main(int argc, char **argv)
8 {
9 char buffer[HEADERSIZE];
10 ssize_t n;
11
12 n = read(0, buffer, HEADERSIZE);
13 if (n < HEADERSIZE) {
14 fprintf(stderr, "read error\n");
15 return 3;
16 }
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;
25 }
26 return 0;
27 }