File: branch.c

package info (click to toggle)
libtext-markdown-discount-perl 0.18-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 1,524 kB
  • sloc: ansic: 5,765; pascal: 1,027; sh: 208; makefile: 196; perl: 184
file content (29 lines) | stat: -rw-r--r-- 490 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include <stdio.h>
#include <string.h>

#include "config.h"

int
main(argc, argv)
int argc;
char **argv;
{
#if HAS_GIT
    FILE * pipe;

    char line[1024];

    freopen("/dev/null", "w", stderr);
    pipe = popen("git branch | awk '$1 ~ /\\*/ { print $2; }'", "r");
    if ( pipe == NULL )
	return 0;

    if ( fgets(line, sizeof line, pipe) != 0 ) {
	strtok(line, "\n");
	if ( strcmp(line, "v2maint" ) != 0 )
	    printf("\"(%s)\"", line);
    }
    pclose(pipe);
#endif
    return 0;
}