diff options
Diffstat (limited to 'addts.c')
-rw-r--r-- | addts.c | 35 |
1 files changed, 33 insertions, 2 deletions
@@ -1,3 +1,19 @@ +/* This file is part of addts + * Copyright (C) 2018, 2019 Sergey Poznyakoff + * + * Addts is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * Addts is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with addts. If not, see <http://www.gnu.org/licenses/>. + */ #include <stdlib.h> #include <stdio.h> #include <unistd.h> @@ -50,6 +66,22 @@ alpha(int c) return c == '\n' ? AEOL : ACHR; } +static void +help(char *progname) +{ + printf("Usage: %s [OPTION]... [FILE]\n", progname); + puts("add timestamps at the beginning of each line\n"); + puts(" -a append to FILE, instead of overwriting it"); + puts(" -f FORMAT strftime(3) format for timestamps"); + puts(" -s add timestamp to the end of each line"); + puts(" -u report times in UTC"); + puts(" -w CHR replace CHR with a horizontal space in FORMAT"); + putchar('\n'); + printf("Default FORMAT is \"%s\"\n", default_fmt); + putchar('\n'); + puts("Report bugs to <gray@gnu.org>"); +} + int main(int argc, char **argv) { @@ -85,8 +117,7 @@ main(int argc, char **argv) break; default: if (optopt == 0) { - printf("usage: %s [-asu] [-f FMT] [OUT-FILE]\n", - argv[0]); + help(argv[0]); return 0; } return 1; |