Xinqi Bao's Git
1 /* See LICENSE file for copyright and license details. */
9 run_command(const char *cmd
)
14 if (!(fp
= popen(cmd
, "r"))) {
15 fprintf(stderr
, "popen '%s': %s\n", cmd
, strerror(errno
));
18 p
= fgets(buf
, sizeof(buf
) - 1, fp
);
23 if ((p
= strrchr(buf
, '\n'))) {
27 return buf
[0] ? buf
: NULL
;