From 492f8fabc828f286b3b6b12ed3396bde026c663a Mon Sep 17 00:00:00 2001 From: Sergey Poznyakoff Date: Wed, 31 Jul 2019 15:43:43 +0300 Subject: Version 1.0 --- addts.c | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) (limited to 'addts.c') diff --git a/addts.c b/addts.c index 07fae4f..92f7e86 100644 --- a/addts.c +++ b/addts.c @@ -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 . + */ #include #include #include @@ -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 "); +} + 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; -- cgit v1.2.1