Files
discount/tools/branch.c
T
David Seifert 7afa5c6242 Make C99 clean
* Clang 16 (and likely GCC 14) will enforce strict C99 semantics
  and break old K&R C declarations and require correct C89
  function prototypes.

Bug: https://bugs.gentoo.org/870952
Clang: https://discourse.llvm.org/t/configure-script-breakage-with-the-new-werror-implicit-function-declaration/65213/9
2022-10-27 11:08:49 -07:00

28 lines
476 B
C

#include <stdio.h>
#include <string.h>
#include "config.h"
int
main(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, "main" ) != 0 )
printf("\"(%s)-\"", line);
}
pclose(pipe);
#endif
return 0;
}