datefmt

format unix timestamps over stdin
git clone git://git.jb55.com/datefmt
Log | Files | Refs | README | LICENSE

commit ae963a3521ddbc43fe18729b77e110e7b13c7e78
parent 8d9f480f007012a4cb4dc543d27aa32384c4043d
Author: William Casarin <jb55@jb55.com>
Date:   Fri,  9 Oct 2020 11:58:17 -0700

move some stuff around

Signed-off-by: William Casarin <jb55@jb55.com>

Diffstat:
Mdatefmt.c | 19++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/datefmt.c b/datefmt.c @@ -148,14 +148,6 @@ static void parser_init(struct parser *parser) parser->format = "%F %R"; } -static void shift_arg(int *argc, char **argv) -{ - if (*argc < 1) - return; - memmove(argv, &argv[1], ((*argc)-1) * sizeof(char*)); - *argc = *argc - 1; -} - static void usage() { printf("usage: datefmt [OPTION...] [FORMAT]\n\n"); printf("format unix timestamps from stdin\n\n"); @@ -164,11 +156,20 @@ static void usage() { printf("\n FORMAT\n a strftime format string, defaults to '%%F %%R'\n"); - printf("\n EXAMPLE\n datefmt --after $(date -d yesterday +%%s) < spreadsheet.csv\n\n"); + printf("\n EXAMPLE\n datefmt --after $(date -d yesterday +%%s) %%R < spreadsheet.csv\n\n"); printf(" Created By: William Casarin <https://jb55.com>\n"); exit(0); } + +static void shift_arg(int *argc, char **argv) +{ + if (*argc < 1) + return; + memmove(argv, &argv[1], ((*argc)-1) * sizeof(char*)); + *argc = *argc - 1; +} + static void parse_arg(int *argc, char **argv, struct parser *parser) { char *endptr;