11#include "common/printing.h"
22#include "common/jsonconfig.h"
3+ #include "detection/libc/libc.h"
34#include "detection/version/version.h"
45#include "modules/version/version.h"
56#include "util/stringUtils.h"
67
7- #define FF_VERSION_NUM_FORMAT_ARGS 8
8+ #define FF_VERSION_NUM_FORMAT_ARGS 9
89
910void ffPrintVersion (FFVersionOptions * options )
1011{
@@ -18,6 +19,18 @@ void ffPrintVersion(FFVersionOptions* options)
1819 }
1920 else
2021 {
22+ FFLibcResult libcResult ;
23+ FF_STRBUF_AUTO_DESTROY buf = ffStrbufCreate ();
24+ if (!ffDetectLibc (& libcResult ))
25+ {
26+ ffStrbufSetS (& buf , libcResult .name );
27+ if (libcResult .version )
28+ {
29+ ffStrbufAppendC (& buf , ' ' );
30+ ffStrbufAppendS (& buf , libcResult .version );
31+ }
32+ }
33+
2134 ffPrintFormat (FF_VERSION_MODULE_NAME , 0 , & options -> moduleArgs , FF_VERSION_NUM_FORMAT_ARGS , (FFformatarg []){
2235 {FF_FORMAT_ARG_TYPE_STRING , result .projectName },
2336 {FF_FORMAT_ARG_TYPE_STRING , result .version },
@@ -27,6 +40,7 @@ void ffPrintVersion(FFVersionOptions* options)
2740 {FF_FORMAT_ARG_TYPE_STRING , result .cmakeBuiltType },
2841 {FF_FORMAT_ARG_TYPE_STRING , result .compileTime },
2942 {FF_FORMAT_ARG_TYPE_STRING , result .compiler },
43+ {FF_FORMAT_ARG_TYPE_STRBUF , & buf },
3044 });
3145 }
3246}
@@ -83,4 +97,20 @@ void ffGenerateVersionJson(FF_MAYBE_UNUSED FFVersionOptions* options, yyjson_mut
8397 yyjson_mut_obj_add_str (doc , obj , "compileTime" , result .compileTime );
8498 yyjson_mut_obj_add_str (doc , obj , "compiler" , result .compiler );
8599 yyjson_mut_obj_add_bool (doc , obj , "debugMode" , result .debugMode );
100+
101+ FFLibcResult libcResult ;
102+ if (ffDetectLibc (& libcResult ))
103+ {
104+ yyjson_mut_obj_add_null (doc , obj , "libc" );
105+ }
106+ else
107+ {
108+ FF_STRBUF_AUTO_DESTROY buf = ffStrbufCreateS (libcResult .name );
109+ if (libcResult .version )
110+ {
111+ ffStrbufAppendC (& buf , ' ' );
112+ ffStrbufAppendS (& buf , libcResult .version );
113+ }
114+ yyjson_mut_obj_add_strbuf (doc , obj , "libc" , & buf );
115+ }
86116}
0 commit comments