Add python version with -v option

This commit is contained in:
Yann Weber 2019-07-13 13:53:07 +02:00
commit c83d63c8f2
3 changed files with 11 additions and 2 deletions

View file

@ -44,5 +44,7 @@ PyObject* import_entrypoint();
void log_expt(int priority); void log_expt(int priority);
void pyfcgi_python_version(char[16]);
#endif #endif

View file

@ -32,8 +32,9 @@ void usage()
void print_version(int fd) void print_version(int fd)
{ {
dprintf(fd, "%s\n", PACKAGE_STRING); char version[16];
/**@todo TODO : get python version */ pyfcgi_python_version(version);
dprintf(fd, "%s\nPython %s\n", PACKAGE_STRING, version);
} }
void default_conf() void default_conf()

View file

@ -196,3 +196,9 @@ void log_expt(int priority)
pyfcgi_log(priority, msg); pyfcgi_log(priority, msg);
} }
void pyfcgi_python_version(char version[16])
{
snprintf(version, 16, "%d.%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION,
PY_MICRO_VERSION);
}