annotate lib-src/=rcs2log @ 12414:cbe404298013

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