Remove locale dependency
This commit is contained in:
parent
f2d9c56a12
commit
e13c6d2caa
24
srohtml.c
24
srohtml.c
|
@ -1,4 +1,3 @@
|
||||||
#include <locale.h>
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
@ -7,6 +6,7 @@
|
||||||
/* macros */
|
/* macros */
|
||||||
#define BODY_START_SIZE 26624 /* 26 x 1024 byte = 26 KiB */
|
#define BODY_START_SIZE 26624 /* 26 x 1024 byte = 26 KiB */
|
||||||
#define CLS_MAX 16
|
#define CLS_MAX 16
|
||||||
|
#define DATE_FORMAT "%d/%m/%Y"
|
||||||
#define DATE_LEN 10
|
#define DATE_LEN 10
|
||||||
#define FAVICON "data:image/gif;base64,R0lGODlhEAAQAKEAAAAAcP///wAAcAAAcCH5BAEKAAIALAAAAAAQABAAQAIwlBWZxxwAQWjtTQRvlZhTnGSfYT3eZ3WaE4mjGa1UasoH7c6tzYanfqmhJMKXglcAADs="
|
#define FAVICON "data:image/gif;base64,R0lGODlhEAAQAKEAAAAAcP///wAAcAAAcCH5BAEKAAIALAAAAAAQABAAQAIwlBWZxxwAQWjtTQRvlZhTnGSfYT3eZ3WaE4mjGa1UasoH7c6tzYanfqmhJMKXglcAADs="
|
||||||
#define FIGCAPTION_TAG_LEN 12
|
#define FIGCAPTION_TAG_LEN 12
|
||||||
|
@ -17,6 +17,7 @@
|
||||||
#define LINE_START 80
|
#define LINE_START 80
|
||||||
#define NOTES_START 8
|
#define NOTES_START 8
|
||||||
#define NOTES_MAX_DIGITS 3
|
#define NOTES_MAX_DIGITS 3
|
||||||
|
#define TIME_FORMAT "%H:%M"
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
void *data;
|
void *data;
|
||||||
|
@ -921,15 +922,14 @@ footer(void)
|
||||||
{
|
{
|
||||||
size_t max;
|
size_t max;
|
||||||
struct tm *now;
|
struct tm *now;
|
||||||
char str[16];
|
char str[22];
|
||||||
time_t s;
|
time_t s;
|
||||||
int tm_mday, tm_mon, tm_year;
|
int tm_mday, tm_mon, tm_year;
|
||||||
struct tm tm_pd = { 0 };
|
struct tm tm_pd = { 0 };
|
||||||
|
|
||||||
max = 16;
|
max = 22;
|
||||||
|
|
||||||
array_strcat(&body, "\t\t<footer>\n");
|
array_strcat(&body, "\t\t<footer>\n");
|
||||||
setlocale(LC_ALL, "");
|
|
||||||
|
|
||||||
if (publication_date != NULL) {
|
if (publication_date != NULL) {
|
||||||
array_strcat(&body, "\t\t\t<p>Pubblicazione: <time datetime=\"");
|
array_strcat(&body, "\t\t\t<p>Pubblicazione: <time datetime=\"");
|
||||||
|
@ -940,7 +940,7 @@ footer(void)
|
||||||
tm_pd.tm_mday = tm_mday;
|
tm_pd.tm_mday = tm_mday;
|
||||||
tm_pd.tm_mon = --tm_mon;
|
tm_pd.tm_mon = --tm_mon;
|
||||||
tm_pd.tm_year = tm_year - 1900;
|
tm_pd.tm_year = tm_year - 1900;
|
||||||
strftime(str, max, "%x", &tm_pd);
|
strftime(str, max, DATE_FORMAT, &tm_pd);
|
||||||
array_strcat(&body, str);
|
array_strcat(&body, str);
|
||||||
array_strcat(&body, "</time></p>\n");
|
array_strcat(&body, "</time></p>\n");
|
||||||
|
|
||||||
|
@ -951,21 +951,11 @@ footer(void)
|
||||||
now = localtime(&s);
|
now = localtime(&s);
|
||||||
|
|
||||||
array_strcat(&body, "\t\t\t<p>Revisione: <time datetime=\"");
|
array_strcat(&body, "\t\t\t<p>Revisione: <time datetime=\"");
|
||||||
strftime(str, max, "%Y-%m-%d", now);
|
strftime(str, max, "%Y-%m-%dT%H:%M%z", now);
|
||||||
array_strcat(&body, str);
|
|
||||||
|
|
||||||
strftime(str, max, "%R", now);
|
|
||||||
array_strcat(&body, "T");
|
|
||||||
array_strcat(&body, str);
|
|
||||||
|
|
||||||
strftime(str, max, "%z", now);
|
|
||||||
array_strcat(&body, str);
|
array_strcat(&body, str);
|
||||||
array_strcat(&body, "\">");
|
array_strcat(&body, "\">");
|
||||||
|
|
||||||
strftime(str, max, "%x", now);
|
strftime(str, max, DATE_FORMAT " " TIME_FORMAT, now);
|
||||||
array_strcat_html(&body, str, tag_content);
|
|
||||||
|
|
||||||
strftime(str, max, " %R", now);
|
|
||||||
array_strcat_html(&body, str, tag_content);
|
array_strcat_html(&body, str, tag_content);
|
||||||
array_strcat(&body, "</time></p>\n");
|
array_strcat(&body, "</time></p>\n");
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue