*/
struct report_format json_fmt = {
.id = F_JSON_OUTPUT,
- .options = FO_HEADER_ONLY + FO_LOCAL_TIME + FO_TEST_MARKUP,
+ .options = FO_HEADER_ONLY + FO_LOCAL_TIME + FO_TEST_MARKUP +
+ FO_LC_NUMERIC_C,
.f_header = print_json_header,
.f_statistics = print_json_statistics,
.f_timestamp = print_json_timestamp,
*/
struct report_format svg_fmt = {
.id = F_SVG_OUTPUT,
- .options = FO_HEADER_ONLY + FO_LOCAL_TIME + FO_NO_TRUE_TIME,
+ .options = FO_HEADER_ONLY + FO_LOCAL_TIME + FO_NO_TRUE_TIME +
+ FO_LC_NUMERIC_C,
.f_header = print_svg_header,
.f_statistics = NULL,
.f_timestamp = NULL,
long cnt = 1;
char *pcparchive = (char *) dparm;
- if (format == F_JSON_OUTPUT) {
- /* Use a decimal point to make JSON code compliant with RFC7159 */
- setlocale(LC_NUMERIC, "C");
- }
-
/* Count items in file. Needed only for PCP output */
if (format == F_PCP_OUTPUT) {
count_file_items(ifd, file, file_magic, file_actlst, rectime, loctime);
long cnt = 1;
int graph_nr = 0;
- /* Use a decimal point to make SVG code locale independent */
- setlocale(LC_NUMERIC, "C");
-
/* Init custom colors palette */
init_custom_color_palette();
/* Perform required allocations */
allocate_structures(act);
+ if (SET_LC_NUMERIC_C(fmt[f_position]->options)) {
+ /* Use a decimal point */
+ setlocale(LC_NUMERIC, "C");
+ }
+
/* Call function corresponding to selected output format */
if (*fmt[f_position]->f_display) {
(*fmt[f_position]->f_display)(ifd, dfile, file_actlst, &file_magic,
/* Format options */
-/* Unused 0x01 */
+/*
+ * Indicate that a decimal point should be used to make output
+ * locale independent.
+ */
+#define FO_LC_NUMERIC_C 0x01
/*
* Indicate that output should stop after the header is displayed.
*/
#define FO_NO_TRUE_TIME 0x100
+#define SET_LC_NUMERIC_C(m) (((m) & FO_LC_NUMERIC_C) == FO_LC_NUMERIC_C)
#define ACCEPT_HEADER_ONLY(m) (((m) & FO_HEADER_ONLY) == FO_HEADER_ONLY)
#define ACCEPT_BAD_FILE_FORMAT(m) (((m) & FO_BAD_FILE_FORMAT) == FO_BAD_FILE_FORMAT)
#define ACCEPT_LOCAL_TIME(m) (((m) & FO_LOCAL_TIME) == FO_LOCAL_TIME)