annotate lib-src/=rcs2log @ 16670:37fa6003964d

Fix previous change.
author Richard M. Stallman <rms@gnu.org>
date Wed, 11 Dec 1996 21:06:53 +0000
parents 08855b88e955
children 04ad9edd12b3
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
4783
7c75802f5a8b Add -h, -n, -r options.
Paul Eggert <eggert@twinsun.com>
parents: 4654
diff changeset
5 # Generate a change log prefix from RCS files and the ChangeLog (if any).
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
6 # Output the new prefix to standard output.
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
7 # You can edit this prefix by hand, and then prepend it to ChangeLog.
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
8
636
dce8cdbac0ea Ignore log messages that start with `#'.
Paul Eggert <eggert@twinsun.com>
parents: 602
diff changeset
9 # Ignore log entries that start with `#'.
dce8cdbac0ea Ignore log messages that start with `#'.
Paul Eggert <eggert@twinsun.com>
parents: 602
diff changeset
10 # Clump together log entries that start with `{topic} ',
dce8cdbac0ea Ignore log messages that start with `#'.
Paul Eggert <eggert@twinsun.com>
parents: 602
diff changeset
11 # where `topic' contains neither white space nor `}'.
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
12
1800
05cb79ebdb23 Add copyright and authorship notices.
Paul Eggert <eggert@twinsun.com>
parents: 1228
diff changeset
13 # Author: Paul Eggert <eggert@twinsun.com>
05cb79ebdb23 Add copyright and authorship notices.
Paul Eggert <eggert@twinsun.com>
parents: 1228
diff changeset
14
16507
08855b88e955 When processing cvs log output, remove `Attic/' from repository file names.
Paul Eggert <eggert@twinsun.com>
parents: 16438
diff changeset
15 # $Id: rcs2log,v 1.34 1996/10/13 05:59:42 eggert Exp eggert $
1800
05cb79ebdb23 Add copyright and authorship notices.
Paul Eggert <eggert@twinsun.com>
parents: 1228
diff changeset
16
14173
940083ef25b9 (initialize_fullname): Add support for NIS+.
Paul Eggert <eggert@twinsun.com>
parents: 12509
diff changeset
17 # Copyright 1992, 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
1800
05cb79ebdb23 Add copyright and authorship notices.
Paul Eggert <eggert@twinsun.com>
parents: 1228
diff changeset
18
05cb79ebdb23 Add copyright and authorship notices.
Paul Eggert <eggert@twinsun.com>
parents: 1228
diff changeset
19 # 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
20 # 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
21 # 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
22 # any later version.
15911
c9a152ad9c5a Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents: 15742
diff changeset
23 #
1800
05cb79ebdb23 Add copyright and authorship notices.
Paul Eggert <eggert@twinsun.com>
parents: 1228
diff changeset
24 # 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
25 # 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
26 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
05cb79ebdb23 Add copyright and authorship notices.
Paul Eggert <eggert@twinsun.com>
parents: 1228
diff changeset
27 # 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
28 #
1800
05cb79ebdb23 Add copyright and authorship notices.
Paul Eggert <eggert@twinsun.com>
parents: 1228
diff changeset
29 # 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
30 # along with this program; see the file COPYING. If not, write to the
15742
80562f089595 Fix FSF address in comment.
Karl Heuer <kwzh@gnu.org>
parents: 14173
diff changeset
31 # Free Software Foundation, Inc., 59 Temple Place - Suite 330,
80562f089595 Fix FSF address in comment.
Karl Heuer <kwzh@gnu.org>
parents: 14173
diff changeset
32 # Boston, MA 02111-1307, USA.
1800
05cb79ebdb23 Add copyright and authorship notices.
Paul Eggert <eggert@twinsun.com>
parents: 1228
diff changeset
33
11073
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
34 tab=' '
3248
9ee93fc9aba0 When given no file arguments, inspect RCS/.* as well
Richard M. Stallman <rms@gnu.org>
parents: 2639
diff changeset
35 nl='
9ee93fc9aba0 When given no file arguments, inspect RCS/.* as well
Richard M. Stallman <rms@gnu.org>
parents: 2639
diff changeset
36 '
1800
05cb79ebdb23 Add copyright and authorship notices.
Paul Eggert <eggert@twinsun.com>
parents: 1228
diff changeset
37
534
6f7abc0e1f10 Add -i, -l, -t.
Paul Eggert <eggert@twinsun.com>
parents: 527
diff changeset
38 # Parse options.
6f7abc0e1f10 Add -i, -l, -t.
Paul Eggert <eggert@twinsun.com>
parents: 527
diff changeset
39
6f7abc0e1f10 Add -i, -l, -t.
Paul Eggert <eggert@twinsun.com>
parents: 527
diff changeset
40 # defaults
11073
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
41 : ${AWK=awk}
4783
7c75802f5a8b Add -h, -n, -r options.
Paul Eggert <eggert@twinsun.com>
parents: 4654
diff changeset
42 : ${TMPDIR=/tmp}
15911
c9a152ad9c5a Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents: 15742
diff changeset
43 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
44 datearg= # rlog date option
4783
7c75802f5a8b Add -h, -n, -r options.
Paul Eggert <eggert@twinsun.com>
parents: 4654
diff changeset
45 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
46 indent=8 # indent of log line
6f7abc0e1f10 Add -i, -l, -t.
Paul Eggert <eggert@twinsun.com>
parents: 527
diff changeset
47 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
48 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
49 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
50 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
51 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
52 revision= # t if we want revision numbers
4783
7c75802f5a8b Add -h, -n, -r options.
Paul Eggert <eggert@twinsun.com>
parents: 4654
diff changeset
53 rlog_options= # options to pass to rlog
534
6f7abc0e1f10 Add -i, -l, -t.
Paul Eggert <eggert@twinsun.com>
parents: 527
diff changeset
54 tabwidth=8 # width of horizontal tab
6f7abc0e1f10 Add -i, -l, -t.
Paul Eggert <eggert@twinsun.com>
parents: 527
diff changeset
55
6f7abc0e1f10 Add -i, -l, -t.
Paul Eggert <eggert@twinsun.com>
parents: 527
diff changeset
56 while :
6f7abc0e1f10 Add -i, -l, -t.
Paul Eggert <eggert@twinsun.com>
parents: 527
diff changeset
57 do
6f7abc0e1f10 Add -i, -l, -t.
Paul Eggert <eggert@twinsun.com>
parents: 527
diff changeset
58 case $1 in
15911
c9a152ad9c5a Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents: 15742
diff changeset
59 -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
60 -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
61 -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
62 -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
63 -[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
64 case $1 in
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
65 -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
66 *"$tab"* | *"$nl"*)
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
67 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
68 exit 1
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
69 esac
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
70 loginFullnameMailaddrs=$loginFullnameMailaddrs$nl$2$tab$3$tab$4
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
71 shift; shift; shift;;
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
72 -u)
11082
aee85fcd9d25 Treat -u 'LOGIN:FULLNAME:MAILADDR' as if it were
Paul Eggert <eggert@twinsun.com>
parents: 11073
diff changeset
73 # 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
74 case ${2?} in
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
75 *"$nl"*)
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
76 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
77 exit 1;;
11082
aee85fcd9d25 Treat -u 'LOGIN:FULLNAME:MAILADDR' as if it were
Paul Eggert <eggert@twinsun.com>
parents: 11073
diff changeset
78 *"$tab"*)
aee85fcd9d25 Treat -u 'LOGIN:FULLNAME:MAILADDR' as if it were
Paul Eggert <eggert@twinsun.com>
parents: 11073
diff changeset
79 t=$tab;;
aee85fcd9d25 Treat -u 'LOGIN:FULLNAME:MAILADDR' as if it were
Paul Eggert <eggert@twinsun.com>
parents: 11073
diff changeset
80 *)
aee85fcd9d25 Treat -u 'LOGIN:FULLNAME:MAILADDR' as if it were
Paul Eggert <eggert@twinsun.com>
parents: 11073
diff changeset
81 t=:
aee85fcd9d25 Treat -u 'LOGIN:FULLNAME:MAILADDR' as if it were
Paul Eggert <eggert@twinsun.com>
parents: 11073
diff changeset
82 esac
aee85fcd9d25 Treat -u 'LOGIN:FULLNAME:MAILADDR' as if it were
Paul Eggert <eggert@twinsun.com>
parents: 11073
diff changeset
83 case $2 in
aee85fcd9d25 Treat -u 'LOGIN:FULLNAME:MAILADDR' as if it were
Paul Eggert <eggert@twinsun.com>
parents: 11073
diff changeset
84 *"$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
85 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
86 exit 1;;
11082
aee85fcd9d25 Treat -u 'LOGIN:FULLNAME:MAILADDR' as if it were
Paul Eggert <eggert@twinsun.com>
parents: 11073
diff changeset
87 *"$t"*"$t"*)
11073
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
88 ;;
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
89 *)
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: -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
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
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
93 loginFullnameMailaddrs=$loginFullnameMailaddrs$nl$2
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
94 shift
4783
7c75802f5a8b Add -h, -n, -r options.
Paul Eggert <eggert@twinsun.com>
parents: 4654
diff changeset
95 esac
11073
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
96 logins=$logins$nl$login
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
97 ;;
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
98 -r) rlog_options=$rlog_options$nl${2?}; shift;;
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
99 -R) recursive=t;;
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
100 -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
101 -v) revision=t;;
4783
7c75802f5a8b Add -h, -n, -r options.
Paul Eggert <eggert@twinsun.com>
parents: 4654
diff changeset
102 -*) echo >&2 "$0: usage: $0 [options] [file ...]
7c75802f5a8b Add -h, -n, -r options.
Paul Eggert <eggert@twinsun.com>
parents: 4654
diff changeset
103 Options:
15911
c9a152ad9c5a Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents: 15742
diff changeset
104 [-c changelog] [-h hostname] [-i indent] [-l length] [-R]
c9a152ad9c5a Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents: 15742
diff changeset
105 [-r rlog_option] [-t tabwidth] [-v]
c9a152ad9c5a Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents: 15742
diff changeset
106 [-u 'login<TAB>fullname<TAB>mailaddr']..."
534
6f7abc0e1f10 Add -i, -l, -t.
Paul Eggert <eggert@twinsun.com>
parents: 527
diff changeset
107 exit 1;;
6f7abc0e1f10 Add -i, -l, -t.
Paul Eggert <eggert@twinsun.com>
parents: 527
diff changeset
108 *) break
6f7abc0e1f10 Add -i, -l, -t.
Paul Eggert <eggert@twinsun.com>
parents: 527
diff changeset
109 esac
11073
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
110 shift
534
6f7abc0e1f10 Add -i, -l, -t.
Paul Eggert <eggert@twinsun.com>
parents: 527
diff changeset
111 done
6f7abc0e1f10 Add -i, -l, -t.
Paul Eggert <eggert@twinsun.com>
parents: 527
diff changeset
112
2220
66371f0b8aff Some awks don't understand "\r". Code around this.
Paul Eggert <eggert@twinsun.com>
parents: 1800
diff changeset
113 month_data='
66371f0b8aff Some awks don't understand "\r". Code around this.
Paul Eggert <eggert@twinsun.com>
parents: 1800
diff changeset
114 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
115 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
116 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
117 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
118 '
66371f0b8aff Some awks don't understand "\r". Code around this.
Paul Eggert <eggert@twinsun.com>
parents: 1800
diff changeset
119
534
6f7abc0e1f10 Add -i, -l, -t.
Paul Eggert <eggert@twinsun.com>
parents: 527
diff changeset
120
11627
2f0766bf8315 (datearg): If rlog options are specified explicitly,
Paul Eggert <eggert@twinsun.com>
parents: 11099
diff changeset
121 # Put rlog output into $rlogout.
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
122
11627
2f0766bf8315 (datearg): If rlog options are specified explicitly,
Paul Eggert <eggert@twinsun.com>
parents: 11099
diff changeset
123 # If no rlog options are given,
2f0766bf8315 (datearg): If rlog options are specified explicitly,
Paul Eggert <eggert@twinsun.com>
parents: 11099
diff changeset
124 # 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
125 # 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
126 # 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
127 case $rlog_options in
2f0766bf8315 (datearg): If rlog options are specified explicitly,
Paul Eggert <eggert@twinsun.com>
parents: 11099
diff changeset
128 '')
15911
c9a152ad9c5a Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents: 15742
diff changeset
129 if test -s "$changelog"
11627
2f0766bf8315 (datearg): If rlog options are specified explicitly,
Paul Eggert <eggert@twinsun.com>
parents: 11099
diff changeset
130 then
2f0766bf8315 (datearg): If rlog options are specified explicitly,
Paul Eggert <eggert@twinsun.com>
parents: 11099
diff changeset
131 e='
15911
c9a152ad9c5a Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents: 15742
diff changeset
132 /^[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
133 # ISO 8601 date
c9a152ad9c5a Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents: 15742
diff changeset
134 print $1
c9a152ad9c5a Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents: 15742
diff changeset
135 exit
c9a152ad9c5a Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents: 15742
diff changeset
136 }
11627
2f0766bf8315 (datearg): If rlog options are specified explicitly,
Paul Eggert <eggert@twinsun.com>
parents: 11099
diff changeset
137 /^... ... [ 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
138 # 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
139 '"$month_data"'
2f0766bf8315 (datearg): If rlog options are specified explicitly,
Paul Eggert <eggert@twinsun.com>
parents: 11099
diff changeset
140 year = $5
2f0766bf8315 (datearg): If rlog options are specified explicitly,
Paul Eggert <eggert@twinsun.com>
parents: 11099
diff changeset
141 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
142 dd = $3
15911
c9a152ad9c5a Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents: 15742
diff changeset
143 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
144 exit
2220
66371f0b8aff Some awks don't understand "\r". Code around this.
Paul Eggert <eggert@twinsun.com>
parents: 1800
diff changeset
145 }
11627
2f0766bf8315 (datearg): If rlog options are specified explicitly,
Paul Eggert <eggert@twinsun.com>
parents: 11099
diff changeset
146 '
15911
c9a152ad9c5a Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents: 15742
diff changeset
147 d=`$AWK "$e" <"$changelog"` || exit
11627
2f0766bf8315 (datearg): If rlog options are specified explicitly,
Paul Eggert <eggert@twinsun.com>
parents: 11099
diff changeset
148 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
149 ?*) datearg="-d>$d"
11627
2f0766bf8315 (datearg): If rlog options are specified explicitly,
Paul Eggert <eggert@twinsun.com>
parents: 11099
diff changeset
150 esac
2f0766bf8315 (datearg): If rlog options are specified explicitly,
Paul Eggert <eggert@twinsun.com>
parents: 11099
diff changeset
151 fi
2f0766bf8315 (datearg): If rlog options are specified explicitly,
Paul Eggert <eggert@twinsun.com>
parents: 11099
diff changeset
152 esac
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
153
15911
c9a152ad9c5a Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents: 15742
diff changeset
154 # 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
155 if test -s "$changelog"
c9a152ad9c5a Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents: 15742
diff changeset
156 then
c9a152ad9c5a Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents: 15742
diff changeset
157 extractTZ='
c9a152ad9c5a Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents: 15742
diff changeset
158 /^.*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
159 s//\1/; p; q
c9a152ad9c5a Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents: 15742
diff changeset
160 }
c9a152ad9c5a Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents: 15742
diff changeset
161 /^.*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
162 s//UTC0/; p; q
c9a152ad9c5a Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents: 15742
diff changeset
163 }
c9a152ad9c5a Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents: 15742
diff changeset
164 '
c9a152ad9c5a Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents: 15742
diff changeset
165 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
166 case $logTZ in
c9a152ad9c5a Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents: 15742
diff changeset
167 ?*) TZ=$logTZ; export TZ
c9a152ad9c5a Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents: 15742
diff changeset
168 esac
c9a152ad9c5a Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents: 15742
diff changeset
169 fi
c9a152ad9c5a Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents: 15742
diff changeset
170
11627
2f0766bf8315 (datearg): If rlog options are specified explicitly,
Paul Eggert <eggert@twinsun.com>
parents: 11099
diff changeset
171 # 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
172 if test ! -f CVS/Repository
2f0766bf8315 (datearg): If rlog options are specified explicitly,
Paul Eggert <eggert@twinsun.com>
parents: 11099
diff changeset
173 then
2f0766bf8315 (datearg): If rlog options are specified explicitly,
Paul Eggert <eggert@twinsun.com>
parents: 11099
diff changeset
174 rlog=rlog
2f0766bf8315 (datearg): If rlog options are specified explicitly,
Paul Eggert <eggert@twinsun.com>
parents: 11099
diff changeset
175 repository=
2f0766bf8315 (datearg): If rlog options are specified explicitly,
Paul Eggert <eggert@twinsun.com>
parents: 11099
diff changeset
176 else
2f0766bf8315 (datearg): If rlog options are specified explicitly,
Paul Eggert <eggert@twinsun.com>
parents: 11099
diff changeset
177 rlog='cvs log'
2f0766bf8315 (datearg): If rlog options are specified explicitly,
Paul Eggert <eggert@twinsun.com>
parents: 11099
diff changeset
178 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
179 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
180 case $CVSROOT in
12408
67f759e94c3e (CVSROOT, repository): Allow remote repositories a la CVS 1.4.
Paul Eggert <eggert@twinsun.com>
parents: 12066
diff changeset
181 *:/*)
67f759e94c3e (CVSROOT, repository): Allow remote repositories a la CVS 1.4.
Paul Eggert <eggert@twinsun.com>
parents: 12066
diff changeset
182 # remote repository
67f759e94c3e (CVSROOT, repository): Allow remote repositories a la CVS 1.4.
Paul Eggert <eggert@twinsun.com>
parents: 12066
diff changeset
183 ;;
67f759e94c3e (CVSROOT, repository): Allow remote repositories a la CVS 1.4.
Paul Eggert <eggert@twinsun.com>
parents: 12066
diff changeset
184 *)
67f759e94c3e (CVSROOT, repository): Allow remote repositories a la CVS 1.4.
Paul Eggert <eggert@twinsun.com>
parents: 12066
diff changeset
185 # local repository
67f759e94c3e (CVSROOT, repository): Allow remote repositories a la CVS 1.4.
Paul Eggert <eggert@twinsun.com>
parents: 12066
diff changeset
186 case $repository in
67f759e94c3e (CVSROOT, repository): Allow remote repositories a la CVS 1.4.
Paul Eggert <eggert@twinsun.com>
parents: 12066
diff changeset
187 /*) ;;
12509
68a8bae7a172 (datearg): Separate date from time with comma, not space,
Paul Eggert <eggert@twinsun.com>
parents: 12507
diff changeset
188 *) repository=${CVSROOT?}/$repository
12408
67f759e94c3e (CVSROOT, repository): Allow remote repositories a la CVS 1.4.
Paul Eggert <eggert@twinsun.com>
parents: 12066
diff changeset
189 esac
67f759e94c3e (CVSROOT, repository): Allow remote repositories a la CVS 1.4.
Paul Eggert <eggert@twinsun.com>
parents: 12066
diff changeset
190 if test ! -d "$repository"
67f759e94c3e (CVSROOT, repository): Allow remote repositories a la CVS 1.4.
Paul Eggert <eggert@twinsun.com>
parents: 12066
diff changeset
191 then
67f759e94c3e (CVSROOT, repository): Allow remote repositories a la CVS 1.4.
Paul Eggert <eggert@twinsun.com>
parents: 12066
diff changeset
192 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
193 exit 1
67f759e94c3e (CVSROOT, repository): Allow remote repositories a la CVS 1.4.
Paul Eggert <eggert@twinsun.com>
parents: 12066
diff changeset
194 fi
11627
2f0766bf8315 (datearg): If rlog options are specified explicitly,
Paul Eggert <eggert@twinsun.com>
parents: 11099
diff changeset
195 esac
2f0766bf8315 (datearg): If rlog options are specified explicitly,
Paul Eggert <eggert@twinsun.com>
parents: 11099
diff changeset
196 fi
8549
12b36ece5c25 Add support for CVS.
Paul Eggert <eggert@twinsun.com>
parents: 8496
diff changeset
197
16332
be25bd9150e8 (rlog_options): Use $rlog, not rlog, when deciding whether to append -zLT.
Paul Eggert <eggert@twinsun.com>
parents: 15937
diff changeset
198 # 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
199 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
200 *' option'*) ;;
16332
be25bd9150e8 (rlog_options): Use $rlog, not rlog, when deciding whether to append -zLT.
Paul Eggert <eggert@twinsun.com>
parents: 15937
diff changeset
201 *) rlog_options=-zLT$nl$rlog_options
be25bd9150e8 (rlog_options): Use $rlog, not rlog, when deciding whether to append -zLT.
Paul Eggert <eggert@twinsun.com>
parents: 15937
diff changeset
202 esac
be25bd9150e8 (rlog_options): Use $rlog, not rlog, when deciding whether to append -zLT.
Paul Eggert <eggert@twinsun.com>
parents: 15937
diff changeset
203
3248
9ee93fc9aba0 When given no file arguments, inspect RCS/.* as well
Richard M. Stallman <rms@gnu.org>
parents: 2639
diff changeset
204 # 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
205 case $# in
9ee93fc9aba0 When given no file arguments, inspect RCS/.* as well
Richard M. Stallman <rms@gnu.org>
parents: 2639
diff changeset
206 0)
8549
12b36ece5c25 Add support for CVS.
Paul Eggert <eggert@twinsun.com>
parents: 8496
diff changeset
207 case $repository in
12b36ece5c25 Add support for CVS.
Paul Eggert <eggert@twinsun.com>
parents: 8496
diff changeset
208 '')
12b36ece5c25 Add support for CVS.
Paul Eggert <eggert@twinsun.com>
parents: 8496
diff changeset
209 oldIFS=$IFS
12b36ece5c25 Add support for CVS.
Paul Eggert <eggert@twinsun.com>
parents: 8496
diff changeset
210 IFS=$nl
11073
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
211 case $recursive in
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
212 t)
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
213 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
214 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
215 files=`
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
216 {
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
217 case $RCSdirs in
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
218 ?*) find $RCSdirs -type f -print
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
219 esac
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
220 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
221 } |
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
222 sort -u |
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
223 sed "$filesFromRCSfiles"
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
224 `;;
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
225 *)
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
226 files=
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
227 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
228 do
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
229 case $file in
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
230 RCS/. | RCS/..) continue;;
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
231 RCS/.\* | RCS/\* | .\*,v | \*,v) test -f "$file" || continue
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
232 esac
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
233 files=$files$nl$file
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
234 done
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
235 case $files in
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
236 '') exit 0
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
237 esac
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
238 esac
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
239 set x $files
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
240 shift
8549
12b36ece5c25 Add support for CVS.
Paul Eggert <eggert@twinsun.com>
parents: 8496
diff changeset
241 IFS=$oldIFS
3248
9ee93fc9aba0 When given no file arguments, inspect RCS/.* as well
Richard M. Stallman <rms@gnu.org>
parents: 2639
diff changeset
242 esac
9ee93fc9aba0 When given no file arguments, inspect RCS/.* as well
Richard M. Stallman <rms@gnu.org>
parents: 2639
diff changeset
243 esac
9ee93fc9aba0 When given no file arguments, inspect RCS/.* as well
Richard M. Stallman <rms@gnu.org>
parents: 2639
diff changeset
244
11073
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
245 llogout=$TMPDIR/rcs2log$$l
4783
7c75802f5a8b Add -h, -n, -r options.
Paul Eggert <eggert@twinsun.com>
parents: 4654
diff changeset
246 rlogout=$TMPDIR/rcs2log$$r
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
247 trap exit 1 2 13 15
11073
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
248 trap "rm -f $llogout $rlogout; exit 1" 0
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
249
15911
c9a152ad9c5a Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents: 15742
diff changeset
250 case $datearg in
c9a152ad9c5a Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents: 15742
diff changeset
251 ?*) $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
252 '') $rlog $rlog_options ${1+"$@"} >$rlogout
11627
2f0766bf8315 (datearg): If rlog options are specified explicitly,
Paul Eggert <eggert@twinsun.com>
parents: 11099
diff changeset
253 esac || exit
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
254
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
255
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
256 # 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
257 # to awk code that initializes the `fullname' awk associative array.
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
258 # Warning: foreign authors (i.e. not known in the passwd file) are mishandled;
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
259 # you have to fix the resulting output by hand.
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
260
11073
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
261 initialize_fullname=
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
262 initialize_mailaddr=
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
263
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
264 case $loginFullnameMailaddrs in
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
265 ?*)
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
266 case $loginFullnameMailaddrs in
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
267 *\"* | *\\*)
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
268 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
269 $loginFullnameMailaddrs
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
270 EOF
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
271 loginFullnameMailaddrs=`cat $llogout`
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
272 esac
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 oldIFS=$IFS
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
275 IFS=$nl
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
276 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
277 do
11082
aee85fcd9d25 Treat -u 'LOGIN:FULLNAME:MAILADDR' as if it were
Paul Eggert <eggert@twinsun.com>
parents: 11073
diff changeset
278 case $loginFullnameMailaddr in
aee85fcd9d25 Treat -u 'LOGIN:FULLNAME:MAILADDR' as if it were
Paul Eggert <eggert@twinsun.com>
parents: 11073
diff changeset
279 *"$tab"*) IFS=$tab;;
aee85fcd9d25 Treat -u 'LOGIN:FULLNAME:MAILADDR' as if it were
Paul Eggert <eggert@twinsun.com>
parents: 11073
diff changeset
280 *) IFS=:
aee85fcd9d25 Treat -u 'LOGIN:FULLNAME:MAILADDR' as if it were
Paul Eggert <eggert@twinsun.com>
parents: 11073
diff changeset
281 esac
11073
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
282 set x $loginFullnameMailaddr
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
283 login=$2
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
284 fullname=$3
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
285 mailaddr=$4
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
286 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
287 fullname[\"$login\"] = \"$fullname\""
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
288 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
289 mailaddr[\"$login\"] = \"$mailaddr\""
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
290 done
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
291 IFS=$oldIFS
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
292 esac
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
293
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
294 case $llogout in
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
295 ?*) sort -u -o $llogout <<EOF || exit
4783
7c75802f5a8b Add -h, -n, -r options.
Paul Eggert <eggert@twinsun.com>
parents: 4654
diff changeset
296 $logins
7c75802f5a8b Add -h, -n, -r options.
Paul Eggert <eggert@twinsun.com>
parents: 4654
diff changeset
297 EOF
7c75802f5a8b Add -h, -n, -r options.
Paul Eggert <eggert@twinsun.com>
parents: 4654
diff changeset
298 esac
11073
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
299 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
300 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
301 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
302 }
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
303 }'
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
304 authors=`
11073
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
305 $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
306 case $llogout in
4783
7c75802f5a8b Add -h, -n, -r options.
Paul Eggert <eggert@twinsun.com>
parents: 4654
diff changeset
307 '') sort -u;;
11073
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
308 ?*) sort -u | comm -23 - $llogout
4783
7c75802f5a8b Add -h, -n, -r options.
Paul Eggert <eggert@twinsun.com>
parents: 4654
diff changeset
309 esac
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
310 `
640
36e7f4e402bd Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents: 636
diff changeset
311 case $authors in
36e7f4e402bd Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents: 636
diff changeset
312 ?*)
11073
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
313 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
314 $authors
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
315 EOF
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
316 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
317 initialize_author=`sed -e "$initialize_author_script" <$llogout`
640
36e7f4e402bd Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents: 636
diff changeset
318 awkscript='
36e7f4e402bd Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents: 636
diff changeset
319 BEGIN {
36e7f4e402bd Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents: 636
diff changeset
320 alphabet = "abcdefghijklmnopqrstuvwxyz"
36e7f4e402bd Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents: 636
diff changeset
321 ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
36e7f4e402bd Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents: 636
diff changeset
322 '"$initialize_author"'
36e7f4e402bd Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents: 636
diff changeset
323 }
36e7f4e402bd Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents: 636
diff changeset
324 {
36e7f4e402bd Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents: 636
diff changeset
325 if (author[$1]) {
36e7f4e402bd Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents: 636
diff changeset
326 fullname = $5
4504
65ef94a9e2c4 (awkscript): Some sites put comma-separated junk after the fullname.
Paul Eggert <eggert@twinsun.com>
parents: 3248
diff changeset
327 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
328 # 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
329 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
330 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
331 }
65ef94a9e2c4 (awkscript): Some sites put comma-separated junk after the fullname.
Paul Eggert <eggert@twinsun.com>
parents: 3248
diff changeset
332 if (fullname ~ /,[^ ]/) {
65ef94a9e2c4 (awkscript): Some sites put comma-separated junk after the fullname.
Paul Eggert <eggert@twinsun.com>
parents: 3248
diff changeset
333 # 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
334 # 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
335 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
336 }
640
36e7f4e402bd Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents: 636
diff changeset
337 abbr = index(fullname, "&")
36e7f4e402bd Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents: 636
diff changeset
338 if (abbr) {
36e7f4e402bd Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents: 636
diff changeset
339 a = substr($1, 1, 1)
36e7f4e402bd Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents: 636
diff changeset
340 A = a
36e7f4e402bd Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents: 636
diff changeset
341 i = index(alphabet, a)
36e7f4e402bd Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents: 636
diff changeset
342 if (i) A = substr(ALPHABET, i, 1)
36e7f4e402bd Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents: 636
diff changeset
343 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
344 }
11073
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
345
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
346 # 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
347 # 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
348 quoted = ""
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
349 rest = fullname
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
350 for (;;) {
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
351 p = index(rest, "\\")
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
352 q = index(rest, "\"")
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
353 if (p) {
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
354 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
355 } else {
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
356 if (!q) break
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
357 p = q
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
358 }
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
359 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
360 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
361 }
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 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
364 author[$1] = 0
36e7f4e402bd Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents: 636
diff changeset
365 }
36e7f4e402bd Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents: 636
diff changeset
366 }
36e7f4e402bd Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents: 636
diff changeset
367 '
36e7f4e402bd Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents: 636
diff changeset
368
36e7f4e402bd Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents: 636
diff changeset
369 initialize_fullname=`
14173
940083ef25b9 (initialize_fullname): Add support for NIS+.
Paul Eggert <eggert@twinsun.com>
parents: 12509
diff changeset
370 (
940083ef25b9 (initialize_fullname): Add support for NIS+.
Paul Eggert <eggert@twinsun.com>
parents: 12509
diff changeset
371 cat /etc/passwd
940083ef25b9 (initialize_fullname): Add support for NIS+.
Paul Eggert <eggert@twinsun.com>
parents: 12509
diff changeset
372 for author in $authors
940083ef25b9 (initialize_fullname): Add support for NIS+.
Paul Eggert <eggert@twinsun.com>
parents: 12509
diff changeset
373 do nismatch $author passwd.org_dir
940083ef25b9 (initialize_fullname): Add support for NIS+.
Paul Eggert <eggert@twinsun.com>
parents: 12509
diff changeset
374 done
940083ef25b9 (initialize_fullname): Add support for NIS+.
Paul Eggert <eggert@twinsun.com>
parents: 12509
diff changeset
375 ypmatch $authors passwd
940083ef25b9 (initialize_fullname): Add support for NIS+.
Paul Eggert <eggert@twinsun.com>
parents: 12509
diff changeset
376 ) 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
377 $AWK -F: "$awkscript"
4783
7c75802f5a8b Add -h, -n, -r options.
Paul Eggert <eggert@twinsun.com>
parents: 4654
diff changeset
378 `$initialize_fullname
640
36e7f4e402bd Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents: 636
diff changeset
379 esac
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
380
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
381
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
382 # Function to print a single log line.
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
383 # We don't use awk functions, to stay compatible with old awk versions.
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
384 # `Log' is the log message (with \n replaced by \r).
594
efa0c124c178 Add clumpname support.
Paul Eggert <eggert@twinsun.com>
parents: 535
diff changeset
385 # `files' contains the affected files.
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
386 printlogline='{
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
387
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
388 # Following the GNU coding standards, rewrite
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
389 # * file: (function): comment
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
390 # to
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
391 # * file (function): comment
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
392 if (Log ~ /^\([^)]*\): /) {
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
393 i = index(Log, ")")
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
394 files = files " " substr(Log, 1, i)
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
395 Log = substr(Log, i+3)
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
396 }
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
397
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
398 # If "label: comment" is too long, break the line after the ":".
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
399 sep = " "
2220
66371f0b8aff Some awks don't understand "\r". Code around this.
Paul Eggert <eggert@twinsun.com>
parents: 1800
diff changeset
400 if ('"$length"' <= '"$indent"' + 1 + length(files) + index(Log, CR)) sep = "\n" indent_string
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
401
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
402 # Print the label.
534
6f7abc0e1f10 Add -i, -l, -t.
Paul Eggert <eggert@twinsun.com>
parents: 527
diff changeset
403 printf "%s*%s:", indent_string, files
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
404
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
405 # Print each line of the log, transliterating \r to \n.
2220
66371f0b8aff Some awks don't understand "\r". Code around this.
Paul Eggert <eggert@twinsun.com>
parents: 1800
diff changeset
406 while ((i = index(Log, CR)) != 0) {
4858
5b4f9564bfaf (printlogline): Don't generate lines containing only white space.
Paul Eggert <eggert@twinsun.com>
parents: 4783
diff changeset
407 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
408 if (logline ~ /[^'"$tab"' ]/) {
4858
5b4f9564bfaf (printlogline): Don't generate lines containing only white space.
Paul Eggert <eggert@twinsun.com>
parents: 4783
diff changeset
409 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
410 } else {
5b4f9564bfaf (printlogline): Don't generate lines containing only white space.
Paul Eggert <eggert@twinsun.com>
parents: 4783
diff changeset
411 print ""
5b4f9564bfaf (printlogline): Don't generate lines containing only white space.
Paul Eggert <eggert@twinsun.com>
parents: 4783
diff changeset
412 }
534
6f7abc0e1f10 Add -i, -l, -t.
Paul Eggert <eggert@twinsun.com>
parents: 527
diff changeset
413 sep = indent_string
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
414 Log = substr(Log, i+1)
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
415 }
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
416 }'
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
417
15911
c9a152ad9c5a Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents: 15742
diff changeset
418 # 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
419 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
420
4783
7c75802f5a8b Add -h, -n, -r options.
Paul Eggert <eggert@twinsun.com>
parents: 4654
diff changeset
421 case $hostname in
7c75802f5a8b Add -h, -n, -r options.
Paul Eggert <eggert@twinsun.com>
parents: 4654
diff changeset
422 '')
7c75802f5a8b Add -h, -n, -r options.
Paul Eggert <eggert@twinsun.com>
parents: 4654
diff changeset
423 hostname=`(
7c75802f5a8b Add -h, -n, -r options.
Paul Eggert <eggert@twinsun.com>
parents: 4654
diff changeset
424 hostname || uname -n || uuname -l || cat /etc/whoami
7c75802f5a8b Add -h, -n, -r options.
Paul Eggert <eggert@twinsun.com>
parents: 4654
diff changeset
425 ) 2>/dev/null` || {
7c75802f5a8b Add -h, -n, -r options.
Paul Eggert <eggert@twinsun.com>
parents: 4654
diff changeset
426 echo >&2 "$0: cannot deduce hostname"
7c75802f5a8b Add -h, -n, -r options.
Paul Eggert <eggert@twinsun.com>
parents: 4654
diff changeset
427 exit 1
7c75802f5a8b Add -h, -n, -r options.
Paul Eggert <eggert@twinsun.com>
parents: 4654
diff changeset
428 }
14173
940083ef25b9 (initialize_fullname): Add support for NIS+.
Paul Eggert <eggert@twinsun.com>
parents: 12509
diff changeset
429
940083ef25b9 (initialize_fullname): Add support for NIS+.
Paul Eggert <eggert@twinsun.com>
parents: 12509
diff changeset
430 case $hostname in
940083ef25b9 (initialize_fullname): Add support for NIS+.
Paul Eggert <eggert@twinsun.com>
parents: 12509
diff changeset
431 *.*) ;;
940083ef25b9 (initialize_fullname): Add support for NIS+.
Paul Eggert <eggert@twinsun.com>
parents: 12509
diff changeset
432 *)
940083ef25b9 (initialize_fullname): Add support for NIS+.
Paul Eggert <eggert@twinsun.com>
parents: 12509
diff changeset
433 domainname=`(domainname) 2>/dev/null` &&
940083ef25b9 (initialize_fullname): Add support for NIS+.
Paul Eggert <eggert@twinsun.com>
parents: 12509
diff changeset
434 case $domainname in
940083ef25b9 (initialize_fullname): Add support for NIS+.
Paul Eggert <eggert@twinsun.com>
parents: 12509
diff changeset
435 *.*) hostname=$hostname.$domainname
940083ef25b9 (initialize_fullname): Add support for NIS+.
Paul Eggert <eggert@twinsun.com>
parents: 12509
diff changeset
436 esac
940083ef25b9 (initialize_fullname): Add support for NIS+.
Paul Eggert <eggert@twinsun.com>
parents: 12509
diff changeset
437 esac
4783
7c75802f5a8b Add -h, -n, -r options.
Paul Eggert <eggert@twinsun.com>
parents: 4654
diff changeset
438 esac
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
439
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
440
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
441 # Process the rlog output, generating ChangeLog style entries.
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
442
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
443 # First, reformat the rlog output so that each line contains one log entry.
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
444 # Transliterate \n to \r so that multiline entries fit on a single line.
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
445 # 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
446 $AWK <$rlogout '
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
447 BEGIN { repository = "'"$repository"'" }
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
448 /^RCS file:/ {
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
449 if (repository != "") {
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
450 filename = $3
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
451 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
452 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
453 }
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
454 if (filename ~ /,v$/) {
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
455 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
456 }
16507
08855b88e955 When processing cvs log output, remove `Attic/' from repository file names.
Paul Eggert <eggert@twinsun.com>
parents: 16438
diff changeset
457 if (filename ~ /(^|\/)Attic\/[^\/]*$/) {
08855b88e955 When processing cvs log output, remove `Attic/' from repository file names.
Paul Eggert <eggert@twinsun.com>
parents: 16438
diff changeset
458 i = length(filename)
08855b88e955 When processing cvs log output, remove `Attic/' from repository file names.
Paul Eggert <eggert@twinsun.com>
parents: 16438
diff changeset
459 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
460 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
461 }
11073
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
462 }
15911
c9a152ad9c5a Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents: 15742
diff changeset
463 rev = "?"
11073
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
464 }
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
465 /^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
466 /'"$rlog_revision_pattern"'/, /^(-----------*|===========*)$/ {
c9a152ad9c5a Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents: 15742
diff changeset
467 if ($0 ~ /'"$rlog_revision_pattern"'/) {
c9a152ad9c5a Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents: 15742
diff changeset
468 rev = $2
c9a152ad9c5a Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents: 15742
diff changeset
469 next
c9a152ad9c5a Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents: 15742
diff changeset
470 }
8549
12b36ece5c25 Add support for CVS.
Paul Eggert <eggert@twinsun.com>
parents: 8496
diff changeset
471 if ($0 ~ /^date: [0-9][- +\/0-9:]*;/) {
12b36ece5c25 Add support for CVS.
Paul Eggert <eggert@twinsun.com>
parents: 8496
diff changeset
472 date = $2
15911
c9a152ad9c5a Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents: 15742
diff changeset
473 if (date ~ /\//) {
c9a152ad9c5a Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents: 15742
diff changeset
474 # 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
475 # Replace "/"s with "-"s to get ISO format.
8549
12b36ece5c25 Add support for CVS.
Paul Eggert <eggert@twinsun.com>
parents: 8496
diff changeset
476 newdate = ""
15911
c9a152ad9c5a Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents: 15742
diff changeset
477 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
478 newdate = newdate substr(date, 1, i-1) "-"
8549
12b36ece5c25 Add support for CVS.
Paul Eggert <eggert@twinsun.com>
parents: 8496
diff changeset
479 date = substr(date, i+1)
12b36ece5c25 Add support for CVS.
Paul Eggert <eggert@twinsun.com>
parents: 8496
diff changeset
480 }
12b36ece5c25 Add support for CVS.
Paul Eggert <eggert@twinsun.com>
parents: 8496
diff changeset
481 date = newdate date
12b36ece5c25 Add support for CVS.
Paul Eggert <eggert@twinsun.com>
parents: 8496
diff changeset
482 }
15911
c9a152ad9c5a Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents: 15742
diff changeset
483 time = substr($3, 1, length($3) - 1)
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
484 author = substr($5, 1, length($5)-1)
15911
c9a152ad9c5a Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents: 15742
diff changeset
485 printf "%s %s %s %s %s %c", filename, rev, date, time, author, 13
c9a152ad9c5a Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents: 15742
diff changeset
486 rev = "?"
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
487 next
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
488 }
15911
c9a152ad9c5a Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents: 15742
diff changeset
489 if ($0 ~ /^branches: /) { next }
636
dce8cdbac0ea Ignore log messages that start with `#'.
Paul Eggert <eggert@twinsun.com>
parents: 602
diff changeset
490 if ($0 ~ /^(-----------*|===========*)$/) { print ""; next }
2220
66371f0b8aff Some awks don't understand "\r". Code around this.
Paul Eggert <eggert@twinsun.com>
parents: 1800
diff changeset
491 printf "%s%c", $0, 13
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
492 }
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
493 ' |
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
494
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
495 # Now each line is of the form
15911
c9a152ad9c5a Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents: 15742
diff changeset
496 # FILENAME REVISION YYYY-MM-DD HH:MM:SS[+-TIMEZONE] AUTHOR \rLOG
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
497 # where \r stands for a carriage return,
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
498 # and each line of the log is terminated by \r instead of \n.
640
36e7f4e402bd Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents: 636
diff changeset
499 # 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
500 # 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
501 # (just in case).
c9a152ad9c5a Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents: 15742
diff changeset
502 sort +2 -4r +4 +0 |
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
503
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
504 # 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
505 $AWK '
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
506 BEGIN {
15911
c9a152ad9c5a Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents: 15742
diff changeset
507 logTZ = "'"$logTZ"'"
c9a152ad9c5a Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents: 15742
diff changeset
508 revision = "'"$revision"'"
c9a152ad9c5a Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents: 15742
diff changeset
509
11627
2f0766bf8315 (datearg): If rlog options are specified explicitly,
Paul Eggert <eggert@twinsun.com>
parents: 11099
diff changeset
510 # Some awk variants do not understand "\r" or "\013", so we have to
2220
66371f0b8aff Some awks don't understand "\r". Code around this.
Paul Eggert <eggert@twinsun.com>
parents: 1800
diff changeset
511 # put a carriage return directly in the file.
66371f0b8aff Some awks don't understand "\r". Code around this.
Paul Eggert <eggert@twinsun.com>
parents: 1800
diff changeset
512 CR=" " # <-- There is a single CR between the " chars here.
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
513
4783
7c75802f5a8b Add -h, -n, -r options.
Paul Eggert <eggert@twinsun.com>
parents: 4654
diff changeset
514 # Initialize the fullname and mailaddr associative arrays.
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
515 '"$initialize_fullname"'
4783
7c75802f5a8b Add -h, -n, -r options.
Paul Eggert <eggert@twinsun.com>
parents: 4654
diff changeset
516 '"$initialize_mailaddr"'
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
517
534
6f7abc0e1f10 Add -i, -l, -t.
Paul Eggert <eggert@twinsun.com>
parents: 527
diff changeset
518 # Initialize indent string.
6f7abc0e1f10 Add -i, -l, -t.
Paul Eggert <eggert@twinsun.com>
parents: 527
diff changeset
519 indent_string = ""
6f7abc0e1f10 Add -i, -l, -t.
Paul Eggert <eggert@twinsun.com>
parents: 527
diff changeset
520 i = '"$indent"'
6f7abc0e1f10 Add -i, -l, -t.
Paul Eggert <eggert@twinsun.com>
parents: 527
diff changeset
521 if (0 < '"$tabwidth"')
6f7abc0e1f10 Add -i, -l, -t.
Paul Eggert <eggert@twinsun.com>
parents: 527
diff changeset
522 for (; '"$tabwidth"' <= i; i -= '"$tabwidth"')
6f7abc0e1f10 Add -i, -l, -t.
Paul Eggert <eggert@twinsun.com>
parents: 527
diff changeset
523 indent_string = indent_string "\t"
6f7abc0e1f10 Add -i, -l, -t.
Paul Eggert <eggert@twinsun.com>
parents: 527
diff changeset
524 while (1 <= i--)
6f7abc0e1f10 Add -i, -l, -t.
Paul Eggert <eggert@twinsun.com>
parents: 527
diff changeset
525 indent_string = indent_string " "
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
526 }
636
dce8cdbac0ea Ignore log messages that start with `#'.
Paul Eggert <eggert@twinsun.com>
parents: 602
diff changeset
527
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
528 {
2220
66371f0b8aff Some awks don't understand "\r". Code around this.
Paul Eggert <eggert@twinsun.com>
parents: 1800
diff changeset
529 newlog = substr($0, 1 + index($0, CR))
636
dce8cdbac0ea Ignore log messages that start with `#'.
Paul Eggert <eggert@twinsun.com>
parents: 602
diff changeset
530
dce8cdbac0ea Ignore log messages that start with `#'.
Paul Eggert <eggert@twinsun.com>
parents: 602
diff changeset
531 # Ignore log entries prefixed by "#".
dce8cdbac0ea Ignore log messages that start with `#'.
Paul Eggert <eggert@twinsun.com>
parents: 602
diff changeset
532 if (newlog ~ /^#/) { next }
dce8cdbac0ea Ignore log messages that start with `#'.
Paul Eggert <eggert@twinsun.com>
parents: 602
diff changeset
533
15911
c9a152ad9c5a Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents: 15742
diff changeset
534 if (Log != newlog || date != $3 || author != $5) {
594
efa0c124c178 Add clumpname support.
Paul Eggert <eggert@twinsun.com>
parents: 535
diff changeset
535
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
536 # The previous log and this log differ.
594
efa0c124c178 Add clumpname support.
Paul Eggert <eggert@twinsun.com>
parents: 535
diff changeset
537
efa0c124c178 Add clumpname support.
Paul Eggert <eggert@twinsun.com>
parents: 535
diff changeset
538 # Print the old log.
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
539 if (date != "") '"$printlogline"'
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
540
594
efa0c124c178 Add clumpname support.
Paul Eggert <eggert@twinsun.com>
parents: 535
diff changeset
541 # Logs that begin with "{clumpname} " should be grouped together,
efa0c124c178 Add clumpname support.
Paul Eggert <eggert@twinsun.com>
parents: 535
diff changeset
542 # and the clumpname should be removed.
efa0c124c178 Add clumpname support.
Paul Eggert <eggert@twinsun.com>
parents: 535
diff changeset
543 # Extract the new clumpname from the log header,
efa0c124c178 Add clumpname support.
Paul Eggert <eggert@twinsun.com>
parents: 535
diff changeset
544 # and use it to decide whether to output a blank line.
efa0c124c178 Add clumpname support.
Paul Eggert <eggert@twinsun.com>
parents: 535
diff changeset
545 newclumpname = ""
efa0c124c178 Add clumpname support.
Paul Eggert <eggert@twinsun.com>
parents: 535
diff changeset
546 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
547 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
548 if (newlog ~ /^\{[^'"$tab"' }]*}['"$tab"' ]/) {
594
efa0c124c178 Add clumpname support.
Paul Eggert <eggert@twinsun.com>
parents: 535
diff changeset
549 i = index(newlog, "}")
efa0c124c178 Add clumpname support.
Paul Eggert <eggert@twinsun.com>
parents: 535
diff changeset
550 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
551 while (substr(newlog, i+1) ~ /^['"$tab"' ]/) i++
594
efa0c124c178 Add clumpname support.
Paul Eggert <eggert@twinsun.com>
parents: 535
diff changeset
552 newlog = substr(newlog, i+1)
efa0c124c178 Add clumpname support.
Paul Eggert <eggert@twinsun.com>
parents: 535
diff changeset
553 if (clumpname == newclumpname) sep = ""
efa0c124c178 Add clumpname support.
Paul Eggert <eggert@twinsun.com>
parents: 535
diff changeset
554 }
efa0c124c178 Add clumpname support.
Paul Eggert <eggert@twinsun.com>
parents: 535
diff changeset
555 printf sep
efa0c124c178 Add clumpname support.
Paul Eggert <eggert@twinsun.com>
parents: 535
diff changeset
556 clumpname = newclumpname
efa0c124c178 Add clumpname support.
Paul Eggert <eggert@twinsun.com>
parents: 535
diff changeset
557
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
558 # Get ready for the next log.
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
559 Log = newlog
534
6f7abc0e1f10 Add -i, -l, -t.
Paul Eggert <eggert@twinsun.com>
parents: 527
diff changeset
560 if (files != "")
6f7abc0e1f10 Add -i, -l, -t.
Paul Eggert <eggert@twinsun.com>
parents: 527
diff changeset
561 for (i in filesknown)
6f7abc0e1f10 Add -i, -l, -t.
Paul Eggert <eggert@twinsun.com>
parents: 527
diff changeset
562 filesknown[i] = 0
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
563 files = ""
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
564 }
15911
c9a152ad9c5a Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents: 15742
diff changeset
565 if (date != $3 || author != $5) {
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
566 # The previous date+author and this date+author differ.
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
567 # 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
568 date = $3
c9a152ad9c5a Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents: 15742
diff changeset
569 time = $4
c9a152ad9c5a Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents: 15742
diff changeset
570 author = $5
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
571
15911
c9a152ad9c5a Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents: 15742
diff changeset
572 zone = ""
c9a152ad9c5a Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents: 15742
diff changeset
573 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
574 zone = " " substr(time, i)
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
575
15911
c9a152ad9c5a Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents: 15742
diff changeset
576 # Print "date[ timezone] fullname <email address>".
4783
7c75802f5a8b Add -h, -n, -r options.
Paul Eggert <eggert@twinsun.com>
parents: 4654
diff changeset
577 # Get fullname and email address from associative arrays;
7c75802f5a8b Add -h, -n, -r options.
Paul Eggert <eggert@twinsun.com>
parents: 4654
diff changeset
578 # 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
579 if (fullname[author])
4783
7c75802f5a8b Add -h, -n, -r options.
Paul Eggert <eggert@twinsun.com>
parents: 4654
diff changeset
580 auth = fullname[author]
534
6f7abc0e1f10 Add -i, -l, -t.
Paul Eggert <eggert@twinsun.com>
parents: 527
diff changeset
581 else
4783
7c75802f5a8b Add -h, -n, -r options.
Paul Eggert <eggert@twinsun.com>
parents: 4654
diff changeset
582 auth = author
15911
c9a152ad9c5a Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents: 15742
diff changeset
583 printf "%s%s %s ", date, zone, auth
4783
7c75802f5a8b Add -h, -n, -r options.
Paul Eggert <eggert@twinsun.com>
parents: 4654
diff changeset
584 if (mailaddr[author])
8496
2dba6eb73c65 Use <> to delimit email address.
Richard M. Stallman <rms@gnu.org>
parents: 4858
diff changeset
585 printf "<%s>\n\n", mailaddr[author]
4783
7c75802f5a8b Add -h, -n, -r options.
Paul Eggert <eggert@twinsun.com>
parents: 4654
diff changeset
586 else
8496
2dba6eb73c65 Use <> to delimit email address.
Richard M. Stallman <rms@gnu.org>
parents: 4858
diff changeset
587 printf "<%s@%s>\n\n", author, "'"$hostname"'"
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
588 }
534
6f7abc0e1f10 Add -i, -l, -t.
Paul Eggert <eggert@twinsun.com>
parents: 527
diff changeset
589 if (! filesknown[$1]) {
6f7abc0e1f10 Add -i, -l, -t.
Paul Eggert <eggert@twinsun.com>
parents: 527
diff changeset
590 filesknown[$1] = 1
594
efa0c124c178 Add clumpname support.
Paul Eggert <eggert@twinsun.com>
parents: 535
diff changeset
591 if (files == "") files = " " $1
efa0c124c178 Add clumpname support.
Paul Eggert <eggert@twinsun.com>
parents: 535
diff changeset
592 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
593 if (revision && $2 != "?") files = files " " $2
534
6f7abc0e1f10 Add -i, -l, -t.
Paul Eggert <eggert@twinsun.com>
parents: 527
diff changeset
594 }
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
595 }
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
596 END {
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
597 # Print the last log.
594
efa0c124c178 Add clumpname support.
Paul Eggert <eggert@twinsun.com>
parents: 535
diff changeset
598 if (date != "") {
efa0c124c178 Add clumpname support.
Paul Eggert <eggert@twinsun.com>
parents: 535
diff changeset
599 '"$printlogline"'
efa0c124c178 Add clumpname support.
Paul Eggert <eggert@twinsun.com>
parents: 535
diff changeset
600 printf "\n"
efa0c124c178 Add clumpname support.
Paul Eggert <eggert@twinsun.com>
parents: 535
diff changeset
601 }
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
602 }
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
603 ' &&
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
604
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
605
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
606 # Exit successfully.
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
607
11073
554c86f77db0 Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
parents: 8549
diff changeset
608 exec rm -f $llogout $rlogout
15911
c9a152ad9c5a Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents: 15742
diff changeset
609
c9a152ad9c5a Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents: 15742
diff changeset
610 # Local Variables:
c9a152ad9c5a Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents: 15742
diff changeset
611 # tab-width:4
c9a152ad9c5a Use ISO 8601 date format, with time zone appended if
Erik Naggum <erik@naggum.no>
parents: 15742
diff changeset
612 # End: