annotate lib-src/rcs2log @ 94859:53f6ff0ac075

Fix typo.
author Dan Nicolaescu <dann@ics.uci.edu>
date Sun, 11 May 2008 15:36:33 +0000
parents 3a4bc081639c
children c24da9d5750f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
12507
da322c027bf0 Replace `#!/bin/sh' with `#! /bin/sh', for benefit of systems
Paul Eggert <eggert@twinsun.com>
parents: 12408
diff changeset
1 #! /bin/sh
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
2
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
3 # RCS to ChangeLog generator
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
4
94828
3a4bc081639c Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 79748
diff changeset
5 # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2001, 2002, 2003,
3a4bc081639c Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 79748
diff changeset
6 # 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
3a4bc081639c Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 79748
diff changeset
7
3a4bc081639c Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 79748
diff changeset
8 # This program is free software: you can redistribute it and/or modify
3a4bc081639c Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 79748
diff changeset
9 # it under the terms of the GNU General Public License as published by
3a4bc081639c Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 79748
diff changeset
10 # the Free Software Foundation, either version 3 of the License, or
3a4bc081639c Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 79748
diff changeset
11 # (at your option) any later version.
3a4bc081639c Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 79748
diff changeset
12
3a4bc081639c Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 79748
diff changeset
13 # This program is distributed in the hope that it will be useful,
3a4bc081639c Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 79748
diff changeset
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
3a4bc081639c Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 79748
diff changeset
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3a4bc081639c Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 79748
diff changeset
16 # GNU General Public License for more details.
3a4bc081639c Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 79748
diff changeset
17
3a4bc081639c Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 79748
diff changeset
18 # You should have received a copy of the GNU General Public License
3a4bc081639c Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 79748
diff changeset
19 # along with this program. If not, see <http://www.gnu.org/licenses/>.
3a4bc081639c Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 79748
diff changeset
20
3a4bc081639c Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 79748
diff changeset
21
3a4bc081639c Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 79748
diff changeset
22 Copyright='Copyright (C) 2008 Free Software Foundation, Inc.
3a4bc081639c Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 79748
diff changeset
23 This program comes with NO WARRANTY, to the extent permitted by law.
3a4bc081639c Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 79748
diff changeset
24 You may redistribute copies of this program
3a4bc081639c Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 79748
diff changeset
25 under the terms of the GNU General Public License.
3a4bc081639c Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 79748
diff changeset
26 For more information about these matters, see the files named COPYING.
3a4bc081639c Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 79748
diff changeset
27 Author: Paul Eggert <eggert@twinsun.com>'
3a4bc081639c Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 79748
diff changeset
28
54965
860258597b78 * rcs2log (Help): Clarify wording of the usage message.
Paul Eggert <eggert@twinsun.com>
parents: 53947
diff changeset
29 Help='
860258597b78 * rcs2log (Help): Clarify wording of the usage message.
Paul Eggert <eggert@twinsun.com>
parents: 53947
diff changeset
30 Generate ChangeLog entries from RCS files (perhaps in a CVS repository)
860258597b78 * rcs2log (Help): Clarify wording of the usage message.
Paul Eggert <eggert@twinsun.com>
parents: 53947
diff changeset
31 and the ChangeLog file (if any). An RCS file typically has a name
860258597b78 * rcs2log (Help): Clarify wording of the usage message.
Paul Eggert <eggert@twinsun.com>
parents: 53947
diff changeset
32 ending in ",v", and represents the entire history of a file that is
860258597b78 * rcs2log (Help): Clarify wording of the usage message.
Paul Eggert <eggert@twinsun.com>
parents: 53947
diff changeset
33 under revision control. The ChangeLog file logs entries for changes,
860258597b78 * rcs2log (Help): Clarify wording of the usage message.
Paul Eggert <eggert@twinsun.com>
parents: 53947
diff changeset
34 in reverse chronological order.
860258597b78 * rcs2log (Help): Clarify wording of the usage message.
Paul Eggert <eggert@twinsun.com>
parents: 53947
diff changeset
35
860258597b78 * rcs2log (Help): Clarify wording of the usage message.
Paul Eggert <eggert@twinsun.com>
parents: 53947
diff changeset
36 Generate entries for changes entered into RCS (or CVS) more recently
860258597b78 * rcs2log (Help): Clarify wording of the usage message.
Paul Eggert <eggert@twinsun.com>
parents: 53947
diff changeset
37 than the newest existing entry in the ChangeLog file. You can then
860258597b78 * rcs2log (Help): Clarify wording of the usage message.
Paul Eggert <eggert@twinsun.com>
parents: 53947
diff changeset
38 edit these entries by hand, and prepend them to the ChangeLog file.
860258597b78 * rcs2log (Help): Clarify wording of the usage message.
Paul Eggert <eggert@twinsun.com>
parents: 53947
diff changeset
39
860258597b78 * rcs2log (Help): Clarify wording of the usage message.
Paul Eggert <eggert@twinsun.com>
parents: 53947
diff changeset
40 Output the resulting ChangeLog entries to standard output.
860258597b78 * rcs2log (Help): Clarify wording of the usage message.
Paul Eggert <eggert@twinsun.com>
parents: 53947
diff changeset
41 Each entry looks something like this:
860258597b78 * rcs2log (Help): Clarify wording of the usage message.
Paul Eggert <eggert@twinsun.com>
parents: 53947
diff changeset
42
860258597b78 * rcs2log (Help): Clarify wording of the usage message.
Paul Eggert <eggert@twinsun.com>
parents: 53947
diff changeset
43 2004-04-17 Paul Eggert <eggert@gnu.org>
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
44
54965
860258597b78 * rcs2log (Help): Clarify wording of the usage message.
Paul Eggert <eggert@twinsun.com>
parents: 53947
diff changeset
45 * rcs2log (Help): Clarify wording of the usage message.
860258597b78 * rcs2log (Help): Clarify wording of the usage message.
Paul Eggert <eggert@twinsun.com>
parents: 53947
diff changeset
46 Problem reported by Alan Mackenzie in
860258597b78 * rcs2log (Help): Clarify wording of the usage message.
Paul Eggert <eggert@twinsun.com>
parents: 53947
diff changeset
47 <http://mail.gnu.org/archive/html/bug-gnu-emacs/2004-04/msg00188.html>.
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
48
54965
860258597b78 * rcs2log (Help): Clarify wording of the usage message.
Paul Eggert <eggert@twinsun.com>
parents: 53947
diff changeset
49 ChangeLog entries contain the current date, full name, email address
860258597b78 * rcs2log (Help): Clarify wording of the usage message.
Paul Eggert <eggert@twinsun.com>
parents: 53947
diff changeset
50 including hostname, the name of the affected file, and commentary.
860258597b78 * rcs2log (Help): Clarify wording of the usage message.
Paul Eggert <eggert@twinsun.com>
parents: 53947
diff changeset
51 RCS and CVS logs lack full names and email addresses, so they are
860258597b78 * rcs2log (Help): Clarify wording of the usage message.
Paul Eggert <eggert@twinsun.com>
parents: 53947
diff changeset
52 inferred from login names using a heuristic that can be overridden
860258597b78 * rcs2log (Help): Clarify wording of the usage message.
Paul Eggert <eggert@twinsun.com>
parents: 53947
diff changeset
53 via the -u option.
860258597b78 * rcs2log (Help): Clarify wording of the usage message.
Paul Eggert <eggert@twinsun.com>
parents: 53947
diff changeset
54
860258597b78 * rcs2log (Help): Clarify wording of the usage message.
Paul Eggert <eggert@twinsun.com>
parents: 53947
diff changeset
55 Ignore log entries that start with "#".
860258597b78 * rcs2log (Help): Clarify wording of the usage message.
Paul Eggert <eggert@twinsun.com>
parents: 53947
diff changeset
56 Clump together log entries that start with "{topic} ",
860258597b78 * rcs2log (Help): Clarify wording of the usage message.
Paul Eggert <eggert@twinsun.com>
parents: 53947
diff changeset
57 where "topic" contains neither white space nor "}".
860258597b78 * rcs2log (Help): Clarify wording of the usage message.
Paul Eggert <eggert@twinsun.com>
parents: 53947
diff changeset
58
860258597b78 * rcs2log (Help): Clarify wording of the usage message.
Paul Eggert <eggert@twinsun.com>
parents: 53947
diff changeset
59 If no FILE is specified, use all files under the working directory
860258597b78 * rcs2log (Help): Clarify wording of the usage message.
Paul Eggert <eggert@twinsun.com>
parents: 53947
diff changeset
60 that are maintained under version control.
860258597b78 * rcs2log (Help): Clarify wording of the usage message.
Paul Eggert <eggert@twinsun.com>
parents: 53947
diff changeset
61
16899
04ad9edd12b3 --help, --version: New options, for conformance to GNU coding standards.
Paul Eggert <eggert@twinsun.com>
parents: 16507
diff changeset
62 Options:
1800
05cb79ebdb23 Add copyright and authorship notices.
Paul Eggert <eggert@twinsun.com>
parents: 1228
diff changeset
63
54965
860258597b78 * rcs2log (Help): Clarify wording of the usage message.
Paul Eggert <eggert@twinsun.com>
parents: 53947
diff changeset
64 -c FILE Output ChangeLog entries for FILE (default ChangeLog).
16899
04ad9edd12b3 --help, --version: New options, for conformance to GNU coding standards.
Paul Eggert <eggert@twinsun.com>
parents: 16507
diff changeset
65 -h HOSTNAME Use HOSTNAME in change log entries (default current host).
04ad9edd12b3 --help, --version: New options, for conformance to GNU coding standards.
Paul Eggert <eggert@twinsun.com>
parents: 16507
diff changeset
66 -i INDENT Indent change log lines by INDENT spaces (default 8).
04ad9edd12b3 --help, --version: New options, for conformance to GNU coding standards.
Paul Eggert <eggert@twinsun.com>
parents: 16507
diff changeset
67 -l LENGTH Try to limit log lines to LENGTH characters (default 79).
54965
860258597b78 * rcs2log (Help): Clarify wording of the usage message.
Paul Eggert <eggert@twinsun.com>
parents: 53947
diff changeset
68 -L FILE Use FILE (same format as "rlog") for source of logs.
16899
04ad9edd12b3 --help, --version: New options, for conformance to GNU coding standards.
Paul Eggert <eggert@twinsun.com>
parents: 16507
diff changeset
69 -R If no FILEs are given and RCS is used, recurse through working directory.
54965
860258597b78 * rcs2log (Help): Clarify wording of the usage message.
Paul Eggert <eggert@twinsun.com>
parents: 53947
diff changeset
70 -r OPTION Pass OPTION to subsidiary command (either "rlog" or "cvs -q log").
16899
04ad9edd12b3 --help, --version: New options, for conformance to GNU coding standards.
Paul Eggert <eggert@twinsun.com>
parents: 16507
diff changeset
71 -t TABWIDTH Tab stops are every TABWIDTH characters (default 8).
54965
860258597b78 * rcs2log (Help): Clarify wording of the usage message.
Paul Eggert <eggert@twinsun.com>
parents: 53947
diff changeset
72 -u "LOGIN<tab>FULLNAME<tab>EMAILADDR" LOGIN has FULLNAME and EMAILADDR.
16899
04ad9edd12b3 --help, --version: New options, for conformance to GNU coding standards.
Paul Eggert <eggert@twinsun.com>
parents: 16507
diff changeset
73 -v Append RCS revision to file names in log lines.
04ad9edd12b3 --help, --version: New options, for conformance to GNU coding standards.
Paul Eggert <eggert@twinsun.com>
parents: 16507
diff changeset
74 --help Output help.
04ad9edd12b3 --help, --version: New options, for conformance to GNU coding standards.
Paul Eggert <eggert@twinsun.com>
parents: 16507
diff changeset
75 --version Output version number.
1800
05cb79ebdb23 Add copyright and authorship notices.
Paul Eggert <eggert@twinsun.com>
parents: 1228
diff changeset
76
23008
26e379429f7f Update bug report address and copyright.
Paul Eggert <eggert@twinsun.com>
parents: 23002
diff changeset
77 Report bugs to <bug-gnu-emacs@gnu.org>.'
16899
04ad9edd12b3 --help, --version: New options, for conformance to GNU coding standards.
Paul Eggert <eggert@twinsun.com>
parents: 16507
diff changeset
78
64083
23a17af379b1 Update FSF's address.
Lute Kamstra <lute@gnu.org>
parents: 54965
diff changeset
79 Id='$Id$'
16899
04ad9edd12b3 --help, --version: New options, for conformance to GNU coding standards.
Paul Eggert <eggert@twinsun.com>
parents: 16507
diff changeset
80
39150
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
81 # Use the traditional C locale.
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
82 LANG=C
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
83 LANGUAGE=C
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
84 LC_ALL=C
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
85 LC_COLLATE=C
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
86 LC_CTYPE=C
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
87 LC_MESSAGES=C
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
88 LC_NUMERIC=C
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
89 LC_TIME=C
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
90 export LANG LANGUAGE LC_ALL LC_COLLATE LC_CTYPE LC_MESSAGES LC_NUMERIC LC_TIME
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
91
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
92 # These variables each contain a single ASCII character.
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
93 # Unfortunately, there's no portable way of writing these characters
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
94 # in older Unix implementations, other than putting them directly into
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
95 # this text file.
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
96 SOH='' # SOH, octal code 001
11073
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
97 tab=' '
3248
9ee93fc9aba0 When given no file arguments, inspect RCS/.* as well
Richard M. Stallman <rms@gnu.org>
parents: 2639
diff changeset
98 nl='
9ee93fc9aba0 When given no file arguments, inspect RCS/.* as well
Richard M. Stallman <rms@gnu.org>
parents: 2639
diff changeset
99 '
1800
05cb79ebdb23 Add copyright and authorship notices.
Paul Eggert <eggert@twinsun.com>
parents: 1228
diff changeset
100
534
6f7abc0e1f10 Add -i, -l, -t.
Paul Eggert <eggert@twinsun.com>
parents: 527
diff changeset
101 # Parse options.
6f7abc0e1f10 Add -i, -l, -t.
Paul Eggert <eggert@twinsun.com>
parents: 527
diff changeset
102
6f7abc0e1f10 Add -i, -l, -t.
Paul Eggert <eggert@twinsun.com>
parents: 527
diff changeset
103 # defaults
43097
c421297164e2 (Copyright): Update to 2002.
Paul Eggert <eggert@twinsun.com>
parents: 41649
diff changeset
104 AWK=${AWK-awk}
c421297164e2 (Copyright): Update to 2002.
Paul Eggert <eggert@twinsun.com>
parents: 41649
diff changeset
105 TMPDIR=${TMPDIR-/tmp}
15911
c9a152ad9c5a Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents: 15742
diff changeset
106 changelog=ChangeLog # change log file name
c9a152ad9c5a Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents: 15742
diff changeset
107 datearg= # rlog date option
4783
7c75802f5a8b Add -h, -n, -r options.
Paul Eggert <eggert@twinsun.com>
parents: 4654
diff changeset
108 hostname= # name of local host (if empty, will deduce it later)
534
6f7abc0e1f10 Add -i, -l, -t.
Paul Eggert <eggert@twinsun.com>
parents: 527
diff changeset
109 indent=8 # indent of log line
6f7abc0e1f10 Add -i, -l, -t.
Paul Eggert <eggert@twinsun.com>
parents: 527
diff changeset
110 length=79 # suggested max width of log line
11627
2f0766bf8315 (datearg): If rlog options are specified explicitly,
Paul Eggert <eggert@twinsun.com>
parents: 11099
diff changeset
111 logins= # login names for people we know fullnames and mailaddrs of
11073
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
112 loginFullnameMailaddrs= # login<tab>fullname<tab>mailaddr triplets
15911
c9a152ad9c5a Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents: 15742
diff changeset
113 logTZ= # time zone for log dates (if empty, use local time)
11073
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
114 recursive= # t if we want recursive rlog
15911
c9a152ad9c5a Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents: 15742
diff changeset
115 revision= # t if we want revision numbers
4783
7c75802f5a8b Add -h, -n, -r options.
Paul Eggert <eggert@twinsun.com>
parents: 4654
diff changeset
116 rlog_options= # options to pass to rlog
39150
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
117 rlogfile= # log file to read from
534
6f7abc0e1f10 Add -i, -l, -t.
Paul Eggert <eggert@twinsun.com>
parents: 527
diff changeset
118 tabwidth=8 # width of horizontal tab
6f7abc0e1f10 Add -i, -l, -t.
Paul Eggert <eggert@twinsun.com>
parents: 527
diff changeset
119
6f7abc0e1f10 Add -i, -l, -t.
Paul Eggert <eggert@twinsun.com>
parents: 527
diff changeset
120 while :
6f7abc0e1f10 Add -i, -l, -t.
Paul Eggert <eggert@twinsun.com>
parents: 527
diff changeset
121 do
6f7abc0e1f10 Add -i, -l, -t.
Paul Eggert <eggert@twinsun.com>
parents: 527
diff changeset
122 case $1 in
15911
c9a152ad9c5a Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents: 15742
diff changeset
123 -c) changelog=${2?}; shift;;
11073
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
124 -i) indent=${2?}; shift;;
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
125 -h) hostname=${2?}; shift;;
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
126 -l) length=${2?}; shift;;
39150
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
127 -L) rlogfile=${2?}; shift;;
11073
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
128 -[nu]) # -n is obsolescent; it is replaced by -u.
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
129 case $1 in
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
130 -n) case ${2?}${3?}${4?} in
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
131 *"$tab"* | *"$nl"*)
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
132 echo >&2 "$0: -n '$2' '$3' '$4': tabs, newlines not allowed"
39150
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
133 exit 1;;
11073
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
134 esac
39150
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
135 login=$2
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
136 lfm=$2$tab$3$tab$4
11073
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
137 shift; shift; shift;;
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
138 -u)
11082
aee85fcd9d25 Treat -u 'LOGIN:FULLNAME:MAILADDR' as if it were
Paul Eggert <eggert@twinsun.com>
parents: 11073
diff changeset
139 # If $2 is not tab-separated, use colon for separator.
11073
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
140 case ${2?} in
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
141 *"$nl"*)
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
142 echo >&2 "$0: -u '$2': newlines not allowed"
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
143 exit 1;;
11082
aee85fcd9d25 Treat -u 'LOGIN:FULLNAME:MAILADDR' as if it were
Paul Eggert <eggert@twinsun.com>
parents: 11073
diff changeset
144 *"$tab"*)
aee85fcd9d25 Treat -u 'LOGIN:FULLNAME:MAILADDR' as if it were
Paul Eggert <eggert@twinsun.com>
parents: 11073
diff changeset
145 t=$tab;;
aee85fcd9d25 Treat -u 'LOGIN:FULLNAME:MAILADDR' as if it were
Paul Eggert <eggert@twinsun.com>
parents: 11073
diff changeset
146 *)
39150
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
147 t=':';;
11082
aee85fcd9d25 Treat -u 'LOGIN:FULLNAME:MAILADDR' as if it were
Paul Eggert <eggert@twinsun.com>
parents: 11073
diff changeset
148 esac
aee85fcd9d25 Treat -u 'LOGIN:FULLNAME:MAILADDR' as if it were
Paul Eggert <eggert@twinsun.com>
parents: 11073
diff changeset
149 case $2 in
aee85fcd9d25 Treat -u 'LOGIN:FULLNAME:MAILADDR' as if it were
Paul Eggert <eggert@twinsun.com>
parents: 11073
diff changeset
150 *"$t"*"$t"*"$t"*)
11073
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
151 echo >&2 "$0: -u '$2': too many fields"
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
152 exit 1;;
11082
aee85fcd9d25 Treat -u 'LOGIN:FULLNAME:MAILADDR' as if it were
Paul Eggert <eggert@twinsun.com>
parents: 11073
diff changeset
153 *"$t"*"$t"*)
39150
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
154 uf="[^$t]*$t" # An unselected field, followed by a separator.
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
155 sf="\\([^$t]*\\)" # The selected field.
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
156 login=`expr "X$2" : "X$sf"`
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
157 lfm="$login$tab"`
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
158 expr "X$2" : "$uf$sf"
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
159 `"$tab"`
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
160 expr "X$2" : "$uf$uf$sf"
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
161 `;;
11073
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
162 *)
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
163 echo >&2 "$0: -u '$2': not enough fields"
39150
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
164 exit 1;;
11073
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
165 esac
39150
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
166 shift;;
4783
7c75802f5a8b Add -h, -n, -r options.
Paul Eggert <eggert@twinsun.com>
parents: 4654
diff changeset
167 esac
17741
0c832661d9b4 (loginFullnameMailaddrs, logins, rlog_options, files): Don't prepend $nl
Paul Eggert <eggert@twinsun.com>
parents: 17740
diff changeset
168 case $logins in
0c832661d9b4 (loginFullnameMailaddrs, logins, rlog_options, files): Don't prepend $nl
Paul Eggert <eggert@twinsun.com>
parents: 17740
diff changeset
169 '') logins=$login;;
39150
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
170 ?*) logins=$logins$nl$login;;
17741
0c832661d9b4 (loginFullnameMailaddrs, logins, rlog_options, files): Don't prepend $nl
Paul Eggert <eggert@twinsun.com>
parents: 17740
diff changeset
171 esac
39150
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
172 case $loginFullnameMailaddrs in
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
173 '') loginFullnameMailaddrs=$lfm;;
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
174 ?*) loginFullnameMailaddrs=$loginFullnameMailaddrs$nl$lfm;;
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
175 esac;;
17741
0c832661d9b4 (loginFullnameMailaddrs, logins, rlog_options, files): Don't prepend $nl
Paul Eggert <eggert@twinsun.com>
parents: 17740
diff changeset
176 -r)
0c832661d9b4 (loginFullnameMailaddrs, logins, rlog_options, files): Don't prepend $nl
Paul Eggert <eggert@twinsun.com>
parents: 17740
diff changeset
177 case $rlog_options in
0c832661d9b4 (loginFullnameMailaddrs, logins, rlog_options, files): Don't prepend $nl
Paul Eggert <eggert@twinsun.com>
parents: 17740
diff changeset
178 '') rlog_options=${2?};;
39150
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
179 ?*) rlog_options=$rlog_options$nl${2?};;
17741
0c832661d9b4 (loginFullnameMailaddrs, logins, rlog_options, files): Don't prepend $nl
Paul Eggert <eggert@twinsun.com>
parents: 17740
diff changeset
180 esac
0c832661d9b4 (loginFullnameMailaddrs, logins, rlog_options, files): Don't prepend $nl
Paul Eggert <eggert@twinsun.com>
parents: 17740
diff changeset
181 shift;;
11073
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
182 -R) recursive=t;;
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
183 -t) tabwidth=${2?}; shift;;
15911
c9a152ad9c5a Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents: 15742
diff changeset
184 -v) revision=t;;
16899
04ad9edd12b3 --help, --version: New options, for conformance to GNU coding standards.
Paul Eggert <eggert@twinsun.com>
parents: 16507
diff changeset
185 --version)
04ad9edd12b3 --help, --version: New options, for conformance to GNU coding standards.
Paul Eggert <eggert@twinsun.com>
parents: 16507
diff changeset
186 set $Id
04ad9edd12b3 --help, --version: New options, for conformance to GNU coding standards.
Paul Eggert <eggert@twinsun.com>
parents: 16507
diff changeset
187 rcs2logVersion=$3
04ad9edd12b3 --help, --version: New options, for conformance to GNU coding standards.
Paul Eggert <eggert@twinsun.com>
parents: 16507
diff changeset
188 echo >&2 "rcs2log (GNU Emacs) $rcs2logVersion$nl$Copyright"
04ad9edd12b3 --help, --version: New options, for conformance to GNU coding standards.
Paul Eggert <eggert@twinsun.com>
parents: 16507
diff changeset
189 exit 0;;
04ad9edd12b3 --help, --version: New options, for conformance to GNU coding standards.
Paul Eggert <eggert@twinsun.com>
parents: 16507
diff changeset
190 -*) echo >&2 "Usage: $0 [OPTION]... [FILE ...]$nl$Help"
04ad9edd12b3 --help, --version: New options, for conformance to GNU coding standards.
Paul Eggert <eggert@twinsun.com>
parents: 16507
diff changeset
191 case $1 in
04ad9edd12b3 --help, --version: New options, for conformance to GNU coding standards.
Paul Eggert <eggert@twinsun.com>
parents: 16507
diff changeset
192 --help) exit 0;;
39150
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
193 *) exit 1;;
16899
04ad9edd12b3 --help, --version: New options, for conformance to GNU coding standards.
Paul Eggert <eggert@twinsun.com>
parents: 16507
diff changeset
194 esac;;
39150
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
195 *) break;;
534
6f7abc0e1f10 Add -i, -l, -t.
Paul Eggert <eggert@twinsun.com>
parents: 527
diff changeset
196 esac
11073
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
197 shift
534
6f7abc0e1f10 Add -i, -l, -t.
Paul Eggert <eggert@twinsun.com>
parents: 527
diff changeset
198 done
6f7abc0e1f10 Add -i, -l, -t.
Paul Eggert <eggert@twinsun.com>
parents: 527
diff changeset
199
2220
66371f0b8aff Some awks don't understand "\r". Code around this.
Paul Eggert <eggert@twinsun.com>
parents: 1800
diff changeset
200 month_data='
66371f0b8aff Some awks don't understand "\r". Code around this.
Paul Eggert <eggert@twinsun.com>
parents: 1800
diff changeset
201 m[0]="Jan"; m[1]="Feb"; m[2]="Mar"
66371f0b8aff Some awks don't understand "\r". Code around this.
Paul Eggert <eggert@twinsun.com>
parents: 1800
diff changeset
202 m[3]="Apr"; m[4]="May"; m[5]="Jun"
66371f0b8aff Some awks don't understand "\r". Code around this.
Paul Eggert <eggert@twinsun.com>
parents: 1800
diff changeset
203 m[6]="Jul"; m[7]="Aug"; m[8]="Sep"
66371f0b8aff Some awks don't understand "\r". Code around this.
Paul Eggert <eggert@twinsun.com>
parents: 1800
diff changeset
204 m[9]="Oct"; m[10]="Nov"; m[11]="Dec"
66371f0b8aff Some awks don't understand "\r". Code around this.
Paul Eggert <eggert@twinsun.com>
parents: 1800
diff changeset
205 '
66371f0b8aff Some awks don't understand "\r". Code around this.
Paul Eggert <eggert@twinsun.com>
parents: 1800
diff changeset
206
35016
731a7aca9458 Avoid security hole allowing attacker to
Gerd Moellmann <gerd@gnu.org>
parents: 23008
diff changeset
207 logdir=$TMPDIR/rcs2log$$
731a7aca9458 Avoid security hole allowing attacker to
Gerd Moellmann <gerd@gnu.org>
parents: 23008
diff changeset
208 llogout=$logdir/l
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
209 trap exit 1 2 13 15
35016
731a7aca9458 Avoid security hole allowing attacker to
Gerd Moellmann <gerd@gnu.org>
parents: 23008
diff changeset
210 trap "rm -fr $logdir 2>/dev/null" 0
731a7aca9458 Avoid security hole allowing attacker to
Gerd Moellmann <gerd@gnu.org>
parents: 23008
diff changeset
211 (umask 077 && exec mkdir $logdir) || exit
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
212
39150
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
213 # If no rlog-format log file is given, generate one into $rlogfile.
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
214 case $rlogfile in
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
215 '')
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
216 rlogfile=$logdir/r
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
217
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
218 # If no rlog options are given,
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
219 # log the revisions checked in since the first ChangeLog entry.
53317
2ca480ce7e51 (rlog_options): Append -rbranchtag if CVS/Tag indicates
Paul Eggert <eggert@twinsun.com>
parents: 52401
diff changeset
220 # Since ChangeLog is only by date, some of these revisions may be
2ca480ce7e51 (rlog_options): Append -rbranchtag if CVS/Tag indicates
Paul Eggert <eggert@twinsun.com>
parents: 52401
diff changeset
221 # duplicates of what's already in ChangeLog; it's the user's
2ca480ce7e51 (rlog_options): Append -rbranchtag if CVS/Tag indicates
Paul Eggert <eggert@twinsun.com>
parents: 52401
diff changeset
222 # responsibility to remove them.
39150
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
223 case $rlog_options in
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
224 '')
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
225 if test -s "$changelog"
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
226 then
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
227 e='
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
228 /^[0-9]+-[0-9][0-9]-[0-9][0-9]/{
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
229 # ISO 8601 date
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
230 print $1
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
231 exit
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
232 }
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
233 /^... ... [ 0-9][0-9] [ 0-9][0-9]:[0-9][0-9]:[0-9][0-9] [0-9]+ /{
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
234 # old-fashioned date and time (Emacs 19.31 and earlier)
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
235 '"$month_data"'
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
236 year = $5
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
237 for (i=0; i<=11; i++) if (m[i] == $2) break
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
238 dd = $3
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
239 printf "%d-%02d-%02d\n", year, i+1, dd
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
240 exit
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
241 }
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
242 '
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
243 d=`$AWK "$e" <"$changelog"` || exit
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
244 case $d in
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
245 ?*) datearg="-d>$d";;
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
246 esac
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
247 fi;;
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
248 esac
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
249
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
250 # Use TZ specified by ChangeLog local variable, if any.
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
251 if test -s "$changelog"
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
252 then
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
253 extractTZ='
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
254 /^.*change-log-time-zone-rule['"$tab"' ]*:['"$tab"' ]*"\([^"]*\)".*/{
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
255 s//\1/; p; q
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
256 }
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
257 /^.*change-log-time-zone-rule['"$tab"' ]*:['"$tab"' ]*t.*/{
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
258 s//UTC0/; p; q
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
259 }
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
260 '
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
261 logTZ=`tail "$changelog" | sed -n "$extractTZ"`
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
262 case $logTZ in
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
263 ?*) TZ=$logTZ; export TZ;;
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
264 esac
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
265 fi
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
266
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
267 # If CVS is in use, examine its repository, not the normal RCS files.
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
268 if test ! -f CVS/Repository
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
269 then
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
270 rlog=rlog
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
271 repository=
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
272 else
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
273 rlog='cvs -q log'
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
274 repository=`sed 1q <CVS/Repository` || exit
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
275 test ! -f CVS/Root || CVSROOT=`cat <CVS/Root` || exit
53947
8f3f4ab62a69 Work correctly if CVSROOT specifies :fork: or
Paul Eggert <eggert@twinsun.com>
parents: 53317
diff changeset
276 pository=
39150
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
277 case $CVSROOT in
53947
8f3f4ab62a69 Work correctly if CVSROOT specifies :fork: or
Paul Eggert <eggert@twinsun.com>
parents: 53317
diff changeset
278 /* | :fork:* | :local:*) ;;
8f3f4ab62a69 Work correctly if CVSROOT specifies :fork: or
Paul Eggert <eggert@twinsun.com>
parents: 53317
diff changeset
279 */*)
39150
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
280 # remote repository
53947
8f3f4ab62a69 Work correctly if CVSROOT specifies :fork: or
Paul Eggert <eggert@twinsun.com>
parents: 53317
diff changeset
281 pository=`expr "X$CVSROOT" : '[^/]*\(.*\)'`;;
8f3f4ab62a69 Work correctly if CVSROOT specifies :fork: or
Paul Eggert <eggert@twinsun.com>
parents: 53317
diff changeset
282 esac
8f3f4ab62a69 Work correctly if CVSROOT specifies :fork: or
Paul Eggert <eggert@twinsun.com>
parents: 53317
diff changeset
283 case $pository in
8f3f4ab62a69 Work correctly if CVSROOT specifies :fork: or
Paul Eggert <eggert@twinsun.com>
parents: 53317
diff changeset
284 '')
39150
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
285 # local repository
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
286 case $repository in
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
287 /*) ;;
53947
8f3f4ab62a69 Work correctly if CVSROOT specifies :fork: or
Paul Eggert <eggert@twinsun.com>
parents: 53317
diff changeset
288 *)
8f3f4ab62a69 Work correctly if CVSROOT specifies :fork: or
Paul Eggert <eggert@twinsun.com>
parents: 53317
diff changeset
289 repository=${CVSROOT?}/$repository
8f3f4ab62a69 Work correctly if CVSROOT specifies :fork: or
Paul Eggert <eggert@twinsun.com>
parents: 53317
diff changeset
290 case $repository in
8f3f4ab62a69 Work correctly if CVSROOT specifies :fork: or
Paul Eggert <eggert@twinsun.com>
parents: 53317
diff changeset
291 :fork:* | :local:*)
8f3f4ab62a69 Work correctly if CVSROOT specifies :fork: or
Paul Eggert <eggert@twinsun.com>
parents: 53317
diff changeset
292 repository=`expr "$repository" : ':[^:]*:\(.*\)'`;;
8f3f4ab62a69 Work correctly if CVSROOT specifies :fork: or
Paul Eggert <eggert@twinsun.com>
parents: 53317
diff changeset
293 esac;;
39150
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
294 esac
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
295 if test ! -d "$repository"
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
296 then
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
297 echo >&2 "$0: $repository: bad repository (see CVS/Repository)"
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
298 exit 1
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
299 fi
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
300 pository=$repository;;
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
301 esac
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
302
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
303 # Ensure that $pository ends in exactly one slash.
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
304 while :
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
305 do
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
306 case $pository in
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
307 *//) pository=`expr "X$pository" : 'X\(.*\)/'`;;
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
308 */) break;;
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
309 *) pository=$pository/; break;;
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
310 esac
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
311 done
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
312
53317
2ca480ce7e51 (rlog_options): Append -rbranchtag if CVS/Tag indicates
Paul Eggert <eggert@twinsun.com>
parents: 52401
diff changeset
313 # If no rlog options are given, and if we are in a tagged CVS branch,
2ca480ce7e51 (rlog_options): Append -rbranchtag if CVS/Tag indicates
Paul Eggert <eggert@twinsun.com>
parents: 52401
diff changeset
314 # log only the changes in that branch.
2ca480ce7e51 (rlog_options): Append -rbranchtag if CVS/Tag indicates
Paul Eggert <eggert@twinsun.com>
parents: 52401
diff changeset
315 case $rlog_options in
2ca480ce7e51 (rlog_options): Append -rbranchtag if CVS/Tag indicates
Paul Eggert <eggert@twinsun.com>
parents: 52401
diff changeset
316 '')
2ca480ce7e51 (rlog_options): Append -rbranchtag if CVS/Tag indicates
Paul Eggert <eggert@twinsun.com>
parents: 52401
diff changeset
317 if test -f CVS/Tag
2ca480ce7e51 (rlog_options): Append -rbranchtag if CVS/Tag indicates
Paul Eggert <eggert@twinsun.com>
parents: 52401
diff changeset
318 then
2ca480ce7e51 (rlog_options): Append -rbranchtag if CVS/Tag indicates
Paul Eggert <eggert@twinsun.com>
parents: 52401
diff changeset
319 CVSTAG=`cat <CVS/Tag` || exit
2ca480ce7e51 (rlog_options): Append -rbranchtag if CVS/Tag indicates
Paul Eggert <eggert@twinsun.com>
parents: 52401
diff changeset
320 case $CVSTAG in
2ca480ce7e51 (rlog_options): Append -rbranchtag if CVS/Tag indicates
Paul Eggert <eggert@twinsun.com>
parents: 52401
diff changeset
321 T?*)
2ca480ce7e51 (rlog_options): Append -rbranchtag if CVS/Tag indicates
Paul Eggert <eggert@twinsun.com>
parents: 52401
diff changeset
322 rlog_options=-r`expr "$CVSTAG" : 'T\(.*\)'`;;
2ca480ce7e51 (rlog_options): Append -rbranchtag if CVS/Tag indicates
Paul Eggert <eggert@twinsun.com>
parents: 52401
diff changeset
323 *)
2ca480ce7e51 (rlog_options): Append -rbranchtag if CVS/Tag indicates
Paul Eggert <eggert@twinsun.com>
parents: 52401
diff changeset
324 echo >&2 "$0: invalid CVS/Tag"; exit 1;;
2ca480ce7e51 (rlog_options): Append -rbranchtag if CVS/Tag indicates
Paul Eggert <eggert@twinsun.com>
parents: 52401
diff changeset
325 esac
2ca480ce7e51 (rlog_options): Append -rbranchtag if CVS/Tag indicates
Paul Eggert <eggert@twinsun.com>
parents: 52401
diff changeset
326 fi;;
2ca480ce7e51 (rlog_options): Append -rbranchtag if CVS/Tag indicates
Paul Eggert <eggert@twinsun.com>
parents: 52401
diff changeset
327 esac
39150
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
328 fi
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
329
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
330 # Use $rlog's -zLT option, if $rlog supports it.
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
331 case `$rlog -zLT 2>&1` in
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
332 *' option'*) ;;
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
333 *)
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
334 case $rlog_options in
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
335 '') rlog_options=-zLT;;
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
336 ?*) rlog_options=-zLT$nl$rlog_options;;
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
337 esac;;
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
338 esac
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
339
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
340 # With no arguments, examine all files under the RCS directory.
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
341 case $# in
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
342 0)
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
343 case $repository in
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
344 '')
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
345 oldIFS=$IFS
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
346 IFS=$nl
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
347 case $recursive in
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
348 t)
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
349 RCSdirs=`find . -name RCS -type d -print`
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
350 filesFromRCSfiles='s|,v$||; s|/RCS/|/|; s|^\./||'
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
351 files=`
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
352 {
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
353 case $RCSdirs in
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
354 ?*) find $RCSdirs \
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
355 -type f \
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
356 ! -name '*_' \
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
357 ! -name ',*,' \
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
358 ! -name '.*_' \
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
359 ! -name .rcsfreeze.log \
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
360 ! -name .rcsfreeze.ver \
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
361 -print;;
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
362 esac
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
363 find . -name '*,v' -print
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
364 } |
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
365 sort -u |
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
366 sed "$filesFromRCSfiles"
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
367 `;;
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
368 *)
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
369 files=
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
370 for file in RCS/.* RCS/* .*,v *,v
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
371 do
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
372 case $file in
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
373 RCS/. | RCS/.. | RCS/,*, | RCS/*_) continue;;
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
374 RCS/.rcsfreeze.log | RCS/.rcsfreeze.ver) continue;;
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
375 RCS/.\* | RCS/\* | .\*,v | \*,v) test -f "$file" || continue;;
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
376 RCS/*,v | RCS/.*,v) ;;
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
377 RCS/* | RCS/.*) test -f "$file" || continue;;
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
378 esac
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
379 case $files in
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
380 '') files=$file;;
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
381 ?*) files=$files$nl$file;;
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
382 esac
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
383 done
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
384 case $files in
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
385 '') exit 0;;
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
386 esac;;
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
387 esac
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
388 set x $files
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
389 shift
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
390 IFS=$oldIFS;;
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
391 esac;;
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
392 esac
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
393
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
394 case $datearg in
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
395 ?*) $rlog $rlog_options "$datearg" ${1+"$@"} >$rlogfile;;
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
396 '') $rlog $rlog_options ${1+"$@"} >$rlogfile;;
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
397 esac || exit;;
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
398 esac
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
399
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
400
43097
c421297164e2 (Copyright): Update to 2002.
Paul Eggert <eggert@twinsun.com>
parents: 41649
diff changeset
401 # Prefer the POSIX-style -k options, since POSIX 1003.1-2001 prohibits
c421297164e2 (Copyright): Update to 2002.
Paul Eggert <eggert@twinsun.com>
parents: 41649
diff changeset
402 # support for the traditional-style +M -N options.
c421297164e2 (Copyright): Update to 2002.
Paul Eggert <eggert@twinsun.com>
parents: 41649
diff changeset
403 SORT_K_OPTIONS='-k 3,4r -k 5 -k 1'
c421297164e2 (Copyright): Update to 2002.
Paul Eggert <eggert@twinsun.com>
parents: 41649
diff changeset
404 sort $SORT_K_OPTIONS </dev/null 2>/dev/null || SORT_K_OPTIONS='+2 -4r +4 +0'
c421297164e2 (Copyright): Update to 2002.
Paul Eggert <eggert@twinsun.com>
parents: 41649
diff changeset
405
c421297164e2 (Copyright): Update to 2002.
Paul Eggert <eggert@twinsun.com>
parents: 41649
diff changeset
406
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
407 # Get the full name of each author the logs mention, and set initialize_fullname
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
408 # to awk code that initializes the `fullname' awk associative array.
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
409 # Warning: foreign authors (i.e. not known in the passwd file) are mishandled;
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
410 # you have to fix the resulting output by hand.
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
411
11073
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
412 initialize_fullname=
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
413 initialize_mailaddr=
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
414
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
415 case $loginFullnameMailaddrs in
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
416 ?*)
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
417 case $loginFullnameMailaddrs in
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
418 *\"* | *\\*)
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
419 sed 's/["\\]/\\&/g' >$llogout <<EOF || exit
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
420 $loginFullnameMailaddrs
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
421 EOF
39150
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
422 loginFullnameMailaddrs=`cat $llogout`;;
11073
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
423 esac
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
424
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
425 oldIFS=$IFS
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
426 IFS=$nl
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
427 for loginFullnameMailaddr in $loginFullnameMailaddrs
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
428 do
39150
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
429 IFS=$tab
11073
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
430 set x $loginFullnameMailaddr
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
431 login=$2
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
432 fullname=$3
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
433 mailaddr=$4
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
434 initialize_fullname="$initialize_fullname
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
435 fullname[\"$login\"] = \"$fullname\""
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
436 initialize_mailaddr="$initialize_mailaddr
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
437 mailaddr[\"$login\"] = \"$mailaddr\""
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
438 done
39150
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
439 IFS=$oldIFS;;
11073
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
440 esac
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
441
39150
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
442 case $logins in
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
443 ?*)
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
444 sort -u -o $llogout <<EOF
4783
7c75802f5a8b Add -h, -n, -r options.
Paul Eggert <eggert@twinsun.com>
parents: 4654
diff changeset
445 $logins
7c75802f5a8b Add -h, -n, -r options.
Paul Eggert <eggert@twinsun.com>
parents: 4654
diff changeset
446 EOF
39150
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
447 ;;
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
448 '')
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
449 : ;;
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
450 esac >$llogout || exit
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
451
11073
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
452 output_authors='/^date: / {
12066
b9b0b3f96dc2 (output_authors): Allow ':' in time zone, as per ISO 8601 and RCS 5.6.8 beta.
Paul Eggert <eggert@twinsun.com>
parents: 11627
diff changeset
453 if ($2 ~ /^[0-9]*[-\/][0-9][0-9][-\/][0-9][0-9]$/ && $3 ~ /^[0-9][0-9]:[0-9][0-9]:[0-9][0-9][-+0-9:]*;$/ && $4 == "author:" && $5 ~ /^[^;]*;$/) {
11073
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
454 print substr($5, 1, length($5)-1)
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
455 }
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
456 }'
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
457 authors=`
39150
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
458 $AWK "$output_authors" <"$rlogfile" | sort -u | comm -23 - $llogout
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
459 `
640
36e7f4e402bd Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents: 636
diff changeset
460 case $authors in
36e7f4e402bd Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents: 636
diff changeset
461 ?*)
11073
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
462 cat >$llogout <<EOF || exit
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
463 $authors
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
464 EOF
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
465 initialize_author_script='s/["\\]/\\&/g; s/.*/author[\"&\"] = 1/'
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
466 initialize_author=`sed -e "$initialize_author_script" <$llogout`
640
36e7f4e402bd Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents: 636
diff changeset
467 awkscript='
36e7f4e402bd Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents: 636
diff changeset
468 BEGIN {
36e7f4e402bd Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents: 636
diff changeset
469 alphabet = "abcdefghijklmnopqrstuvwxyz"
36e7f4e402bd Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents: 636
diff changeset
470 ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
36e7f4e402bd Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents: 636
diff changeset
471 '"$initialize_author"'
36e7f4e402bd Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents: 636
diff changeset
472 }
36e7f4e402bd Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents: 636
diff changeset
473 {
36e7f4e402bd Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents: 636
diff changeset
474 if (author[$1]) {
36e7f4e402bd Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents: 636
diff changeset
475 fullname = $5
4504
65ef94a9e2c4 (awkscript): Some sites put comma-separated junk after the fullname.
Paul Eggert <eggert@twinsun.com>
parents: 3248
diff changeset
476 if (fullname ~ /[0-9]+-[^(]*\([0-9]+\)$/) {
65ef94a9e2c4 (awkscript): Some sites put comma-separated junk after the fullname.
Paul Eggert <eggert@twinsun.com>
parents: 3248
diff changeset
477 # Remove the junk from fullnames like "0000-Admin(0000)".
65ef94a9e2c4 (awkscript): Some sites put comma-separated junk after the fullname.
Paul Eggert <eggert@twinsun.com>
parents: 3248
diff changeset
478 fullname = substr(fullname, index(fullname, "-") + 1)
65ef94a9e2c4 (awkscript): Some sites put comma-separated junk after the fullname.
Paul Eggert <eggert@twinsun.com>
parents: 3248
diff changeset
479 fullname = substr(fullname, 1, index(fullname, "(") - 1)
65ef94a9e2c4 (awkscript): Some sites put comma-separated junk after the fullname.
Paul Eggert <eggert@twinsun.com>
parents: 3248
diff changeset
480 }
65ef94a9e2c4 (awkscript): Some sites put comma-separated junk after the fullname.
Paul Eggert <eggert@twinsun.com>
parents: 3248
diff changeset
481 if (fullname ~ /,[^ ]/) {
65ef94a9e2c4 (awkscript): Some sites put comma-separated junk after the fullname.
Paul Eggert <eggert@twinsun.com>
parents: 3248
diff changeset
482 # Some sites put comma-separated junk after the fullname.
65ef94a9e2c4 (awkscript): Some sites put comma-separated junk after the fullname.
Paul Eggert <eggert@twinsun.com>
parents: 3248
diff changeset
483 # Remove it, but leave "Bill Gates, Jr" alone.
65ef94a9e2c4 (awkscript): Some sites put comma-separated junk after the fullname.
Paul Eggert <eggert@twinsun.com>
parents: 3248
diff changeset
484 fullname = substr(fullname, 1, index(fullname, ",") - 1)
65ef94a9e2c4 (awkscript): Some sites put comma-separated junk after the fullname.
Paul Eggert <eggert@twinsun.com>
parents: 3248
diff changeset
485 }
640
36e7f4e402bd Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents: 636
diff changeset
486 abbr = index(fullname, "&")
36e7f4e402bd Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents: 636
diff changeset
487 if (abbr) {
36e7f4e402bd Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents: 636
diff changeset
488 a = substr($1, 1, 1)
36e7f4e402bd Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents: 636
diff changeset
489 A = a
36e7f4e402bd Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents: 636
diff changeset
490 i = index(alphabet, a)
36e7f4e402bd Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents: 636
diff changeset
491 if (i) A = substr(ALPHABET, i, 1)
36e7f4e402bd Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents: 636
diff changeset
492 fullname = substr(fullname, 1, abbr-1) A substr($1, 2) substr(fullname, abbr+1)
36e7f4e402bd Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents: 636
diff changeset
493 }
11073
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
494
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
495 # Quote quotes and backslashes properly in full names.
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
496 # Do not use gsub; traditional awk lacks it.
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
497 quoted = ""
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
498 rest = fullname
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
499 for (;;) {
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
500 p = index(rest, "\\")
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
501 q = index(rest, "\"")
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
502 if (p) {
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
503 if (q && q<p) p = q
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
504 } else {
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
505 if (!q) break
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
506 p = q
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
507 }
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
508 quoted = quoted substr(rest, 1, p-1) "\\" substr(rest, p, 1)
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
509 rest = substr(rest, p+1)
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
510 }
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
511
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
512 printf "fullname[\"%s\"] = \"%s%s\"\n", $1, quoted, rest
640
36e7f4e402bd Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents: 636
diff changeset
513 author[$1] = 0
36e7f4e402bd Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents: 636
diff changeset
514 }
36e7f4e402bd Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents: 636
diff changeset
515 }
36e7f4e402bd Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents: 636
diff changeset
516 '
36e7f4e402bd Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents: 636
diff changeset
517
36e7f4e402bd Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents: 636
diff changeset
518 initialize_fullname=`
22999
5ec968f5560c (initialize_fullname): Prefer getent if available.
Paul Eggert <eggert@twinsun.com>
parents: 18452
diff changeset
519 {
5ec968f5560c (initialize_fullname): Prefer getent if available.
Paul Eggert <eggert@twinsun.com>
parents: 18452
diff changeset
520 (getent passwd $authors) ||
5ec968f5560c (initialize_fullname): Prefer getent if available.
Paul Eggert <eggert@twinsun.com>
parents: 18452
diff changeset
521 (
5ec968f5560c (initialize_fullname): Prefer getent if available.
Paul Eggert <eggert@twinsun.com>
parents: 18452
diff changeset
522 cat /etc/passwd
5ec968f5560c (initialize_fullname): Prefer getent if available.
Paul Eggert <eggert@twinsun.com>
parents: 18452
diff changeset
523 for author in $authors
5ec968f5560c (initialize_fullname): Prefer getent if available.
Paul Eggert <eggert@twinsun.com>
parents: 18452
diff changeset
524 do NIS_PATH= nismatch $author passwd.org_dir
5ec968f5560c (initialize_fullname): Prefer getent if available.
Paul Eggert <eggert@twinsun.com>
parents: 18452
diff changeset
525 done
5ec968f5560c (initialize_fullname): Prefer getent if available.
Paul Eggert <eggert@twinsun.com>
parents: 18452
diff changeset
526 ypmatch $authors passwd
5ec968f5560c (initialize_fullname): Prefer getent if available.
Paul Eggert <eggert@twinsun.com>
parents: 18452
diff changeset
527 )
5ec968f5560c (initialize_fullname): Prefer getent if available.
Paul Eggert <eggert@twinsun.com>
parents: 18452
diff changeset
528 } 2>/dev/null |
11073
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
529 $AWK -F: "$awkscript"
39150
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
530 `$initialize_fullname;;
640
36e7f4e402bd Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents: 636
diff changeset
531 esac
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
532
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
533
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
534 # Function to print a single log line.
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
535 # We don't use awk functions, to stay compatible with old awk versions.
39150
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
536 # `Log' is the log message.
594
efa0c124c178 Add clumpname support.
Paul Eggert <eggert@twinsun.com>
parents: 535
diff changeset
537 # `files' contains the affected files.
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
538 printlogline='{
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
539
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
540 # Following the GNU coding standards, rewrite
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
541 # * file: (function): comment
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
542 # to
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
543 # * file (function): comment
41649
41d73d9565de (Copyright): Add '(C)' as per coding guidelines.
Paul Eggert <eggert@twinsun.com>
parents: 39150
diff changeset
544 if (Log ~ /^\([^)]*\):[\t\n ]/) {
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
545 i = index(Log, ")")
39150
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
546 filefunc = substr(Log, 1, i)
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
547 while ((j = index(filefunc, "\n"))) {
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
548 files = files " " substr(filefunc, 1, j-1)
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
549 filefunc = substr(filefunc, j+1)
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
550 }
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
551 files = files " " filefunc
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
552 Log = substr(Log, i+3)
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
553 }
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
554
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
555 # If "label: comment" is too long, break the line after the ":".
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
556 sep = " "
39150
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
557 i = index(Log, "\n")
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
558 if ('"$length"' <= '"$indent"' + 1 + length(files) + i) sep = "\n" indent_string
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
559
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
560 # Print the label.
534
6f7abc0e1f10 Add -i, -l, -t.
Paul Eggert <eggert@twinsun.com>
parents: 527
diff changeset
561 printf "%s*%s:", indent_string, files
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
562
39150
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
563 # Print each line of the log.
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
564 while (i) {
4858
5b4f9564bfaf (printlogline): Don't generate lines containing only white space.
Paul Eggert <eggert@twinsun.com>
parents: 4783
diff changeset
565 logline = substr(Log, 1, i-1)
11073
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
566 if (logline ~ /[^'"$tab"' ]/) {
4858
5b4f9564bfaf (printlogline): Don't generate lines containing only white space.
Paul Eggert <eggert@twinsun.com>
parents: 4783
diff changeset
567 printf "%s%s\n", sep, logline
5b4f9564bfaf (printlogline): Don't generate lines containing only white space.
Paul Eggert <eggert@twinsun.com>
parents: 4783
diff changeset
568 } else {
5b4f9564bfaf (printlogline): Don't generate lines containing only white space.
Paul Eggert <eggert@twinsun.com>
parents: 4783
diff changeset
569 print ""
5b4f9564bfaf (printlogline): Don't generate lines containing only white space.
Paul Eggert <eggert@twinsun.com>
parents: 4783
diff changeset
570 }
534
6f7abc0e1f10 Add -i, -l, -t.
Paul Eggert <eggert@twinsun.com>
parents: 527
diff changeset
571 sep = indent_string
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
572 Log = substr(Log, i+1)
39150
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
573 i = index(Log, "\n")
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
574 }
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
575 }'
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
576
15911
c9a152ad9c5a Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents: 15742
diff changeset
577 # Pattern to match the `revision' line of rlog output.
c9a152ad9c5a Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents: 15742
diff changeset
578 rlog_revision_pattern='^revision [0-9]+\.[0-9]+(\.[0-9]+\.[0-9]+)*(['"$tab"' ]+locked by: [^'"$tab"' $,.0-9:;@]*[^'"$tab"' $,:;@][^'"$tab"' $,.0-9:;@]*;)?['"$tab"' ]*$'
c9a152ad9c5a Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents: 15742
diff changeset
579
4783
7c75802f5a8b Add -h, -n, -r options.
Paul Eggert <eggert@twinsun.com>
parents: 4654
diff changeset
580 case $hostname in
7c75802f5a8b Add -h, -n, -r options.
Paul Eggert <eggert@twinsun.com>
parents: 4654
diff changeset
581 '')
7c75802f5a8b Add -h, -n, -r options.
Paul Eggert <eggert@twinsun.com>
parents: 4654
diff changeset
582 hostname=`(
7c75802f5a8b Add -h, -n, -r options.
Paul Eggert <eggert@twinsun.com>
parents: 4654
diff changeset
583 hostname || uname -n || uuname -l || cat /etc/whoami
7c75802f5a8b Add -h, -n, -r options.
Paul Eggert <eggert@twinsun.com>
parents: 4654
diff changeset
584 ) 2>/dev/null` || {
7c75802f5a8b Add -h, -n, -r options.
Paul Eggert <eggert@twinsun.com>
parents: 4654
diff changeset
585 echo >&2 "$0: cannot deduce hostname"
7c75802f5a8b Add -h, -n, -r options.
Paul Eggert <eggert@twinsun.com>
parents: 4654
diff changeset
586 exit 1
7c75802f5a8b Add -h, -n, -r options.
Paul Eggert <eggert@twinsun.com>
parents: 4654
diff changeset
587 }
14173
940083ef25b9 (initialize_fullname): Add support for NIS+.
Paul Eggert <eggert@twinsun.com>
parents: 12509
diff changeset
588
940083ef25b9 (initialize_fullname): Add support for NIS+.
Paul Eggert <eggert@twinsun.com>
parents: 12509
diff changeset
589 case $hostname in
940083ef25b9 (initialize_fullname): Add support for NIS+.
Paul Eggert <eggert@twinsun.com>
parents: 12509
diff changeset
590 *.*) ;;
940083ef25b9 (initialize_fullname): Add support for NIS+.
Paul Eggert <eggert@twinsun.com>
parents: 12509
diff changeset
591 *)
940083ef25b9 (initialize_fullname): Add support for NIS+.
Paul Eggert <eggert@twinsun.com>
parents: 12509
diff changeset
592 domainname=`(domainname) 2>/dev/null` &&
940083ef25b9 (initialize_fullname): Add support for NIS+.
Paul Eggert <eggert@twinsun.com>
parents: 12509
diff changeset
593 case $domainname in
39150
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
594 *.*) hostname=$hostname.$domainname;;
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
595 esac;;
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
596 esac;;
4783
7c75802f5a8b Add -h, -n, -r options.
Paul Eggert <eggert@twinsun.com>
parents: 4654
diff changeset
597 esac
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
598
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
599
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
600 # Process the rlog output, generating ChangeLog style entries.
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
601
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
602 # First, reformat the rlog output so that each line contains one log entry.
39150
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
603 # Transliterate \n to SOH so that multiline entries fit on a single line.
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
604 # Discard irrelevant rlog output.
39150
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
605 $AWK '
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
606 BEGIN {
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
607 pository = "'"$pository"'"
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
608 SOH="'"$SOH"'"
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
609 }
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
610 /^RCS file: / {
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
611 if (pository != "") {
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
612 filename = substr($0, 11)
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
613 if (substr(filename, 1, length(pository)) == pository) {
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
614 filename = substr(filename, length(pository) + 1)
11073
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
615 }
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
616 if (filename ~ /,v$/) {
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
617 filename = substr(filename, 1, length(filename) - 2)
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
618 }
16507
08855b88e955 When processing cvs log output, remove `Attic/' from repository file names.
Paul Eggert <eggert@twinsun.com>
parents: 16438
diff changeset
619 if (filename ~ /(^|\/)Attic\/[^\/]*$/) {
08855b88e955 When processing cvs log output, remove `Attic/' from repository file names.
Paul Eggert <eggert@twinsun.com>
parents: 16438
diff changeset
620 i = length(filename)
08855b88e955 When processing cvs log output, remove `Attic/' from repository file names.
Paul Eggert <eggert@twinsun.com>
parents: 16438
diff changeset
621 while (substr(filename, i, 1) != "/") i--
08855b88e955 When processing cvs log output, remove `Attic/' from repository file names.
Paul Eggert <eggert@twinsun.com>
parents: 16438
diff changeset
622 filename = substr(filename, 1, i - 6) substr(filename, i + 1)
08855b88e955 When processing cvs log output, remove `Attic/' from repository file names.
Paul Eggert <eggert@twinsun.com>
parents: 16438
diff changeset
623 }
11073
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
624 }
15911
c9a152ad9c5a Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents: 15742
diff changeset
625 rev = "?"
11073
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
626 }
39150
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
627 /^Working file: / { if (repository == "") filename = substr($0, 15) }
15911
c9a152ad9c5a Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents: 15742
diff changeset
628 /'"$rlog_revision_pattern"'/, /^(-----------*|===========*)$/ {
18452
44e598b69b42 Don't assign to $0 in awk; some awks don't allow this.
Paul Eggert <eggert@twinsun.com>
parents: 17791
diff changeset
629 line = $0
44e598b69b42 Don't assign to $0 in awk; some awks don't allow this.
Paul Eggert <eggert@twinsun.com>
parents: 17791
diff changeset
630 if (line ~ /'"$rlog_revision_pattern"'/) {
15911
c9a152ad9c5a Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents: 15742
diff changeset
631 rev = $2
c9a152ad9c5a Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents: 15742
diff changeset
632 next
c9a152ad9c5a Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents: 15742
diff changeset
633 }
18452
44e598b69b42 Don't assign to $0 in awk; some awks don't allow this.
Paul Eggert <eggert@twinsun.com>
parents: 17791
diff changeset
634 if (line ~ /^date: [0-9][- +\/0-9:]*;/) {
8549
12b36ece5c25 Add support for CVS.
Paul Eggert <eggert@twinsun.com>
parents: 8496
diff changeset
635 date = $2
15911
c9a152ad9c5a Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents: 15742
diff changeset
636 if (date ~ /\//) {
c9a152ad9c5a Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents: 15742
diff changeset
637 # This is a traditional RCS format date YYYY/MM/DD.
c9a152ad9c5a Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents: 15742
diff changeset
638 # Replace "/"s with "-"s to get ISO format.
8549
12b36ece5c25 Add support for CVS.
Paul Eggert <eggert@twinsun.com>
parents: 8496
diff changeset
639 newdate = ""
15911
c9a152ad9c5a Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents: 15742
diff changeset
640 while ((i = index(date, "/")) != 0) {
c9a152ad9c5a Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents: 15742
diff changeset
641 newdate = newdate substr(date, 1, i-1) "-"
8549
12b36ece5c25 Add support for CVS.
Paul Eggert <eggert@twinsun.com>
parents: 8496
diff changeset
642 date = substr(date, i+1)
12b36ece5c25 Add support for CVS.
Paul Eggert <eggert@twinsun.com>
parents: 8496
diff changeset
643 }
12b36ece5c25 Add support for CVS.
Paul Eggert <eggert@twinsun.com>
parents: 8496
diff changeset
644 date = newdate date
12b36ece5c25 Add support for CVS.
Paul Eggert <eggert@twinsun.com>
parents: 8496
diff changeset
645 }
15911
c9a152ad9c5a Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents: 15742
diff changeset
646 time = substr($3, 1, length($3) - 1)
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
647 author = substr($5, 1, length($5)-1)
39150
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
648 printf "%s%s%s%s%s%s%s%s%s%s", filename, SOH, rev, SOH, date, SOH, time, SOH, author, SOH
15911
c9a152ad9c5a Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents: 15742
diff changeset
649 rev = "?"
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
650 next
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
651 }
18452
44e598b69b42 Don't assign to $0 in awk; some awks don't allow this.
Paul Eggert <eggert@twinsun.com>
parents: 17791
diff changeset
652 if (line ~ /^branches: /) { next }
44e598b69b42 Don't assign to $0 in awk; some awks don't allow this.
Paul Eggert <eggert@twinsun.com>
parents: 17791
diff changeset
653 if (line ~ /^(-----------*|===========*)$/) { print ""; next }
44e598b69b42 Don't assign to $0 in awk; some awks don't allow this.
Paul Eggert <eggert@twinsun.com>
parents: 17791
diff changeset
654 if (line == "Initial revision" || line ~ /^file .+ was initially added on branch .+\.$/) {
44e598b69b42 Don't assign to $0 in awk; some awks don't allow this.
Paul Eggert <eggert@twinsun.com>
parents: 17791
diff changeset
655 line = "New file."
44e598b69b42 Don't assign to $0 in awk; some awks don't allow this.
Paul Eggert <eggert@twinsun.com>
parents: 17791
diff changeset
656 }
39150
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
657 printf "%s%s", line, SOH
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
658 }
39150
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
659 ' <"$rlogfile" |
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
660
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
661 # Now each line is of the form
39150
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
662 # FILENAME@REVISION@YYYY-MM-DD@HH:MM:SS[+-TIMEZONE]@AUTHOR@LOG
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
663 # where @ stands for an SOH (octal code 001),
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
664 # and each line of LOG is terminated by SOH instead of \n.
640
36e7f4e402bd Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents: 636
diff changeset
665 # Sort the log entries, first by date+time (in reverse order),
15911
c9a152ad9c5a Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents: 15742
diff changeset
666 # then by author, then by log entry, and finally by file name and revision
c9a152ad9c5a Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents: 15742
diff changeset
667 # (just in case).
43097
c421297164e2 (Copyright): Update to 2002.
Paul Eggert <eggert@twinsun.com>
parents: 41649
diff changeset
668 sort -t"$SOH" $SORT_K_OPTIONS |
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
669
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
670 # Finally, reformat the sorted log entries.
39150
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
671 $AWK -F"$SOH" '
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
672 BEGIN {
15911
c9a152ad9c5a Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents: 15742
diff changeset
673 logTZ = "'"$logTZ"'"
c9a152ad9c5a Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents: 15742
diff changeset
674 revision = "'"$revision"'"
c9a152ad9c5a Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents: 15742
diff changeset
675
4783
7c75802f5a8b Add -h, -n, -r options.
Paul Eggert <eggert@twinsun.com>
parents: 4654
diff changeset
676 # Initialize the fullname and mailaddr associative arrays.
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
677 '"$initialize_fullname"'
4783
7c75802f5a8b Add -h, -n, -r options.
Paul Eggert <eggert@twinsun.com>
parents: 4654
diff changeset
678 '"$initialize_mailaddr"'
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
679
534
6f7abc0e1f10 Add -i, -l, -t.
Paul Eggert <eggert@twinsun.com>
parents: 527
diff changeset
680 # Initialize indent string.
6f7abc0e1f10 Add -i, -l, -t.
Paul Eggert <eggert@twinsun.com>
parents: 527
diff changeset
681 indent_string = ""
6f7abc0e1f10 Add -i, -l, -t.
Paul Eggert <eggert@twinsun.com>
parents: 527
diff changeset
682 i = '"$indent"'
6f7abc0e1f10 Add -i, -l, -t.
Paul Eggert <eggert@twinsun.com>
parents: 527
diff changeset
683 if (0 < '"$tabwidth"')
6f7abc0e1f10 Add -i, -l, -t.
Paul Eggert <eggert@twinsun.com>
parents: 527
diff changeset
684 for (; '"$tabwidth"' <= i; i -= '"$tabwidth"')
6f7abc0e1f10 Add -i, -l, -t.
Paul Eggert <eggert@twinsun.com>
parents: 527
diff changeset
685 indent_string = indent_string "\t"
6f7abc0e1f10 Add -i, -l, -t.
Paul Eggert <eggert@twinsun.com>
parents: 527
diff changeset
686 while (1 <= i--)
6f7abc0e1f10 Add -i, -l, -t.
Paul Eggert <eggert@twinsun.com>
parents: 527
diff changeset
687 indent_string = indent_string " "
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
688 }
636
dce8cdbac0ea Ignore log messages that start with `#'.
Paul Eggert <eggert@twinsun.com>
parents: 602
diff changeset
689
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
690 {
39150
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
691 newlog = ""
a56fcade3c7e (Help, mainline code): Add new option -L FILE.
Paul Eggert <eggert@twinsun.com>
parents: 38496
diff changeset
692 for (i = 6; i < NF; i++) newlog = newlog $i "\n"
636
dce8cdbac0ea Ignore log messages that start with `#'.
Paul Eggert <eggert@twinsun.com>
parents: 602
diff changeset
693
dce8cdbac0ea Ignore log messages that start with `#'.
Paul Eggert <eggert@twinsun.com>
parents: 602
diff changeset
694 # Ignore log entries prefixed by "#".
dce8cdbac0ea Ignore log messages that start with `#'.
Paul Eggert <eggert@twinsun.com>
parents: 602
diff changeset
695 if (newlog ~ /^#/) { next }
dce8cdbac0ea Ignore log messages that start with `#'.
Paul Eggert <eggert@twinsun.com>
parents: 602
diff changeset
696
15911
c9a152ad9c5a Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents: 15742
diff changeset
697 if (Log != newlog || date != $3 || author != $5) {
594
efa0c124c178 Add clumpname support.
Paul Eggert <eggert@twinsun.com>
parents: 535
diff changeset
698
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
699 # The previous log and this log differ.
594
efa0c124c178 Add clumpname support.
Paul Eggert <eggert@twinsun.com>
parents: 535
diff changeset
700
efa0c124c178 Add clumpname support.
Paul Eggert <eggert@twinsun.com>
parents: 535
diff changeset
701 # Print the old log.
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
702 if (date != "") '"$printlogline"'
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
703
594
efa0c124c178 Add clumpname support.
Paul Eggert <eggert@twinsun.com>
parents: 535
diff changeset
704 # Logs that begin with "{clumpname} " should be grouped together,
efa0c124c178 Add clumpname support.
Paul Eggert <eggert@twinsun.com>
parents: 535
diff changeset
705 # and the clumpname should be removed.
efa0c124c178 Add clumpname support.
Paul Eggert <eggert@twinsun.com>
parents: 535
diff changeset
706 # Extract the new clumpname from the log header,
efa0c124c178 Add clumpname support.
Paul Eggert <eggert@twinsun.com>
parents: 535
diff changeset
707 # and use it to decide whether to output a blank line.
efa0c124c178 Add clumpname support.
Paul Eggert <eggert@twinsun.com>
parents: 535
diff changeset
708 newclumpname = ""
efa0c124c178 Add clumpname support.
Paul Eggert <eggert@twinsun.com>
parents: 535
diff changeset
709 sep = "\n"
602
d2de231ee7f5 Don't duplicate most recent logs. Fix bug in dates after Feb 29 in leap year.
Paul Eggert <eggert@twinsun.com>
parents: 594
diff changeset
710 if (date == "") sep = ""
11073
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
711 if (newlog ~ /^\{[^'"$tab"' }]*}['"$tab"' ]/) {
594
efa0c124c178 Add clumpname support.
Paul Eggert <eggert@twinsun.com>
parents: 535
diff changeset
712 i = index(newlog, "}")
efa0c124c178 Add clumpname support.
Paul Eggert <eggert@twinsun.com>
parents: 535
diff changeset
713 newclumpname = substr(newlog, 1, i)
11073
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
714 while (substr(newlog, i+1) ~ /^['"$tab"' ]/) i++
594
efa0c124c178 Add clumpname support.
Paul Eggert <eggert@twinsun.com>
parents: 535
diff changeset
715 newlog = substr(newlog, i+1)
41649
41d73d9565de (Copyright): Add '(C)' as per coding guidelines.
Paul Eggert <eggert@twinsun.com>
parents: 39150
diff changeset
716 if (clumpname == newclumpname && date == $3 && author == $5) sep = ""
594
efa0c124c178 Add clumpname support.
Paul Eggert <eggert@twinsun.com>
parents: 535
diff changeset
717 }
efa0c124c178 Add clumpname support.
Paul Eggert <eggert@twinsun.com>
parents: 535
diff changeset
718 printf sep
efa0c124c178 Add clumpname support.
Paul Eggert <eggert@twinsun.com>
parents: 535
diff changeset
719 clumpname = newclumpname
efa0c124c178 Add clumpname support.
Paul Eggert <eggert@twinsun.com>
parents: 535
diff changeset
720
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
721 # Get ready for the next log.
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
722 Log = newlog
534
6f7abc0e1f10 Add -i, -l, -t.
Paul Eggert <eggert@twinsun.com>
parents: 527
diff changeset
723 if (files != "")
6f7abc0e1f10 Add -i, -l, -t.
Paul Eggert <eggert@twinsun.com>
parents: 527
diff changeset
724 for (i in filesknown)
6f7abc0e1f10 Add -i, -l, -t.
Paul Eggert <eggert@twinsun.com>
parents: 527
diff changeset
725 filesknown[i] = 0
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
726 files = ""
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
727 }
15911
c9a152ad9c5a Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents: 15742
diff changeset
728 if (date != $3 || author != $5) {
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
729 # The previous date+author and this date+author differ.
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
730 # Print the new one.
15911
c9a152ad9c5a Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents: 15742
diff changeset
731 date = $3
c9a152ad9c5a Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents: 15742
diff changeset
732 time = $4
c9a152ad9c5a Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents: 15742
diff changeset
733 author = $5
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
734
15911
c9a152ad9c5a Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents: 15742
diff changeset
735 zone = ""
c9a152ad9c5a Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents: 15742
diff changeset
736 if (logTZ && ((i = index(time, "-")) || (i = index(time, "+"))))
c9a152ad9c5a Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents: 15742
diff changeset
737 zone = " " substr(time, i)
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
738
15911
c9a152ad9c5a Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents: 15742
diff changeset
739 # Print "date[ timezone] fullname <email address>".
4783
7c75802f5a8b Add -h, -n, -r options.
Paul Eggert <eggert@twinsun.com>
parents: 4654
diff changeset
740 # Get fullname and email address from associative arrays;
7c75802f5a8b Add -h, -n, -r options.
Paul Eggert <eggert@twinsun.com>
parents: 4654
diff changeset
741 # default to author and author@hostname if not in arrays.
534
6f7abc0e1f10 Add -i, -l, -t.
Paul Eggert <eggert@twinsun.com>
parents: 527
diff changeset
742 if (fullname[author])
4783
7c75802f5a8b Add -h, -n, -r options.
Paul Eggert <eggert@twinsun.com>
parents: 4654
diff changeset
743 auth = fullname[author]
534
6f7abc0e1f10 Add -i, -l, -t.
Paul Eggert <eggert@twinsun.com>
parents: 527
diff changeset
744 else
4783
7c75802f5a8b Add -h, -n, -r options.
Paul Eggert <eggert@twinsun.com>
parents: 4654
diff changeset
745 auth = author
15911
c9a152ad9c5a Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents: 15742
diff changeset
746 printf "%s%s %s ", date, zone, auth
4783
7c75802f5a8b Add -h, -n, -r options.
Paul Eggert <eggert@twinsun.com>
parents: 4654
diff changeset
747 if (mailaddr[author])
8496
2dba6eb73c65 Use <> to delimit email address.
Richard M. Stallman <rms@gnu.org>
parents: 4858
diff changeset
748 printf "<%s>\n\n", mailaddr[author]
4783
7c75802f5a8b Add -h, -n, -r options.
Paul Eggert <eggert@twinsun.com>
parents: 4654
diff changeset
749 else
8496
2dba6eb73c65 Use <> to delimit email address.
Richard M. Stallman <rms@gnu.org>
parents: 4858
diff changeset
750 printf "<%s@%s>\n\n", author, "'"$hostname"'"
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
751 }
534
6f7abc0e1f10 Add -i, -l, -t.
Paul Eggert <eggert@twinsun.com>
parents: 527
diff changeset
752 if (! filesknown[$1]) {
6f7abc0e1f10 Add -i, -l, -t.
Paul Eggert <eggert@twinsun.com>
parents: 527
diff changeset
753 filesknown[$1] = 1
594
efa0c124c178 Add clumpname support.
Paul Eggert <eggert@twinsun.com>
parents: 535
diff changeset
754 if (files == "") files = " " $1
efa0c124c178 Add clumpname support.
Paul Eggert <eggert@twinsun.com>
parents: 535
diff changeset
755 else files = files ", " $1
15911
c9a152ad9c5a Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents: 15742
diff changeset
756 if (revision && $2 != "?") files = files " " $2
534
6f7abc0e1f10 Add -i, -l, -t.
Paul Eggert <eggert@twinsun.com>
parents: 527
diff changeset
757 }
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
758 }
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
759 END {
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
760 # Print the last log.
594
efa0c124c178 Add clumpname support.
Paul Eggert <eggert@twinsun.com>
parents: 535
diff changeset
761 if (date != "") {
efa0c124c178 Add clumpname support.
Paul Eggert <eggert@twinsun.com>
parents: 535
diff changeset
762 '"$printlogline"'
efa0c124c178 Add clumpname support.
Paul Eggert <eggert@twinsun.com>
parents: 535
diff changeset
763 printf "\n"
efa0c124c178 Add clumpname support.
Paul Eggert <eggert@twinsun.com>
parents: 535
diff changeset
764 }
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
765 }
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
766 ' &&
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
767
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
768
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
769 # Exit successfully.
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
770
35016
731a7aca9458 Avoid security hole allowing attacker to
Gerd Moellmann <gerd@gnu.org>
parents: 23008
diff changeset
771 exec rm -fr $logdir
15911
c9a152ad9c5a Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents: 15742
diff changeset
772
c9a152ad9c5a Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents: 15742
diff changeset
773 # Local Variables:
c9a152ad9c5a Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents: 15742
diff changeset
774 # tab-width:4
c9a152ad9c5a Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents: 15742
diff changeset
775 # End:
52401
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 43097
diff changeset
776
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 43097
diff changeset
777 # arch-tag: cea067bd-a552-4254-ba17-078208933073