aboutsummaryrefslogtreecommitdiff
path: root/addts.c
diff options
context:
space:
mode:
Diffstat (limited to 'addts.c')
-rw-r--r--addts.c35
1 files changed, 33 insertions, 2 deletions
diff --git a/addts.c b/addts.c
index 07fae4f..92f7e86 100644
--- a/addts.c
+++ b/addts.c
@@ -1,3 +1,19 @@
1/* This file is part of addts
2 * Copyright (C) 2018, 2019 Sergey Poznyakoff
3 *
4 * Addts is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 3, or (at your option)
7 * any later version.
8 *
9 * Addts is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with addts. If not, see <http://www.gnu.org/licenses/>.
16 */
1#include <stdlib.h> 17#include <stdlib.h>
2#include <stdio.h> 18#include <stdio.h>
3#include <unistd.h> 19#include <unistd.h>
@@ -50,6 +66,22 @@ alpha(int c)
50 return c == '\n' ? AEOL : ACHR; 66 return c == '\n' ? AEOL : ACHR;
51} 67}
52 68
69static void
70help(char *progname)
71{
72 printf("Usage: %s [OPTION]... [FILE]\n", progname);
73 puts("add timestamps at the beginning of each line\n");
74 puts(" -a append to FILE, instead of overwriting it");
75 puts(" -f FORMAT strftime(3) format for timestamps");
76 puts(" -s add timestamp to the end of each line");
77 puts(" -u report times in UTC");
78 puts(" -w CHR replace CHR with a horizontal space in FORMAT");
79 putchar('\n');
80 printf("Default FORMAT is \"%s\"\n", default_fmt);
81 putchar('\n');
82 puts("Report bugs to <gray@gnu.org>");
83}
84
53int 85int
54main(int argc, char **argv) 86main(int argc, char **argv)
55{ 87{
@@ -85,8 +117,7 @@ main(int argc, char **argv)
85 break; 117 break;
86 default: 118 default:
87 if (optopt == 0) { 119 if (optopt == 0) {
88 printf("usage: %s [-asu] [-f FMT] [OUT-FILE]\n", 120 help(argv[0]);
89 argv[0]);
90 return 0; 121 return 0;
91 } 122 }
92 return 1; 123 return 1;

Return to:

Send suggestions and report system problems to the System administrator.