Mercurial > emacs
annotate lib-src/rcs2log @ 38201:303d358eaac7
Change Previous pointer.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Tue, 26 Jun 2001 13:19:08 +0000 |
parents | 731a7aca9458 |
children | bc943a2bd926 |
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 | 2 |
3 # RCS to ChangeLog generator | |
4 | |
16899
04ad9edd12b3
--help, --version: New options, for conformance to GNU coding standards.
Paul Eggert <eggert@twinsun.com>
parents:
16507
diff
changeset
|
5 # Generate a change log prefix from RCS files (perhaps in the CVS repository) |
04ad9edd12b3
--help, --version: New options, for conformance to GNU coding standards.
Paul Eggert <eggert@twinsun.com>
parents:
16507
diff
changeset
|
6 # and the ChangeLog (if any). |
527 | 7 # Output the new prefix to standard output. |
8 # You can edit this prefix by hand, and then prepend it to ChangeLog. | |
9 | |
636
dce8cdbac0ea
Ignore log messages that start with `#'.
Paul Eggert <eggert@twinsun.com>
parents:
602
diff
changeset
|
10 # Ignore log entries that start with `#'. |
dce8cdbac0ea
Ignore log messages that start with `#'.
Paul Eggert <eggert@twinsun.com>
parents:
602
diff
changeset
|
11 # Clump together log entries that start with `{topic} ', |
dce8cdbac0ea
Ignore log messages that start with `#'.
Paul Eggert <eggert@twinsun.com>
parents:
602
diff
changeset
|
12 # where `topic' contains neither white space nor `}'. |
527 | 13 |
16899
04ad9edd12b3
--help, --version: New options, for conformance to GNU coding standards.
Paul Eggert <eggert@twinsun.com>
parents:
16507
diff
changeset
|
14 Help='The default FILEs are the files registered under the working directory. |
04ad9edd12b3
--help, --version: New options, for conformance to GNU coding standards.
Paul Eggert <eggert@twinsun.com>
parents:
16507
diff
changeset
|
15 Options: |
1800
05cb79ebdb23
Add copyright and authorship notices.
Paul Eggert <eggert@twinsun.com>
parents:
1228
diff
changeset
|
16 |
16899
04ad9edd12b3
--help, --version: New options, for conformance to GNU coding standards.
Paul Eggert <eggert@twinsun.com>
parents:
16507
diff
changeset
|
17 -c CHANGELOG Output a change log prefix to CHANGELOG (default ChangeLog). |
04ad9edd12b3
--help, --version: New options, for conformance to GNU coding standards.
Paul Eggert <eggert@twinsun.com>
parents:
16507
diff
changeset
|
18 -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
|
19 -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
|
20 -l LENGTH Try to limit log lines to LENGTH characters (default 79). |
04ad9edd12b3
--help, --version: New options, for conformance to GNU coding standards.
Paul Eggert <eggert@twinsun.com>
parents:
16507
diff
changeset
|
21 -R If no FILEs are given and RCS is used, recurse through working directory. |
04ad9edd12b3
--help, --version: New options, for conformance to GNU coding standards.
Paul Eggert <eggert@twinsun.com>
parents:
16507
diff
changeset
|
22 -r OPTION Pass OPTION to subsidiary log command. |
04ad9edd12b3
--help, --version: New options, for conformance to GNU coding standards.
Paul Eggert <eggert@twinsun.com>
parents:
16507
diff
changeset
|
23 -t TABWIDTH Tab stops are every TABWIDTH characters (default 8). |
04ad9edd12b3
--help, --version: New options, for conformance to GNU coding standards.
Paul Eggert <eggert@twinsun.com>
parents:
16507
diff
changeset
|
24 -u "LOGIN<tab>FULLNAME<tab>MAILADDR" Assume LOGIN has FULLNAME and MAILADDR. |
04ad9edd12b3
--help, --version: New options, for conformance to GNU coding standards.
Paul Eggert <eggert@twinsun.com>
parents:
16507
diff
changeset
|
25 -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
|
26 --help Output help. |
04ad9edd12b3
--help, --version: New options, for conformance to GNU coding standards.
Paul Eggert <eggert@twinsun.com>
parents:
16507
diff
changeset
|
27 --version Output version number. |
1800
05cb79ebdb23
Add copyright and authorship notices.
Paul Eggert <eggert@twinsun.com>
parents:
1228
diff
changeset
|
28 |
23008
26e379429f7f
Update bug report address and copyright.
Paul Eggert <eggert@twinsun.com>
parents:
23002
diff
changeset
|
29 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
|
30 |
35016
731a7aca9458
Avoid security hole allowing attacker to
Gerd Moellmann <gerd@gnu.org>
parents:
23008
diff
changeset
|
31 Id='$Id: rcs2log,v 1.46 2001/01/02 18:50:14 eggert Exp $' |
16899
04ad9edd12b3
--help, --version: New options, for conformance to GNU coding standards.
Paul Eggert <eggert@twinsun.com>
parents:
16507
diff
changeset
|
32 |
23002 | 33 # Copyright 1992, 93, 94, 95, 96, 97, 1998 Free Software Foundation, Inc. |
1800
05cb79ebdb23
Add copyright and authorship notices.
Paul Eggert <eggert@twinsun.com>
parents:
1228
diff
changeset
|
34 |
05cb79ebdb23
Add copyright and authorship notices.
Paul Eggert <eggert@twinsun.com>
parents:
1228
diff
changeset
|
35 # This program is free software; you can redistribute it and/or modify |
05cb79ebdb23
Add copyright and authorship notices.
Paul Eggert <eggert@twinsun.com>
parents:
1228
diff
changeset
|
36 # it under the terms of the GNU General Public License as published by |
05cb79ebdb23
Add copyright and authorship notices.
Paul Eggert <eggert@twinsun.com>
parents:
1228
diff
changeset
|
37 # the Free Software Foundation; either version 2, or (at your option) |
05cb79ebdb23
Add copyright and authorship notices.
Paul Eggert <eggert@twinsun.com>
parents:
1228
diff
changeset
|
38 # any later version. |
15911
c9a152ad9c5a
Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents:
15742
diff
changeset
|
39 # |
1800
05cb79ebdb23
Add copyright and authorship notices.
Paul Eggert <eggert@twinsun.com>
parents:
1228
diff
changeset
|
40 # This program is distributed in the hope that it will be useful, |
05cb79ebdb23
Add copyright and authorship notices.
Paul Eggert <eggert@twinsun.com>
parents:
1228
diff
changeset
|
41 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
05cb79ebdb23
Add copyright and authorship notices.
Paul Eggert <eggert@twinsun.com>
parents:
1228
diff
changeset
|
42 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
05cb79ebdb23
Add copyright and authorship notices.
Paul Eggert <eggert@twinsun.com>
parents:
1228
diff
changeset
|
43 # GNU General Public License for more details. |
15911
c9a152ad9c5a
Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents:
15742
diff
changeset
|
44 # |
1800
05cb79ebdb23
Add copyright and authorship notices.
Paul Eggert <eggert@twinsun.com>
parents:
1228
diff
changeset
|
45 # You should have received a copy of the GNU General Public License |
15937
ab395798ed22
Change `GNU Emacs' to `this program' in the comment referring the reader
Paul Eggert <eggert@twinsun.com>
parents:
15911
diff
changeset
|
46 # along with this program; see the file COPYING. If not, write to the |
15742 | 47 # Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
48 # Boston, MA 02111-1307, USA. | |
1800
05cb79ebdb23
Add copyright and authorship notices.
Paul Eggert <eggert@twinsun.com>
parents:
1228
diff
changeset
|
49 |
23008
26e379429f7f
Update bug report address and copyright.
Paul Eggert <eggert@twinsun.com>
parents:
23002
diff
changeset
|
50 Copyright='Copyright 1998 Free Software Foundation, Inc. |
16899
04ad9edd12b3
--help, --version: New options, for conformance to GNU coding standards.
Paul Eggert <eggert@twinsun.com>
parents:
16507
diff
changeset
|
51 This program comes with NO WARRANTY, to the extent permitted by law. |
04ad9edd12b3
--help, --version: New options, for conformance to GNU coding standards.
Paul Eggert <eggert@twinsun.com>
parents:
16507
diff
changeset
|
52 You may redistribute copies of this program |
04ad9edd12b3
--help, --version: New options, for conformance to GNU coding standards.
Paul Eggert <eggert@twinsun.com>
parents:
16507
diff
changeset
|
53 under the terms of the GNU General Public License. |
04ad9edd12b3
--help, --version: New options, for conformance to GNU coding standards.
Paul Eggert <eggert@twinsun.com>
parents:
16507
diff
changeset
|
54 For more information about these matters, see the files named COPYING. |
04ad9edd12b3
--help, --version: New options, for conformance to GNU coding standards.
Paul Eggert <eggert@twinsun.com>
parents:
16507
diff
changeset
|
55 Author: Paul Eggert <eggert@twinsun.com>' |
04ad9edd12b3
--help, --version: New options, for conformance to GNU coding standards.
Paul Eggert <eggert@twinsun.com>
parents:
16507
diff
changeset
|
56 |
11073
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents:
8549
diff
changeset
|
57 tab=' ' |
3248
9ee93fc9aba0
When given no file arguments, inspect RCS/.* as well
Richard M. Stallman <rms@gnu.org>
parents:
2639
diff
changeset
|
58 nl=' |
9ee93fc9aba0
When given no file arguments, inspect RCS/.* as well
Richard M. Stallman <rms@gnu.org>
parents:
2639
diff
changeset
|
59 ' |
1800
05cb79ebdb23
Add copyright and authorship notices.
Paul Eggert <eggert@twinsun.com>
parents:
1228
diff
changeset
|
60 |
534 | 61 # Parse options. |
62 | |
63 # defaults | |
11073
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents:
8549
diff
changeset
|
64 : ${AWK=awk} |
4783 | 65 : ${TMPDIR=/tmp} |
15911
c9a152ad9c5a
Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents:
15742
diff
changeset
|
66 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
|
67 datearg= # rlog date option |
4783 | 68 hostname= # name of local host (if empty, will deduce it later) |
534 | 69 indent=8 # indent of log line |
70 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
|
71 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
|
72 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
|
73 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
|
74 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
|
75 revision= # t if we want revision numbers |
4783 | 76 rlog_options= # options to pass to rlog |
534 | 77 tabwidth=8 # width of horizontal tab |
78 | |
79 while : | |
80 do | |
81 case $1 in | |
15911
c9a152ad9c5a
Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents:
15742
diff
changeset
|
82 -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
|
83 -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
|
84 -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
|
85 -l) length=${2?}; shift;; |
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents:
8549
diff
changeset
|
86 -[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
|
87 case $1 in |
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents:
8549
diff
changeset
|
88 -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
|
89 *"$tab"* | *"$nl"*) |
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents:
8549
diff
changeset
|
90 echo >&2 "$0: -n '$2' '$3' '$4': tabs, newlines not allowed" |
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents:
8549
diff
changeset
|
91 exit 1 |
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents:
8549
diff
changeset
|
92 esac |
17741
0c832661d9b4
(loginFullnameMailaddrs, logins, rlog_options, files): Don't prepend $nl
Paul Eggert <eggert@twinsun.com>
parents:
17740
diff
changeset
|
93 case $loginFullnameMailaddrs in |
0c832661d9b4
(loginFullnameMailaddrs, logins, rlog_options, files): Don't prepend $nl
Paul Eggert <eggert@twinsun.com>
parents:
17740
diff
changeset
|
94 '') loginFullnameMailaddrs=$2$tab$3$tab$4;; |
0c832661d9b4
(loginFullnameMailaddrs, logins, rlog_options, files): Don't prepend $nl
Paul Eggert <eggert@twinsun.com>
parents:
17740
diff
changeset
|
95 ?*) loginFullnameMailaddrs=$loginFullnameMailaddrs$nl$2$tab$3$tab$4 |
0c832661d9b4
(loginFullnameMailaddrs, logins, rlog_options, files): Don't prepend $nl
Paul Eggert <eggert@twinsun.com>
parents:
17740
diff
changeset
|
96 esac |
11073
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents:
8549
diff
changeset
|
97 shift; shift; shift;; |
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents:
8549
diff
changeset
|
98 -u) |
11082
aee85fcd9d25
Treat -u 'LOGIN:FULLNAME:MAILADDR' as if it were
Paul Eggert <eggert@twinsun.com>
parents:
11073
diff
changeset
|
99 # 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
|
100 case ${2?} in |
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents:
8549
diff
changeset
|
101 *"$nl"*) |
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents:
8549
diff
changeset
|
102 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
|
103 exit 1;; |
11082
aee85fcd9d25
Treat -u 'LOGIN:FULLNAME:MAILADDR' as if it were
Paul Eggert <eggert@twinsun.com>
parents:
11073
diff
changeset
|
104 *"$tab"*) |
aee85fcd9d25
Treat -u 'LOGIN:FULLNAME:MAILADDR' as if it were
Paul Eggert <eggert@twinsun.com>
parents:
11073
diff
changeset
|
105 t=$tab;; |
aee85fcd9d25
Treat -u 'LOGIN:FULLNAME:MAILADDR' as if it were
Paul Eggert <eggert@twinsun.com>
parents:
11073
diff
changeset
|
106 *) |
aee85fcd9d25
Treat -u 'LOGIN:FULLNAME:MAILADDR' as if it were
Paul Eggert <eggert@twinsun.com>
parents:
11073
diff
changeset
|
107 t=: |
aee85fcd9d25
Treat -u 'LOGIN:FULLNAME:MAILADDR' as if it were
Paul Eggert <eggert@twinsun.com>
parents:
11073
diff
changeset
|
108 esac |
aee85fcd9d25
Treat -u 'LOGIN:FULLNAME:MAILADDR' as if it were
Paul Eggert <eggert@twinsun.com>
parents:
11073
diff
changeset
|
109 case $2 in |
aee85fcd9d25
Treat -u 'LOGIN:FULLNAME:MAILADDR' as if it were
Paul Eggert <eggert@twinsun.com>
parents:
11073
diff
changeset
|
110 *"$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
|
111 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
|
112 exit 1;; |
11082
aee85fcd9d25
Treat -u 'LOGIN:FULLNAME:MAILADDR' as if it were
Paul Eggert <eggert@twinsun.com>
parents:
11073
diff
changeset
|
113 *"$t"*"$t"*) |
11073
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents:
8549
diff
changeset
|
114 ;; |
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents:
8549
diff
changeset
|
115 *) |
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents:
8549
diff
changeset
|
116 echo >&2 "$0: -u '$2': not enough fields" |
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents:
8549
diff
changeset
|
117 exit 1 |
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents:
8549
diff
changeset
|
118 esac |
17741
0c832661d9b4
(loginFullnameMailaddrs, logins, rlog_options, files): Don't prepend $nl
Paul Eggert <eggert@twinsun.com>
parents:
17740
diff
changeset
|
119 case $loginFullnameMailaddrs in |
0c832661d9b4
(loginFullnameMailaddrs, logins, rlog_options, files): Don't prepend $nl
Paul Eggert <eggert@twinsun.com>
parents:
17740
diff
changeset
|
120 '') loginFullnameMailaddrs=$2;; |
0c832661d9b4
(loginFullnameMailaddrs, logins, rlog_options, files): Don't prepend $nl
Paul Eggert <eggert@twinsun.com>
parents:
17740
diff
changeset
|
121 ?*) loginFullnameMailaddrs=$loginFullnameMailaddrs$nl$2 |
0c832661d9b4
(loginFullnameMailaddrs, logins, rlog_options, files): Don't prepend $nl
Paul Eggert <eggert@twinsun.com>
parents:
17740
diff
changeset
|
122 esac |
11073
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents:
8549
diff
changeset
|
123 shift |
4783 | 124 esac |
17741
0c832661d9b4
(loginFullnameMailaddrs, logins, rlog_options, files): Don't prepend $nl
Paul Eggert <eggert@twinsun.com>
parents:
17740
diff
changeset
|
125 case $logins in |
0c832661d9b4
(loginFullnameMailaddrs, logins, rlog_options, files): Don't prepend $nl
Paul Eggert <eggert@twinsun.com>
parents:
17740
diff
changeset
|
126 '') logins=$login;; |
0c832661d9b4
(loginFullnameMailaddrs, logins, rlog_options, files): Don't prepend $nl
Paul Eggert <eggert@twinsun.com>
parents:
17740
diff
changeset
|
127 ?*) logins=$logins$nl$login |
0c832661d9b4
(loginFullnameMailaddrs, logins, rlog_options, files): Don't prepend $nl
Paul Eggert <eggert@twinsun.com>
parents:
17740
diff
changeset
|
128 esac |
11073
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents:
8549
diff
changeset
|
129 ;; |
17741
0c832661d9b4
(loginFullnameMailaddrs, logins, rlog_options, files): Don't prepend $nl
Paul Eggert <eggert@twinsun.com>
parents:
17740
diff
changeset
|
130 -r) |
0c832661d9b4
(loginFullnameMailaddrs, logins, rlog_options, files): Don't prepend $nl
Paul Eggert <eggert@twinsun.com>
parents:
17740
diff
changeset
|
131 case $rlog_options in |
0c832661d9b4
(loginFullnameMailaddrs, logins, rlog_options, files): Don't prepend $nl
Paul Eggert <eggert@twinsun.com>
parents:
17740
diff
changeset
|
132 '') rlog_options=${2?};; |
0c832661d9b4
(loginFullnameMailaddrs, logins, rlog_options, files): Don't prepend $nl
Paul Eggert <eggert@twinsun.com>
parents:
17740
diff
changeset
|
133 ?*) rlog_options=$rlog_options$nl${2?} |
0c832661d9b4
(loginFullnameMailaddrs, logins, rlog_options, files): Don't prepend $nl
Paul Eggert <eggert@twinsun.com>
parents:
17740
diff
changeset
|
134 esac |
0c832661d9b4
(loginFullnameMailaddrs, logins, rlog_options, files): Don't prepend $nl
Paul Eggert <eggert@twinsun.com>
parents:
17740
diff
changeset
|
135 shift;; |
11073
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents:
8549
diff
changeset
|
136 -R) recursive=t;; |
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents:
8549
diff
changeset
|
137 -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
|
138 -v) revision=t;; |
16899
04ad9edd12b3
--help, --version: New options, for conformance to GNU coding standards.
Paul Eggert <eggert@twinsun.com>
parents:
16507
diff
changeset
|
139 --version) |
04ad9edd12b3
--help, --version: New options, for conformance to GNU coding standards.
Paul Eggert <eggert@twinsun.com>
parents:
16507
diff
changeset
|
140 set $Id |
04ad9edd12b3
--help, --version: New options, for conformance to GNU coding standards.
Paul Eggert <eggert@twinsun.com>
parents:
16507
diff
changeset
|
141 rcs2logVersion=$3 |
04ad9edd12b3
--help, --version: New options, for conformance to GNU coding standards.
Paul Eggert <eggert@twinsun.com>
parents:
16507
diff
changeset
|
142 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
|
143 exit 0;; |
04ad9edd12b3
--help, --version: New options, for conformance to GNU coding standards.
Paul Eggert <eggert@twinsun.com>
parents:
16507
diff
changeset
|
144 -*) 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
|
145 case $1 in |
04ad9edd12b3
--help, --version: New options, for conformance to GNU coding standards.
Paul Eggert <eggert@twinsun.com>
parents:
16507
diff
changeset
|
146 --help) exit 0;; |
04ad9edd12b3
--help, --version: New options, for conformance to GNU coding standards.
Paul Eggert <eggert@twinsun.com>
parents:
16507
diff
changeset
|
147 *) exit 1 |
04ad9edd12b3
--help, --version: New options, for conformance to GNU coding standards.
Paul Eggert <eggert@twinsun.com>
parents:
16507
diff
changeset
|
148 esac;; |
534 | 149 *) break |
150 esac | |
11073
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents:
8549
diff
changeset
|
151 shift |
534 | 152 done |
153 | |
2220
66371f0b8aff
Some awks don't understand "\r". Code around this.
Paul Eggert <eggert@twinsun.com>
parents:
1800
diff
changeset
|
154 month_data=' |
66371f0b8aff
Some awks don't understand "\r". Code around this.
Paul Eggert <eggert@twinsun.com>
parents:
1800
diff
changeset
|
155 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
|
156 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
|
157 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
|
158 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
|
159 ' |
66371f0b8aff
Some awks don't understand "\r". Code around this.
Paul Eggert <eggert@twinsun.com>
parents:
1800
diff
changeset
|
160 |
534 | 161 |
11627
2f0766bf8315
(datearg): If rlog options are specified explicitly,
Paul Eggert <eggert@twinsun.com>
parents:
11099
diff
changeset
|
162 # Put rlog output into $rlogout. |
527 | 163 |
11627
2f0766bf8315
(datearg): If rlog options are specified explicitly,
Paul Eggert <eggert@twinsun.com>
parents:
11099
diff
changeset
|
164 # If no rlog options are given, |
2f0766bf8315
(datearg): If rlog options are specified explicitly,
Paul Eggert <eggert@twinsun.com>
parents:
11099
diff
changeset
|
165 # log the revisions checked in since the first ChangeLog entry. |
15911
c9a152ad9c5a
Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents:
15742
diff
changeset
|
166 # Since ChangeLog is only by date, some of these revisions may be duplicates of |
c9a152ad9c5a
Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents:
15742
diff
changeset
|
167 # what's already in ChangeLog; it's the user's responsibility to remove them. |
11627
2f0766bf8315
(datearg): If rlog options are specified explicitly,
Paul Eggert <eggert@twinsun.com>
parents:
11099
diff
changeset
|
168 case $rlog_options in |
2f0766bf8315
(datearg): If rlog options are specified explicitly,
Paul Eggert <eggert@twinsun.com>
parents:
11099
diff
changeset
|
169 '') |
15911
c9a152ad9c5a
Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents:
15742
diff
changeset
|
170 if test -s "$changelog" |
11627
2f0766bf8315
(datearg): If rlog options are specified explicitly,
Paul Eggert <eggert@twinsun.com>
parents:
11099
diff
changeset
|
171 then |
2f0766bf8315
(datearg): If rlog options are specified explicitly,
Paul Eggert <eggert@twinsun.com>
parents:
11099
diff
changeset
|
172 e=' |
15911
c9a152ad9c5a
Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents:
15742
diff
changeset
|
173 /^[0-9]+-[0-9][0-9]-[0-9][0-9]/{ |
c9a152ad9c5a
Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents:
15742
diff
changeset
|
174 # ISO 8601 date |
c9a152ad9c5a
Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents:
15742
diff
changeset
|
175 print $1 |
c9a152ad9c5a
Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents:
15742
diff
changeset
|
176 exit |
c9a152ad9c5a
Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents:
15742
diff
changeset
|
177 } |
11627
2f0766bf8315
(datearg): If rlog options are specified explicitly,
Paul Eggert <eggert@twinsun.com>
parents:
11099
diff
changeset
|
178 /^... ... [ 0-9][0-9] [ 0-9][0-9]:[0-9][0-9]:[0-9][0-9] [0-9]+ /{ |
15911
c9a152ad9c5a
Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents:
15742
diff
changeset
|
179 # old-fashioned date and time (Emacs 19.31 and earlier) |
11627
2f0766bf8315
(datearg): If rlog options are specified explicitly,
Paul Eggert <eggert@twinsun.com>
parents:
11099
diff
changeset
|
180 '"$month_data"' |
2f0766bf8315
(datearg): If rlog options are specified explicitly,
Paul Eggert <eggert@twinsun.com>
parents:
11099
diff
changeset
|
181 year = $5 |
2f0766bf8315
(datearg): If rlog options are specified explicitly,
Paul Eggert <eggert@twinsun.com>
parents:
11099
diff
changeset
|
182 for (i=0; i<=11; i++) if (m[i] == $2) break |
2f0766bf8315
(datearg): If rlog options are specified explicitly,
Paul Eggert <eggert@twinsun.com>
parents:
11099
diff
changeset
|
183 dd = $3 |
15911
c9a152ad9c5a
Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents:
15742
diff
changeset
|
184 printf "%d-%02d-%02d\n", year, i+1, dd |
11627
2f0766bf8315
(datearg): If rlog options are specified explicitly,
Paul Eggert <eggert@twinsun.com>
parents:
11099
diff
changeset
|
185 exit |
2220
66371f0b8aff
Some awks don't understand "\r". Code around this.
Paul Eggert <eggert@twinsun.com>
parents:
1800
diff
changeset
|
186 } |
11627
2f0766bf8315
(datearg): If rlog options are specified explicitly,
Paul Eggert <eggert@twinsun.com>
parents:
11099
diff
changeset
|
187 ' |
15911
c9a152ad9c5a
Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents:
15742
diff
changeset
|
188 d=`$AWK "$e" <"$changelog"` || exit |
11627
2f0766bf8315
(datearg): If rlog options are specified explicitly,
Paul Eggert <eggert@twinsun.com>
parents:
11099
diff
changeset
|
189 case $d in |
16438
30536ab085c7
(datearg): Use the empty string, not '-d>1970-01-01', to extract all
Paul Eggert <eggert@twinsun.com>
parents:
16433
diff
changeset
|
190 ?*) datearg="-d>$d" |
11627
2f0766bf8315
(datearg): If rlog options are specified explicitly,
Paul Eggert <eggert@twinsun.com>
parents:
11099
diff
changeset
|
191 esac |
2f0766bf8315
(datearg): If rlog options are specified explicitly,
Paul Eggert <eggert@twinsun.com>
parents:
11099
diff
changeset
|
192 fi |
2f0766bf8315
(datearg): If rlog options are specified explicitly,
Paul Eggert <eggert@twinsun.com>
parents:
11099
diff
changeset
|
193 esac |
527 | 194 |
15911
c9a152ad9c5a
Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents:
15742
diff
changeset
|
195 # Use TZ specified by ChangeLog local variable, if any. |
c9a152ad9c5a
Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents:
15742
diff
changeset
|
196 if test -s "$changelog" |
c9a152ad9c5a
Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents:
15742
diff
changeset
|
197 then |
c9a152ad9c5a
Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents:
15742
diff
changeset
|
198 extractTZ=' |
c9a152ad9c5a
Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents:
15742
diff
changeset
|
199 /^.*change-log-time-zone-rule['"$tab"' ]*:['"$tab"' ]*"\([^"]*\)".*/{ |
c9a152ad9c5a
Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents:
15742
diff
changeset
|
200 s//\1/; p; q |
c9a152ad9c5a
Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents:
15742
diff
changeset
|
201 } |
c9a152ad9c5a
Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents:
15742
diff
changeset
|
202 /^.*change-log-time-zone-rule['"$tab"' ]*:['"$tab"' ]*t.*/{ |
c9a152ad9c5a
Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents:
15742
diff
changeset
|
203 s//UTC0/; p; q |
c9a152ad9c5a
Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents:
15742
diff
changeset
|
204 } |
c9a152ad9c5a
Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents:
15742
diff
changeset
|
205 ' |
c9a152ad9c5a
Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents:
15742
diff
changeset
|
206 logTZ=`tail "$changelog" | sed -n "$extractTZ"` |
c9a152ad9c5a
Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents:
15742
diff
changeset
|
207 case $logTZ in |
c9a152ad9c5a
Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents:
15742
diff
changeset
|
208 ?*) TZ=$logTZ; export TZ |
c9a152ad9c5a
Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents:
15742
diff
changeset
|
209 esac |
c9a152ad9c5a
Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents:
15742
diff
changeset
|
210 fi |
c9a152ad9c5a
Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents:
15742
diff
changeset
|
211 |
11627
2f0766bf8315
(datearg): If rlog options are specified explicitly,
Paul Eggert <eggert@twinsun.com>
parents:
11099
diff
changeset
|
212 # If CVS is in use, examine its repository, not the normal RCS files. |
2f0766bf8315
(datearg): If rlog options are specified explicitly,
Paul Eggert <eggert@twinsun.com>
parents:
11099
diff
changeset
|
213 if test ! -f CVS/Repository |
2f0766bf8315
(datearg): If rlog options are specified explicitly,
Paul Eggert <eggert@twinsun.com>
parents:
11099
diff
changeset
|
214 then |
2f0766bf8315
(datearg): If rlog options are specified explicitly,
Paul Eggert <eggert@twinsun.com>
parents:
11099
diff
changeset
|
215 rlog=rlog |
2f0766bf8315
(datearg): If rlog options are specified explicitly,
Paul Eggert <eggert@twinsun.com>
parents:
11099
diff
changeset
|
216 repository= |
2f0766bf8315
(datearg): If rlog options are specified explicitly,
Paul Eggert <eggert@twinsun.com>
parents:
11099
diff
changeset
|
217 else |
16899
04ad9edd12b3
--help, --version: New options, for conformance to GNU coding standards.
Paul Eggert <eggert@twinsun.com>
parents:
16507
diff
changeset
|
218 rlog='cvs -q log' |
11627
2f0766bf8315
(datearg): If rlog options are specified explicitly,
Paul Eggert <eggert@twinsun.com>
parents:
11099
diff
changeset
|
219 repository=`sed 1q <CVS/Repository` || exit |
12408
67f759e94c3e
(CVSROOT, repository): Allow remote repositories a la CVS 1.4.
Paul Eggert <eggert@twinsun.com>
parents:
12066
diff
changeset
|
220 test ! -f CVS/Root || CVSROOT=`cat <CVS/Root` || exit |
12509
68a8bae7a172
(datearg): Separate date from time with comma, not space,
Paul Eggert <eggert@twinsun.com>
parents:
12507
diff
changeset
|
221 case $CVSROOT in |
12408
67f759e94c3e
(CVSROOT, repository): Allow remote repositories a la CVS 1.4.
Paul Eggert <eggert@twinsun.com>
parents:
12066
diff
changeset
|
222 *:/*) |
67f759e94c3e
(CVSROOT, repository): Allow remote repositories a la CVS 1.4.
Paul Eggert <eggert@twinsun.com>
parents:
12066
diff
changeset
|
223 # remote repository |
67f759e94c3e
(CVSROOT, repository): Allow remote repositories a la CVS 1.4.
Paul Eggert <eggert@twinsun.com>
parents:
12066
diff
changeset
|
224 ;; |
67f759e94c3e
(CVSROOT, repository): Allow remote repositories a la CVS 1.4.
Paul Eggert <eggert@twinsun.com>
parents:
12066
diff
changeset
|
225 *) |
67f759e94c3e
(CVSROOT, repository): Allow remote repositories a la CVS 1.4.
Paul Eggert <eggert@twinsun.com>
parents:
12066
diff
changeset
|
226 # local repository |
67f759e94c3e
(CVSROOT, repository): Allow remote repositories a la CVS 1.4.
Paul Eggert <eggert@twinsun.com>
parents:
12066
diff
changeset
|
227 case $repository in |
67f759e94c3e
(CVSROOT, repository): Allow remote repositories a la CVS 1.4.
Paul Eggert <eggert@twinsun.com>
parents:
12066
diff
changeset
|
228 /*) ;; |
12509
68a8bae7a172
(datearg): Separate date from time with comma, not space,
Paul Eggert <eggert@twinsun.com>
parents:
12507
diff
changeset
|
229 *) repository=${CVSROOT?}/$repository |
12408
67f759e94c3e
(CVSROOT, repository): Allow remote repositories a la CVS 1.4.
Paul Eggert <eggert@twinsun.com>
parents:
12066
diff
changeset
|
230 esac |
67f759e94c3e
(CVSROOT, repository): Allow remote repositories a la CVS 1.4.
Paul Eggert <eggert@twinsun.com>
parents:
12066
diff
changeset
|
231 if test ! -d "$repository" |
67f759e94c3e
(CVSROOT, repository): Allow remote repositories a la CVS 1.4.
Paul Eggert <eggert@twinsun.com>
parents:
12066
diff
changeset
|
232 then |
67f759e94c3e
(CVSROOT, repository): Allow remote repositories a la CVS 1.4.
Paul Eggert <eggert@twinsun.com>
parents:
12066
diff
changeset
|
233 echo >&2 "$0: $repository: bad repository (see CVS/Repository)" |
67f759e94c3e
(CVSROOT, repository): Allow remote repositories a la CVS 1.4.
Paul Eggert <eggert@twinsun.com>
parents:
12066
diff
changeset
|
234 exit 1 |
67f759e94c3e
(CVSROOT, repository): Allow remote repositories a la CVS 1.4.
Paul Eggert <eggert@twinsun.com>
parents:
12066
diff
changeset
|
235 fi |
11627
2f0766bf8315
(datearg): If rlog options are specified explicitly,
Paul Eggert <eggert@twinsun.com>
parents:
11099
diff
changeset
|
236 esac |
2f0766bf8315
(datearg): If rlog options are specified explicitly,
Paul Eggert <eggert@twinsun.com>
parents:
11099
diff
changeset
|
237 fi |
8549 | 238 |
16332
be25bd9150e8
(rlog_options): Use $rlog, not rlog, when deciding whether to append -zLT.
Paul Eggert <eggert@twinsun.com>
parents:
15937
diff
changeset
|
239 # Use $rlog's -zLT option, if $rlog supports it. |
be25bd9150e8
(rlog_options): Use $rlog, not rlog, when deciding whether to append -zLT.
Paul Eggert <eggert@twinsun.com>
parents:
15937
diff
changeset
|
240 case `$rlog -zLT 2>&1` in |
16433
63dc01de1823
(rlog_options): Look for ' option' rather than 'unknown option',
Paul Eggert <eggert@twinsun.com>
parents:
16368
diff
changeset
|
241 *' option'*) ;; |
17741
0c832661d9b4
(loginFullnameMailaddrs, logins, rlog_options, files): Don't prepend $nl
Paul Eggert <eggert@twinsun.com>
parents:
17740
diff
changeset
|
242 *) |
0c832661d9b4
(loginFullnameMailaddrs, logins, rlog_options, files): Don't prepend $nl
Paul Eggert <eggert@twinsun.com>
parents:
17740
diff
changeset
|
243 case $rlog_options in |
0c832661d9b4
(loginFullnameMailaddrs, logins, rlog_options, files): Don't prepend $nl
Paul Eggert <eggert@twinsun.com>
parents:
17740
diff
changeset
|
244 '') rlog_options=-zLT;; |
0c832661d9b4
(loginFullnameMailaddrs, logins, rlog_options, files): Don't prepend $nl
Paul Eggert <eggert@twinsun.com>
parents:
17740
diff
changeset
|
245 ?*) rlog_options=-zLT$nl$rlog_options |
0c832661d9b4
(loginFullnameMailaddrs, logins, rlog_options, files): Don't prepend $nl
Paul Eggert <eggert@twinsun.com>
parents:
17740
diff
changeset
|
246 esac |
16332
be25bd9150e8
(rlog_options): Use $rlog, not rlog, when deciding whether to append -zLT.
Paul Eggert <eggert@twinsun.com>
parents:
15937
diff
changeset
|
247 esac |
be25bd9150e8
(rlog_options): Use $rlog, not rlog, when deciding whether to append -zLT.
Paul Eggert <eggert@twinsun.com>
parents:
15937
diff
changeset
|
248 |
3248
9ee93fc9aba0
When given no file arguments, inspect RCS/.* as well
Richard M. Stallman <rms@gnu.org>
parents:
2639
diff
changeset
|
249 # With no arguments, examine all files under the RCS directory. |
9ee93fc9aba0
When given no file arguments, inspect RCS/.* as well
Richard M. Stallman <rms@gnu.org>
parents:
2639
diff
changeset
|
250 case $# in |
9ee93fc9aba0
When given no file arguments, inspect RCS/.* as well
Richard M. Stallman <rms@gnu.org>
parents:
2639
diff
changeset
|
251 0) |
8549 | 252 case $repository in |
253 '') | |
254 oldIFS=$IFS | |
255 IFS=$nl | |
11073
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents:
8549
diff
changeset
|
256 case $recursive in |
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents:
8549
diff
changeset
|
257 t) |
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents:
8549
diff
changeset
|
258 RCSdirs=`find . -name RCS -type d -print` |
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents:
8549
diff
changeset
|
259 filesFromRCSfiles='s|,v$||; s|/RCS/|/|; s|^\./||' |
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents:
8549
diff
changeset
|
260 files=` |
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents:
8549
diff
changeset
|
261 { |
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents:
8549
diff
changeset
|
262 case $RCSdirs in |
17202
9555c074333c
(files): Ignore files in RCS directory whose names are of the form ,*,
Paul Eggert <eggert@twinsun.com>
parents:
16899
diff
changeset
|
263 ?*) find $RCSdirs \ |
9555c074333c
(files): Ignore files in RCS directory whose names are of the form ,*,
Paul Eggert <eggert@twinsun.com>
parents:
16899
diff
changeset
|
264 -type f \ |
9555c074333c
(files): Ignore files in RCS directory whose names are of the form ,*,
Paul Eggert <eggert@twinsun.com>
parents:
16899
diff
changeset
|
265 ! -name '*_' \ |
9555c074333c
(files): Ignore files in RCS directory whose names are of the form ,*,
Paul Eggert <eggert@twinsun.com>
parents:
16899
diff
changeset
|
266 ! -name ',*,' \ |
9555c074333c
(files): Ignore files in RCS directory whose names are of the form ,*,
Paul Eggert <eggert@twinsun.com>
parents:
16899
diff
changeset
|
267 ! -name '.*_' \ |
9555c074333c
(files): Ignore files in RCS directory whose names are of the form ,*,
Paul Eggert <eggert@twinsun.com>
parents:
16899
diff
changeset
|
268 ! -name .rcsfreeze.log \ |
9555c074333c
(files): Ignore files in RCS directory whose names are of the form ,*,
Paul Eggert <eggert@twinsun.com>
parents:
16899
diff
changeset
|
269 ! -name .rcsfreeze.ver \ |
9555c074333c
(files): Ignore files in RCS directory whose names are of the form ,*,
Paul Eggert <eggert@twinsun.com>
parents:
16899
diff
changeset
|
270 -print |
11073
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents:
8549
diff
changeset
|
271 esac |
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents:
8549
diff
changeset
|
272 find . -name '*,v' -print |
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents:
8549
diff
changeset
|
273 } | |
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents:
8549
diff
changeset
|
274 sort -u | |
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents:
8549
diff
changeset
|
275 sed "$filesFromRCSfiles" |
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents:
8549
diff
changeset
|
276 `;; |
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents:
8549
diff
changeset
|
277 *) |
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents:
8549
diff
changeset
|
278 files= |
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents:
8549
diff
changeset
|
279 for file in RCS/.* RCS/* .*,v *,v |
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents:
8549
diff
changeset
|
280 do |
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents:
8549
diff
changeset
|
281 case $file in |
17202
9555c074333c
(files): Ignore files in RCS directory whose names are of the form ,*,
Paul Eggert <eggert@twinsun.com>
parents:
16899
diff
changeset
|
282 RCS/. | RCS/.. | RCS/,*, | RCS/*_) continue;; |
9555c074333c
(files): Ignore files in RCS directory whose names are of the form ,*,
Paul Eggert <eggert@twinsun.com>
parents:
16899
diff
changeset
|
283 RCS/.rcsfreeze.log | RCS/.rcsfreeze.ver) continue;; |
17791
c113f8bd706c
(files): When computing arguments automatically, ignore non-files
Paul Eggert <eggert@twinsun.com>
parents:
17741
diff
changeset
|
284 RCS/.\* | RCS/\* | .\*,v | \*,v) test -f "$file" || continue;; |
c113f8bd706c
(files): When computing arguments automatically, ignore non-files
Paul Eggert <eggert@twinsun.com>
parents:
17741
diff
changeset
|
285 RCS/*,v | RCS/.*,v) ;; |
c113f8bd706c
(files): When computing arguments automatically, ignore non-files
Paul Eggert <eggert@twinsun.com>
parents:
17741
diff
changeset
|
286 RCS/* | RCS/.*) test -f "$file" || continue |
11073
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents:
8549
diff
changeset
|
287 esac |
17741
0c832661d9b4
(loginFullnameMailaddrs, logins, rlog_options, files): Don't prepend $nl
Paul Eggert <eggert@twinsun.com>
parents:
17740
diff
changeset
|
288 case $files in |
0c832661d9b4
(loginFullnameMailaddrs, logins, rlog_options, files): Don't prepend $nl
Paul Eggert <eggert@twinsun.com>
parents:
17740
diff
changeset
|
289 '') files=$file;; |
0c832661d9b4
(loginFullnameMailaddrs, logins, rlog_options, files): Don't prepend $nl
Paul Eggert <eggert@twinsun.com>
parents:
17740
diff
changeset
|
290 ?*) files=$files$nl$file |
0c832661d9b4
(loginFullnameMailaddrs, logins, rlog_options, files): Don't prepend $nl
Paul Eggert <eggert@twinsun.com>
parents:
17740
diff
changeset
|
291 esac |
11073
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents:
8549
diff
changeset
|
292 done |
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents:
8549
diff
changeset
|
293 case $files in |
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents:
8549
diff
changeset
|
294 '') exit 0 |
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents:
8549
diff
changeset
|
295 esac |
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents:
8549
diff
changeset
|
296 esac |
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents:
8549
diff
changeset
|
297 set x $files |
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents:
8549
diff
changeset
|
298 shift |
8549 | 299 IFS=$oldIFS |
3248
9ee93fc9aba0
When given no file arguments, inspect RCS/.* as well
Richard M. Stallman <rms@gnu.org>
parents:
2639
diff
changeset
|
300 esac |
9ee93fc9aba0
When given no file arguments, inspect RCS/.* as well
Richard M. Stallman <rms@gnu.org>
parents:
2639
diff
changeset
|
301 esac |
9ee93fc9aba0
When given no file arguments, inspect RCS/.* as well
Richard M. Stallman <rms@gnu.org>
parents:
2639
diff
changeset
|
302 |
35016
731a7aca9458
Avoid security hole allowing attacker to
Gerd Moellmann <gerd@gnu.org>
parents:
23008
diff
changeset
|
303 logdir=$TMPDIR/rcs2log$$ |
731a7aca9458
Avoid security hole allowing attacker to
Gerd Moellmann <gerd@gnu.org>
parents:
23008
diff
changeset
|
304 llogout=$logdir/l |
731a7aca9458
Avoid security hole allowing attacker to
Gerd Moellmann <gerd@gnu.org>
parents:
23008
diff
changeset
|
305 rlogout=$logdir/r |
527 | 306 trap exit 1 2 13 15 |
35016
731a7aca9458
Avoid security hole allowing attacker to
Gerd Moellmann <gerd@gnu.org>
parents:
23008
diff
changeset
|
307 trap "rm -fr $logdir 2>/dev/null" 0 |
731a7aca9458
Avoid security hole allowing attacker to
Gerd Moellmann <gerd@gnu.org>
parents:
23008
diff
changeset
|
308 (umask 077 && exec mkdir $logdir) || exit |
527 | 309 |
15911
c9a152ad9c5a
Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents:
15742
diff
changeset
|
310 case $datearg in |
c9a152ad9c5a
Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents:
15742
diff
changeset
|
311 ?*) $rlog $rlog_options "$datearg" ${1+"$@"} >$rlogout;; |
c9a152ad9c5a
Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents:
15742
diff
changeset
|
312 '') $rlog $rlog_options ${1+"$@"} >$rlogout |
11627
2f0766bf8315
(datearg): If rlog options are specified explicitly,
Paul Eggert <eggert@twinsun.com>
parents:
11099
diff
changeset
|
313 esac || exit |
527 | 314 |
315 | |
316 # Get the full name of each author the logs mention, and set initialize_fullname | |
317 # to awk code that initializes the `fullname' awk associative array. | |
318 # Warning: foreign authors (i.e. not known in the passwd file) are mishandled; | |
319 # you have to fix the resulting output by hand. | |
320 | |
11073
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents:
8549
diff
changeset
|
321 initialize_fullname= |
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents:
8549
diff
changeset
|
322 initialize_mailaddr= |
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents:
8549
diff
changeset
|
323 |
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents:
8549
diff
changeset
|
324 case $loginFullnameMailaddrs in |
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents:
8549
diff
changeset
|
325 ?*) |
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents:
8549
diff
changeset
|
326 case $loginFullnameMailaddrs in |
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents:
8549
diff
changeset
|
327 *\"* | *\\*) |
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents:
8549
diff
changeset
|
328 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
|
329 $loginFullnameMailaddrs |
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents:
8549
diff
changeset
|
330 EOF |
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents:
8549
diff
changeset
|
331 loginFullnameMailaddrs=`cat $llogout` |
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents:
8549
diff
changeset
|
332 esac |
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents:
8549
diff
changeset
|
333 |
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents:
8549
diff
changeset
|
334 oldIFS=$IFS |
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents:
8549
diff
changeset
|
335 IFS=$nl |
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents:
8549
diff
changeset
|
336 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
|
337 do |
11082
aee85fcd9d25
Treat -u 'LOGIN:FULLNAME:MAILADDR' as if it were
Paul Eggert <eggert@twinsun.com>
parents:
11073
diff
changeset
|
338 case $loginFullnameMailaddr in |
aee85fcd9d25
Treat -u 'LOGIN:FULLNAME:MAILADDR' as if it were
Paul Eggert <eggert@twinsun.com>
parents:
11073
diff
changeset
|
339 *"$tab"*) IFS=$tab;; |
aee85fcd9d25
Treat -u 'LOGIN:FULLNAME:MAILADDR' as if it were
Paul Eggert <eggert@twinsun.com>
parents:
11073
diff
changeset
|
340 *) IFS=: |
aee85fcd9d25
Treat -u 'LOGIN:FULLNAME:MAILADDR' as if it were
Paul Eggert <eggert@twinsun.com>
parents:
11073
diff
changeset
|
341 esac |
11073
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents:
8549
diff
changeset
|
342 set x $loginFullnameMailaddr |
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents:
8549
diff
changeset
|
343 login=$2 |
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents:
8549
diff
changeset
|
344 fullname=$3 |
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents:
8549
diff
changeset
|
345 mailaddr=$4 |
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents:
8549
diff
changeset
|
346 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
|
347 fullname[\"$login\"] = \"$fullname\"" |
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents:
8549
diff
changeset
|
348 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
|
349 mailaddr[\"$login\"] = \"$mailaddr\"" |
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents:
8549
diff
changeset
|
350 done |
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents:
8549
diff
changeset
|
351 IFS=$oldIFS |
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents:
8549
diff
changeset
|
352 esac |
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents:
8549
diff
changeset
|
353 |
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents:
8549
diff
changeset
|
354 case $llogout in |
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents:
8549
diff
changeset
|
355 ?*) sort -u -o $llogout <<EOF || exit |
4783 | 356 $logins |
357 EOF | |
358 esac | |
11073
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents:
8549
diff
changeset
|
359 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
|
360 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
|
361 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
|
362 } |
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents:
8549
diff
changeset
|
363 }' |
527 | 364 authors=` |
11073
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents:
8549
diff
changeset
|
365 $AWK "$output_authors" <$rlogout | |
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents:
8549
diff
changeset
|
366 case $llogout in |
4783 | 367 '') sort -u;; |
11073
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents:
8549
diff
changeset
|
368 ?*) sort -u | comm -23 - $llogout |
4783 | 369 esac |
527 | 370 ` |
640
36e7f4e402bd
Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents:
636
diff
changeset
|
371 case $authors in |
36e7f4e402bd
Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents:
636
diff
changeset
|
372 ?*) |
11073
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents:
8549
diff
changeset
|
373 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
|
374 $authors |
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents:
8549
diff
changeset
|
375 EOF |
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents:
8549
diff
changeset
|
376 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
|
377 initialize_author=`sed -e "$initialize_author_script" <$llogout` |
640
36e7f4e402bd
Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents:
636
diff
changeset
|
378 awkscript=' |
36e7f4e402bd
Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents:
636
diff
changeset
|
379 BEGIN { |
36e7f4e402bd
Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents:
636
diff
changeset
|
380 alphabet = "abcdefghijklmnopqrstuvwxyz" |
36e7f4e402bd
Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents:
636
diff
changeset
|
381 ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" |
36e7f4e402bd
Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents:
636
diff
changeset
|
382 '"$initialize_author"' |
36e7f4e402bd
Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents:
636
diff
changeset
|
383 } |
36e7f4e402bd
Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents:
636
diff
changeset
|
384 { |
36e7f4e402bd
Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents:
636
diff
changeset
|
385 if (author[$1]) { |
36e7f4e402bd
Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents:
636
diff
changeset
|
386 fullname = $5 |
4504
65ef94a9e2c4
(awkscript): Some sites put comma-separated junk after the fullname.
Paul Eggert <eggert@twinsun.com>
parents:
3248
diff
changeset
|
387 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
|
388 # 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
|
389 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
|
390 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
|
391 } |
65ef94a9e2c4
(awkscript): Some sites put comma-separated junk after the fullname.
Paul Eggert <eggert@twinsun.com>
parents:
3248
diff
changeset
|
392 if (fullname ~ /,[^ ]/) { |
65ef94a9e2c4
(awkscript): Some sites put comma-separated junk after the fullname.
Paul Eggert <eggert@twinsun.com>
parents:
3248
diff
changeset
|
393 # 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
|
394 # 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
|
395 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
|
396 } |
640
36e7f4e402bd
Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents:
636
diff
changeset
|
397 abbr = index(fullname, "&") |
36e7f4e402bd
Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents:
636
diff
changeset
|
398 if (abbr) { |
36e7f4e402bd
Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents:
636
diff
changeset
|
399 a = substr($1, 1, 1) |
36e7f4e402bd
Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents:
636
diff
changeset
|
400 A = a |
36e7f4e402bd
Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents:
636
diff
changeset
|
401 i = index(alphabet, a) |
36e7f4e402bd
Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents:
636
diff
changeset
|
402 if (i) A = substr(ALPHABET, i, 1) |
36e7f4e402bd
Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents:
636
diff
changeset
|
403 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
|
404 } |
11073
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents:
8549
diff
changeset
|
405 |
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents:
8549
diff
changeset
|
406 # 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
|
407 # 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
|
408 quoted = "" |
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents:
8549
diff
changeset
|
409 rest = fullname |
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents:
8549
diff
changeset
|
410 for (;;) { |
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents:
8549
diff
changeset
|
411 p = index(rest, "\\") |
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents:
8549
diff
changeset
|
412 q = index(rest, "\"") |
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents:
8549
diff
changeset
|
413 if (p) { |
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents:
8549
diff
changeset
|
414 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
|
415 } else { |
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents:
8549
diff
changeset
|
416 if (!q) break |
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents:
8549
diff
changeset
|
417 p = q |
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 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
|
420 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
|
421 } |
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents:
8549
diff
changeset
|
422 |
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents:
8549
diff
changeset
|
423 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
|
424 author[$1] = 0 |
36e7f4e402bd
Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents:
636
diff
changeset
|
425 } |
36e7f4e402bd
Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents:
636
diff
changeset
|
426 } |
36e7f4e402bd
Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents:
636
diff
changeset
|
427 ' |
36e7f4e402bd
Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents:
636
diff
changeset
|
428 |
36e7f4e402bd
Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents:
636
diff
changeset
|
429 initialize_fullname=` |
22999
5ec968f5560c
(initialize_fullname): Prefer getent if available.
Paul Eggert <eggert@twinsun.com>
parents:
18452
diff
changeset
|
430 { |
5ec968f5560c
(initialize_fullname): Prefer getent if available.
Paul Eggert <eggert@twinsun.com>
parents:
18452
diff
changeset
|
431 (getent passwd $authors) || |
5ec968f5560c
(initialize_fullname): Prefer getent if available.
Paul Eggert <eggert@twinsun.com>
parents:
18452
diff
changeset
|
432 ( |
5ec968f5560c
(initialize_fullname): Prefer getent if available.
Paul Eggert <eggert@twinsun.com>
parents:
18452
diff
changeset
|
433 cat /etc/passwd |
5ec968f5560c
(initialize_fullname): Prefer getent if available.
Paul Eggert <eggert@twinsun.com>
parents:
18452
diff
changeset
|
434 for author in $authors |
5ec968f5560c
(initialize_fullname): Prefer getent if available.
Paul Eggert <eggert@twinsun.com>
parents:
18452
diff
changeset
|
435 do NIS_PATH= nismatch $author passwd.org_dir |
5ec968f5560c
(initialize_fullname): Prefer getent if available.
Paul Eggert <eggert@twinsun.com>
parents:
18452
diff
changeset
|
436 done |
5ec968f5560c
(initialize_fullname): Prefer getent if available.
Paul Eggert <eggert@twinsun.com>
parents:
18452
diff
changeset
|
437 ypmatch $authors passwd |
5ec968f5560c
(initialize_fullname): Prefer getent if available.
Paul Eggert <eggert@twinsun.com>
parents:
18452
diff
changeset
|
438 ) |
5ec968f5560c
(initialize_fullname): Prefer getent if available.
Paul Eggert <eggert@twinsun.com>
parents:
18452
diff
changeset
|
439 } 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
|
440 $AWK -F: "$awkscript" |
4783 | 441 `$initialize_fullname |
640
36e7f4e402bd
Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents:
636
diff
changeset
|
442 esac |
527 | 443 |
444 | |
445 # Function to print a single log line. | |
446 # We don't use awk functions, to stay compatible with old awk versions. | |
17741
0c832661d9b4
(loginFullnameMailaddrs, logins, rlog_options, files): Don't prepend $nl
Paul Eggert <eggert@twinsun.com>
parents:
17740
diff
changeset
|
447 # `Log' is the log message (with \n replaced by \001). |
594 | 448 # `files' contains the affected files. |
527 | 449 printlogline='{ |
450 | |
451 # Following the GNU coding standards, rewrite | |
452 # * file: (function): comment | |
453 # to | |
454 # * file (function): comment | |
455 if (Log ~ /^\([^)]*\): /) { | |
456 i = index(Log, ")") | |
457 files = files " " substr(Log, 1, i) | |
458 Log = substr(Log, i+3) | |
459 } | |
460 | |
461 # If "label: comment" is too long, break the line after the ":". | |
462 sep = " " | |
17741
0c832661d9b4
(loginFullnameMailaddrs, logins, rlog_options, files): Don't prepend $nl
Paul Eggert <eggert@twinsun.com>
parents:
17740
diff
changeset
|
463 if ('"$length"' <= '"$indent"' + 1 + length(files) + index(Log, SOH)) sep = "\n" indent_string |
527 | 464 |
465 # Print the label. | |
534 | 466 printf "%s*%s:", indent_string, files |
527 | 467 |
17741
0c832661d9b4
(loginFullnameMailaddrs, logins, rlog_options, files): Don't prepend $nl
Paul Eggert <eggert@twinsun.com>
parents:
17740
diff
changeset
|
468 # Print each line of the log, transliterating \001 to \n. |
0c832661d9b4
(loginFullnameMailaddrs, logins, rlog_options, files): Don't prepend $nl
Paul Eggert <eggert@twinsun.com>
parents:
17740
diff
changeset
|
469 while ((i = index(Log, SOH)) != 0) { |
4858
5b4f9564bfaf
(printlogline): Don't generate lines containing only white space.
Paul Eggert <eggert@twinsun.com>
parents:
4783
diff
changeset
|
470 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
|
471 if (logline ~ /[^'"$tab"' ]/) { |
4858
5b4f9564bfaf
(printlogline): Don't generate lines containing only white space.
Paul Eggert <eggert@twinsun.com>
parents:
4783
diff
changeset
|
472 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
|
473 } else { |
5b4f9564bfaf
(printlogline): Don't generate lines containing only white space.
Paul Eggert <eggert@twinsun.com>
parents:
4783
diff
changeset
|
474 print "" |
5b4f9564bfaf
(printlogline): Don't generate lines containing only white space.
Paul Eggert <eggert@twinsun.com>
parents:
4783
diff
changeset
|
475 } |
534 | 476 sep = indent_string |
527 | 477 Log = substr(Log, i+1) |
478 } | |
479 }' | |
480 | |
15911
c9a152ad9c5a
Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents:
15742
diff
changeset
|
481 # 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
|
482 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
|
483 |
4783 | 484 case $hostname in |
485 '') | |
486 hostname=`( | |
487 hostname || uname -n || uuname -l || cat /etc/whoami | |
488 ) 2>/dev/null` || { | |
489 echo >&2 "$0: cannot deduce hostname" | |
490 exit 1 | |
491 } | |
14173
940083ef25b9
(initialize_fullname): Add support for NIS+.
Paul Eggert <eggert@twinsun.com>
parents:
12509
diff
changeset
|
492 |
940083ef25b9
(initialize_fullname): Add support for NIS+.
Paul Eggert <eggert@twinsun.com>
parents:
12509
diff
changeset
|
493 case $hostname in |
940083ef25b9
(initialize_fullname): Add support for NIS+.
Paul Eggert <eggert@twinsun.com>
parents:
12509
diff
changeset
|
494 *.*) ;; |
940083ef25b9
(initialize_fullname): Add support for NIS+.
Paul Eggert <eggert@twinsun.com>
parents:
12509
diff
changeset
|
495 *) |
940083ef25b9
(initialize_fullname): Add support for NIS+.
Paul Eggert <eggert@twinsun.com>
parents:
12509
diff
changeset
|
496 domainname=`(domainname) 2>/dev/null` && |
940083ef25b9
(initialize_fullname): Add support for NIS+.
Paul Eggert <eggert@twinsun.com>
parents:
12509
diff
changeset
|
497 case $domainname in |
940083ef25b9
(initialize_fullname): Add support for NIS+.
Paul Eggert <eggert@twinsun.com>
parents:
12509
diff
changeset
|
498 *.*) hostname=$hostname.$domainname |
940083ef25b9
(initialize_fullname): Add support for NIS+.
Paul Eggert <eggert@twinsun.com>
parents:
12509
diff
changeset
|
499 esac |
940083ef25b9
(initialize_fullname): Add support for NIS+.
Paul Eggert <eggert@twinsun.com>
parents:
12509
diff
changeset
|
500 esac |
4783 | 501 esac |
527 | 502 |
503 | |
504 # Process the rlog output, generating ChangeLog style entries. | |
505 | |
506 # First, reformat the rlog output so that each line contains one log entry. | |
17741
0c832661d9b4
(loginFullnameMailaddrs, logins, rlog_options, files): Don't prepend $nl
Paul Eggert <eggert@twinsun.com>
parents:
17740
diff
changeset
|
507 # Transliterate \n to \001 so that multiline entries fit on a single line. |
527 | 508 # Discard irrelevant rlog output. |
11073
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents:
8549
diff
changeset
|
509 $AWK <$rlogout ' |
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents:
8549
diff
changeset
|
510 BEGIN { repository = "'"$repository"'" } |
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents:
8549
diff
changeset
|
511 /^RCS file:/ { |
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents:
8549
diff
changeset
|
512 if (repository != "") { |
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents:
8549
diff
changeset
|
513 filename = $3 |
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents:
8549
diff
changeset
|
514 if (substr(filename, 1, length(repository) + 1) == repository "/") { |
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents:
8549
diff
changeset
|
515 filename = substr(filename, length(repository) + 2) |
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents:
8549
diff
changeset
|
516 } |
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents:
8549
diff
changeset
|
517 if (filename ~ /,v$/) { |
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents:
8549
diff
changeset
|
518 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
|
519 } |
16507
08855b88e955
When processing cvs log output, remove `Attic/' from repository file names.
Paul Eggert <eggert@twinsun.com>
parents:
16438
diff
changeset
|
520 if (filename ~ /(^|\/)Attic\/[^\/]*$/) { |
08855b88e955
When processing cvs log output, remove `Attic/' from repository file names.
Paul Eggert <eggert@twinsun.com>
parents:
16438
diff
changeset
|
521 i = length(filename) |
08855b88e955
When processing cvs log output, remove `Attic/' from repository file names.
Paul Eggert <eggert@twinsun.com>
parents:
16438
diff
changeset
|
522 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
|
523 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
|
524 } |
11073
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents:
8549
diff
changeset
|
525 } |
15911
c9a152ad9c5a
Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents:
15742
diff
changeset
|
526 rev = "?" |
11073
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents:
8549
diff
changeset
|
527 } |
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents:
8549
diff
changeset
|
528 /^Working file:/ { if (repository == "") filename = $3 } |
15911
c9a152ad9c5a
Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents:
15742
diff
changeset
|
529 /'"$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
|
530 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
|
531 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
|
532 rev = $2 |
c9a152ad9c5a
Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents:
15742
diff
changeset
|
533 next |
c9a152ad9c5a
Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents:
15742
diff
changeset
|
534 } |
18452
44e598b69b42
Don't assign to $0 in awk; some awks don't allow this.
Paul Eggert <eggert@twinsun.com>
parents:
17791
diff
changeset
|
535 if (line ~ /^date: [0-9][- +\/0-9:]*;/) { |
8549 | 536 date = $2 |
15911
c9a152ad9c5a
Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents:
15742
diff
changeset
|
537 if (date ~ /\//) { |
c9a152ad9c5a
Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents:
15742
diff
changeset
|
538 # 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
|
539 # Replace "/"s with "-"s to get ISO format. |
8549 | 540 newdate = "" |
15911
c9a152ad9c5a
Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents:
15742
diff
changeset
|
541 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
|
542 newdate = newdate substr(date, 1, i-1) "-" |
8549 | 543 date = substr(date, i+1) |
544 } | |
545 date = newdate date | |
546 } | |
15911
c9a152ad9c5a
Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents:
15742
diff
changeset
|
547 time = substr($3, 1, length($3) - 1) |
527 | 548 author = substr($5, 1, length($5)-1) |
17741
0c832661d9b4
(loginFullnameMailaddrs, logins, rlog_options, files): Don't prepend $nl
Paul Eggert <eggert@twinsun.com>
parents:
17740
diff
changeset
|
549 printf "%s %s %s %s %s %c", filename, rev, date, time, author, 1 |
15911
c9a152ad9c5a
Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents:
15742
diff
changeset
|
550 rev = "?" |
527 | 551 next |
552 } | |
18452
44e598b69b42
Don't assign to $0 in awk; some awks don't allow this.
Paul Eggert <eggert@twinsun.com>
parents:
17791
diff
changeset
|
553 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
|
554 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
|
555 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
|
556 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
|
557 } |
44e598b69b42
Don't assign to $0 in awk; some awks don't allow this.
Paul Eggert <eggert@twinsun.com>
parents:
17791
diff
changeset
|
558 printf "%s%c", line, 1 |
527 | 559 } |
560 ' | | |
561 | |
562 # Now each line is of the form | |
17741
0c832661d9b4
(loginFullnameMailaddrs, logins, rlog_options, files): Don't prepend $nl
Paul Eggert <eggert@twinsun.com>
parents:
17740
diff
changeset
|
563 # FILENAME REVISION YYYY-MM-DD HH:MM:SS[+-TIMEZONE] AUTHOR \001LOG |
0c832661d9b4
(loginFullnameMailaddrs, logins, rlog_options, files): Don't prepend $nl
Paul Eggert <eggert@twinsun.com>
parents:
17740
diff
changeset
|
564 # where \001 stands for a carriage return, |
0c832661d9b4
(loginFullnameMailaddrs, logins, rlog_options, files): Don't prepend $nl
Paul Eggert <eggert@twinsun.com>
parents:
17740
diff
changeset
|
565 # and each line of the log is terminated by \001 instead of \n. |
640
36e7f4e402bd
Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents:
636
diff
changeset
|
566 # 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
|
567 # 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
|
568 # (just in case). |
c9a152ad9c5a
Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents:
15742
diff
changeset
|
569 sort +2 -4r +4 +0 | |
527 | 570 |
571 # Finally, reformat the sorted log entries. | |
11073
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents:
8549
diff
changeset
|
572 $AWK ' |
527 | 573 BEGIN { |
15911
c9a152ad9c5a
Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents:
15742
diff
changeset
|
574 logTZ = "'"$logTZ"'" |
c9a152ad9c5a
Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents:
15742
diff
changeset
|
575 revision = "'"$revision"'" |
c9a152ad9c5a
Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents:
15742
diff
changeset
|
576 |
17741
0c832661d9b4
(loginFullnameMailaddrs, logins, rlog_options, files): Don't prepend $nl
Paul Eggert <eggert@twinsun.com>
parents:
17740
diff
changeset
|
577 # Some awk variants do not understand "\001", so we have to |
0c832661d9b4
(loginFullnameMailaddrs, logins, rlog_options, files): Don't prepend $nl
Paul Eggert <eggert@twinsun.com>
parents:
17740
diff
changeset
|
578 # put the char directly in the file. |
0c832661d9b4
(loginFullnameMailaddrs, logins, rlog_options, files): Don't prepend $nl
Paul Eggert <eggert@twinsun.com>
parents:
17740
diff
changeset
|
579 SOH="" # <-- There is a single SOH (octal code 001) here. |
527 | 580 |
4783 | 581 # Initialize the fullname and mailaddr associative arrays. |
527 | 582 '"$initialize_fullname"' |
4783 | 583 '"$initialize_mailaddr"' |
527 | 584 |
534 | 585 # Initialize indent string. |
586 indent_string = "" | |
587 i = '"$indent"' | |
588 if (0 < '"$tabwidth"') | |
589 for (; '"$tabwidth"' <= i; i -= '"$tabwidth"') | |
590 indent_string = indent_string "\t" | |
591 while (1 <= i--) | |
592 indent_string = indent_string " " | |
527 | 593 } |
636
dce8cdbac0ea
Ignore log messages that start with `#'.
Paul Eggert <eggert@twinsun.com>
parents:
602
diff
changeset
|
594 |
527 | 595 { |
17741
0c832661d9b4
(loginFullnameMailaddrs, logins, rlog_options, files): Don't prepend $nl
Paul Eggert <eggert@twinsun.com>
parents:
17740
diff
changeset
|
596 newlog = substr($0, 1 + index($0, SOH)) |
636
dce8cdbac0ea
Ignore log messages that start with `#'.
Paul Eggert <eggert@twinsun.com>
parents:
602
diff
changeset
|
597 |
dce8cdbac0ea
Ignore log messages that start with `#'.
Paul Eggert <eggert@twinsun.com>
parents:
602
diff
changeset
|
598 # Ignore log entries prefixed by "#". |
dce8cdbac0ea
Ignore log messages that start with `#'.
Paul Eggert <eggert@twinsun.com>
parents:
602
diff
changeset
|
599 if (newlog ~ /^#/) { next } |
dce8cdbac0ea
Ignore log messages that start with `#'.
Paul Eggert <eggert@twinsun.com>
parents:
602
diff
changeset
|
600 |
15911
c9a152ad9c5a
Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents:
15742
diff
changeset
|
601 if (Log != newlog || date != $3 || author != $5) { |
594 | 602 |
527 | 603 # The previous log and this log differ. |
594 | 604 |
605 # Print the old log. | |
527 | 606 if (date != "") '"$printlogline"' |
607 | |
594 | 608 # Logs that begin with "{clumpname} " should be grouped together, |
609 # and the clumpname should be removed. | |
610 # Extract the new clumpname from the log header, | |
611 # and use it to decide whether to output a blank line. | |
612 newclumpname = "" | |
613 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
|
614 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
|
615 if (newlog ~ /^\{[^'"$tab"' }]*}['"$tab"' ]/) { |
594 | 616 i = index(newlog, "}") |
617 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
|
618 while (substr(newlog, i+1) ~ /^['"$tab"' ]/) i++ |
594 | 619 newlog = substr(newlog, i+1) |
620 if (clumpname == newclumpname) sep = "" | |
621 } | |
622 printf sep | |
623 clumpname = newclumpname | |
624 | |
527 | 625 # Get ready for the next log. |
626 Log = newlog | |
534 | 627 if (files != "") |
628 for (i in filesknown) | |
629 filesknown[i] = 0 | |
527 | 630 files = "" |
631 } | |
15911
c9a152ad9c5a
Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents:
15742
diff
changeset
|
632 if (date != $3 || author != $5) { |
527 | 633 # The previous date+author and this date+author differ. |
634 # 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
|
635 date = $3 |
c9a152ad9c5a
Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents:
15742
diff
changeset
|
636 time = $4 |
c9a152ad9c5a
Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents:
15742
diff
changeset
|
637 author = $5 |
527 | 638 |
15911
c9a152ad9c5a
Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents:
15742
diff
changeset
|
639 zone = "" |
c9a152ad9c5a
Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents:
15742
diff
changeset
|
640 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
|
641 zone = " " substr(time, i) |
527 | 642 |
15911
c9a152ad9c5a
Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents:
15742
diff
changeset
|
643 # Print "date[ timezone] fullname <email address>". |
4783 | 644 # Get fullname and email address from associative arrays; |
645 # default to author and author@hostname if not in arrays. | |
534 | 646 if (fullname[author]) |
4783 | 647 auth = fullname[author] |
534 | 648 else |
4783 | 649 auth = author |
15911
c9a152ad9c5a
Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents:
15742
diff
changeset
|
650 printf "%s%s %s ", date, zone, auth |
4783 | 651 if (mailaddr[author]) |
8496
2dba6eb73c65
Use <> to delimit email address.
Richard M. Stallman <rms@gnu.org>
parents:
4858
diff
changeset
|
652 printf "<%s>\n\n", mailaddr[author] |
4783 | 653 else |
8496
2dba6eb73c65
Use <> to delimit email address.
Richard M. Stallman <rms@gnu.org>
parents:
4858
diff
changeset
|
654 printf "<%s@%s>\n\n", author, "'"$hostname"'" |
527 | 655 } |
534 | 656 if (! filesknown[$1]) { |
657 filesknown[$1] = 1 | |
594 | 658 if (files == "") files = " " $1 |
659 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
|
660 if (revision && $2 != "?") files = files " " $2 |
534 | 661 } |
527 | 662 } |
663 END { | |
664 # Print the last log. | |
594 | 665 if (date != "") { |
666 '"$printlogline"' | |
667 printf "\n" | |
668 } | |
527 | 669 } |
670 ' && | |
671 | |
672 | |
673 # Exit successfully. | |
674 | |
35016
731a7aca9458
Avoid security hole allowing attacker to
Gerd Moellmann <gerd@gnu.org>
parents:
23008
diff
changeset
|
675 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
|
676 |
c9a152ad9c5a
Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents:
15742
diff
changeset
|
677 # Local Variables: |
c9a152ad9c5a
Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents:
15742
diff
changeset
|
678 # tab-width:4 |
c9a152ad9c5a
Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents:
15742
diff
changeset
|
679 # End: |