1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-11-05 08:47:56 +01:00
git/get-tar-commit-id.c
Rene Scharfe 760b663446 [PATCH] Update documentation for git-get-tar-commit-id
... and add a copyright notice.

[jc: also move its entry in git.txt from undocumented section.]

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-06 13:49:11 -07:00

30 lines
514 B
C

/*
* Copyright (C) 2005 Rene Scharfe
*/
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#define HEADERSIZE 1024
int main(int argc, char **argv)
{
char buffer[HEADERSIZE];
ssize_t n;
n = read(0, buffer, HEADERSIZE);
if (n < HEADERSIZE) {
fprintf(stderr, "read error\n");
return 3;
}
if (buffer[156] != 'g')
return 1;
if (memcmp(&buffer[512], "52 comment=", 11))
return 1;
n = write(1, &buffer[523], 41);
if (n < 41) {
fprintf(stderr, "write error\n");
return 2;
}
return 0;
}