Cgit uses it in its snapshot [1] . Alpine Linux wants it for
its cgit support [2]. This should be pretty simple.

[1] 
http://git.zx2c4.com/cgit/commit/?id=055e092a330098f6b9177266facf43029dbe1883
[2] http://bugs.alpinelinux.org/issues/2022

Signed-off-by: Jason A. Donenfeld <[email protected]>
---
 archival/gzip.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/archival/gzip.c b/archival/gzip.c
index 31ccab3..6301d96 100644
--- a/archival/gzip.c
+++ b/archival/gzip.c
@@ -46,6 +46,7 @@ aa:      85.1% -- replaced with aa.gz
 //usage:     "\n       -d      Decompress"
 //usage:     "\n       -c      Write to stdout"
 //usage:     "\n       -f      Force"
+//usage:     "\n       -n      Do not write timestamp"
 //usage:
 //usage:#define gzip_example_usage
 //usage:       "$ ls -la /tmp/busybox*\n"
@@ -365,6 +366,8 @@ struct globals {
 
        /*uint32_t *crc_32_tab;*/
        uint32_t crc;   /* shift register contents */
+
+       int suppress_timestamp;
 };
 
 #define G1 (*(ptr_to_globals - 1))
@@ -2051,7 +2054,8 @@ IF_DESKTOP(long long) int FAST_FUNC 
pack_gzip(transformer_aux_data_t *aux UNUSED
        //G2.bl_desc.max_code    = 0;
 
        s.st_ctime = 0;
-       fstat(STDIN_FILENO, &s);
+       if (!G1.suppress_timestamp)
+               fstat(STDIN_FILENO, &s);
        zip(s.st_ctime);
        return 0;
 }
@@ -2114,6 +2118,7 @@ int gzip_main(int argc UNUSED_PARAM, char **argv)
        SET_PTR_TO_GLOBALS((char *)xzalloc(sizeof(struct globals)+sizeof(struct 
globals2))
                        + sizeof(struct globals));
 
+       G1.suppress_timestamp = opt & 0x2000; // -n
        /* Allocate all global buffers (for DYN_ALLOC option) */
        ALLOC(uch, G1.l_buf, INBUFSIZ);
        ALLOC(uch, G1.outbuf, OUTBUFSIZ);
-- 
1.8.2.1

_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to