diff options
author | default <nobody@localhost> | 2023-08-19 09:59:58 +0200 |
---|---|---|
committer | default <nobody@localhost> | 2023-08-19 09:59:58 +0200 |
commit | dae2e406d633ba32f2660100ef417ec13726765c (patch) | |
tree | f0fc2ee7f826907665ff883cd205d1f355030a2c /data.c | |
parent | 5c7b26bcdcac85433f45e93a934525ecf1e92414 (diff) |
history_add() now creates an etag.
Diffstat (limited to 'data.c')
-rw-r--r-- | data.c | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -1677,7 +1677,8 @@ double history_mtime(snac *snac, const char *id) } -void history_add(snac *snac, const char *id, const char *content, int size) +void history_add(snac *snac, const char *id, const char *content, int size, + xs_str **etag) /* adds something to the history */ { xs *fn = _history_fn(snac, id); @@ -1686,6 +1687,11 @@ void history_add(snac *snac, const char *id, const char *content, int size) if (fn && (f = fopen(fn, "w")) != NULL) { fwrite(content, size, 1, f); fclose(f); + + if (etag) { + double tm = mtime(fn); + *etag = xs_fmt("W/\"snac-%.0lf\"", tm); + } } } |