File indexing completed on 2024-05-12 11:33:01

0001 #include <stdio.h>
0002 #include <string.h>
0003 
0004 #include "config.h"
0005 
0006 int
0007 main(argc, argv)
0008 int argc;
0009 char **argv;
0010 {
0011 #if HAS_GIT
0012     FILE * pipe;
0013 
0014     char line[1024];
0015 
0016     freopen("/dev/null", "w", stderr);
0017     pipe = popen("git branch | awk '$1 ~ /\\*/ { print $2; }'", "r");
0018     if ( pipe == NULL )
0019     return 0;
0020 
0021     if ( fgets(line, sizeof line, pipe) != 0 ) {
0022     strtok(line, "\n");
0023     if ( strcmp(line, "master" ) != 0 )
0024         printf("\"(%s)\"", line);
0025     }
0026     pclose(pipe);
0027 #endif
0028     return 0;
0029 }