annotate lib-src/=rcs2log @ 10578:2a05710649fc

(ECHOBUFSIZE): New constant, replaces sizeof (echobuf).
author Karl Heuer <kwzh@gnu.org>
date Sat, 28 Jan 1995 02:51:29 +0000
parents 12b36ece5c25
children 554c86f77db0
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
8549
12b36ece5c25 Add support for CVS.
Paul Eggert <eggert@twinsun.com>
parents: 8496
diff changeset
15 # $Id: rcs2log,v 1.17 1994/08/09 20:43:48 rms Exp eggert $
1800
05cb79ebdb23 Add copyright and authorship notices.
Paul Eggert <eggert@twinsun.com>
parents: 1228
diff changeset
16
05cb79ebdb23 Add copyright and authorship notices.
Paul Eggert <eggert@twinsun.com>
parents: 1228
diff changeset
17 # Copyright 1992, 1993 Free Software Foundation, Inc.
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
3248
9ee93fc9aba0 When given no file arguments, inspect RCS/.* as well
Richard M. Stallman <rms@gnu.org>
parents: 2639
diff changeset
33 nl='
9ee93fc9aba0 When given no file arguments, inspect RCS/.* as well
Richard M. Stallman <rms@gnu.org>
parents: 2639
diff changeset
34 '
1800
05cb79ebdb23 Add copyright and authorship notices.
Paul Eggert <eggert@twinsun.com>
parents: 1228
diff changeset
35
534
6f7abc0e1f10 Add -i, -l, -t.
Paul Eggert <eggert@twinsun.com>
parents: 527
diff changeset
36 # Parse options.
6f7abc0e1f10 Add -i, -l, -t.
Paul Eggert <eggert@twinsun.com>
parents: 527
diff changeset
37
6f7abc0e1f10 Add -i, -l, -t.
Paul Eggert <eggert@twinsun.com>
parents: 527
diff changeset
38 # defaults
4783
7c75802f5a8b Add -h, -n, -r options.
Paul Eggert <eggert@twinsun.com>
parents: 4654
diff changeset
39 : ${TMPDIR=/tmp}
7c75802f5a8b Add -h, -n, -r options.
Paul Eggert <eggert@twinsun.com>
parents: 4654
diff changeset
40 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
41 indent=8 # indent of log line
4783
7c75802f5a8b Add -h, -n, -r options.
Paul Eggert <eggert@twinsun.com>
parents: 4654
diff changeset
42 initialize_fullname= # awk assignments to set up fullname array
7c75802f5a8b Add -h, -n, -r options.
Paul Eggert <eggert@twinsun.com>
parents: 4654
diff changeset
43 initialize_mailaddr= # awk assignments to set up mailaddr array
534
6f7abc0e1f10 Add -i, -l, -t.
Paul Eggert <eggert@twinsun.com>
parents: 527
diff changeset
44 length=79 # suggested max width of log line
4783
7c75802f5a8b Add -h, -n, -r options.
Paul Eggert <eggert@twinsun.com>
parents: 4654
diff changeset
45 logins= # login names for people we know fullnames and mailaddresses of
7c75802f5a8b Add -h, -n, -r options.
Paul Eggert <eggert@twinsun.com>
parents: 4654
diff changeset
46 loginsout= # temporary file holding sorted logins
7c75802f5a8b Add -h, -n, -r options.
Paul Eggert <eggert@twinsun.com>
parents: 4654
diff changeset
47 rlog_options= # options to pass to rlog
534
6f7abc0e1f10 Add -i, -l, -t.
Paul Eggert <eggert@twinsun.com>
parents: 527
diff changeset
48 tabwidth=8 # width of horizontal tab
6f7abc0e1f10 Add -i, -l, -t.
Paul Eggert <eggert@twinsun.com>
parents: 527
diff changeset
49
6f7abc0e1f10 Add -i, -l, -t.
Paul Eggert <eggert@twinsun.com>
parents: 527
diff changeset
50 while :
6f7abc0e1f10 Add -i, -l, -t.
Paul Eggert <eggert@twinsun.com>
parents: 527
diff changeset
51 do
6f7abc0e1f10 Add -i, -l, -t.
Paul Eggert <eggert@twinsun.com>
parents: 527
diff changeset
52 case $1 in
6f7abc0e1f10 Add -i, -l, -t.
Paul Eggert <eggert@twinsun.com>
parents: 527
diff changeset
53 -i) indent=${2?};;
4783
7c75802f5a8b Add -h, -n, -r options.
Paul Eggert <eggert@twinsun.com>
parents: 4654
diff changeset
54 -h) hostname=${2?};;
534
6f7abc0e1f10 Add -i, -l, -t.
Paul Eggert <eggert@twinsun.com>
parents: 527
diff changeset
55 -l) length=${2?};;
4783
7c75802f5a8b Add -h, -n, -r options.
Paul Eggert <eggert@twinsun.com>
parents: 4654
diff changeset
56 -n) logins=$logins$nl${2?}
7c75802f5a8b Add -h, -n, -r options.
Paul Eggert <eggert@twinsun.com>
parents: 4654
diff changeset
57 loginsout=$TMPDIR/rcs2log$$l
7c75802f5a8b Add -h, -n, -r options.
Paul Eggert <eggert@twinsun.com>
parents: 4654
diff changeset
58 case $2${3?}${4?} in
7c75802f5a8b Add -h, -n, -r options.
Paul Eggert <eggert@twinsun.com>
parents: 4654
diff changeset
59 *\"* | *\\* | *"$nl"*)
7c75802f5a8b Add -h, -n, -r options.
Paul Eggert <eggert@twinsun.com>
parents: 4654
diff changeset
60 echo >&2 "$0: -n '$2' '$3' '$4': special characters not allowed"
7c75802f5a8b Add -h, -n, -r options.
Paul Eggert <eggert@twinsun.com>
parents: 4654
diff changeset
61 exit 1
7c75802f5a8b Add -h, -n, -r options.
Paul Eggert <eggert@twinsun.com>
parents: 4654
diff changeset
62 esac
7c75802f5a8b Add -h, -n, -r options.
Paul Eggert <eggert@twinsun.com>
parents: 4654
diff changeset
63 initialize_fullname="$initialize_fullname
7c75802f5a8b Add -h, -n, -r options.
Paul Eggert <eggert@twinsun.com>
parents: 4654
diff changeset
64 fullname[\"$2\"] = \"$3\""
7c75802f5a8b Add -h, -n, -r options.
Paul Eggert <eggert@twinsun.com>
parents: 4654
diff changeset
65 initialize_mailaddr="$initialize_mailaddr
7c75802f5a8b Add -h, -n, -r options.
Paul Eggert <eggert@twinsun.com>
parents: 4654
diff changeset
66 mailaddr[\"$2\"] = \"$4\""
7c75802f5a8b Add -h, -n, -r options.
Paul Eggert <eggert@twinsun.com>
parents: 4654
diff changeset
67 shift; shift;;
7c75802f5a8b Add -h, -n, -r options.
Paul Eggert <eggert@twinsun.com>
parents: 4654
diff changeset
68 -r) rlog_options=$rlog_options$nl${2?};;
534
6f7abc0e1f10 Add -i, -l, -t.
Paul Eggert <eggert@twinsun.com>
parents: 527
diff changeset
69 -t) tabwidth=${2?};;
4783
7c75802f5a8b Add -h, -n, -r options.
Paul Eggert <eggert@twinsun.com>
parents: 4654
diff changeset
70 -*) echo >&2 "$0: usage: $0 [options] [file ...]
7c75802f5a8b Add -h, -n, -r options.
Paul Eggert <eggert@twinsun.com>
parents: 4654
diff changeset
71 Options:
7c75802f5a8b Add -h, -n, -r options.
Paul Eggert <eggert@twinsun.com>
parents: 4654
diff changeset
72 [-h hostname] [-i indent] [-l length] [-n login fullname mailaddr]...
7c75802f5a8b Add -h, -n, -r options.
Paul Eggert <eggert@twinsun.com>
parents: 4654
diff changeset
73 [-r rlog_option]... [-t tabwidth]"
534
6f7abc0e1f10 Add -i, -l, -t.
Paul Eggert <eggert@twinsun.com>
parents: 527
diff changeset
74 exit 1;;
6f7abc0e1f10 Add -i, -l, -t.
Paul Eggert <eggert@twinsun.com>
parents: 527
diff changeset
75 *) break
6f7abc0e1f10 Add -i, -l, -t.
Paul Eggert <eggert@twinsun.com>
parents: 527
diff changeset
76 esac
6f7abc0e1f10 Add -i, -l, -t.
Paul Eggert <eggert@twinsun.com>
parents: 527
diff changeset
77 shift; shift
6f7abc0e1f10 Add -i, -l, -t.
Paul Eggert <eggert@twinsun.com>
parents: 527
diff changeset
78 done
6f7abc0e1f10 Add -i, -l, -t.
Paul Eggert <eggert@twinsun.com>
parents: 527
diff changeset
79
2220
66371f0b8aff Some awks don't understand "\r". Code around this.
Paul Eggert <eggert@twinsun.com>
parents: 1800
diff changeset
80 month_data='
66371f0b8aff Some awks don't understand "\r". Code around this.
Paul Eggert <eggert@twinsun.com>
parents: 1800
diff changeset
81 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
82 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
83 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
84 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
85
66371f0b8aff Some awks don't understand "\r". Code around this.
Paul Eggert <eggert@twinsun.com>
parents: 1800
diff changeset
86 # 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
87 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
88 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
89 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
90 mo[12]=365
66371f0b8aff Some awks don't understand "\r". Code around this.
Paul Eggert <eggert@twinsun.com>
parents: 1800
diff changeset
91 '
66371f0b8aff Some awks don't understand "\r". Code around this.
Paul Eggert <eggert@twinsun.com>
parents: 1800
diff changeset
92
534
6f7abc0e1f10 Add -i, -l, -t.
Paul Eggert <eggert@twinsun.com>
parents: 527
diff changeset
93
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
94 # Log into $rlogout the revisions checked in since the first ChangeLog entry.
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
95
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
96 date=1970
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
97 if test -s ChangeLog
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
98 then
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
99 # Add 1 to seconds to avoid duplicating most recent log.
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
100 e='
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
101 /^... ... [ 0-9][0-9] [ 0-9][0-9]:[0-9][0-9]:[0-9][0-9] [0-9]+ /{
2220
66371f0b8aff Some awks don't understand "\r". Code around this.
Paul Eggert <eggert@twinsun.com>
parents: 1800
diff changeset
102 '"$month_data"'
66371f0b8aff Some awks don't understand "\r". Code around this.
Paul Eggert <eggert@twinsun.com>
parents: 1800
diff changeset
103 year = $5
66371f0b8aff Some awks don't understand "\r". Code around this.
Paul Eggert <eggert@twinsun.com>
parents: 1800
diff changeset
104 for (i=0; i<=11; i++) if (m[i] == $2) break
66371f0b8aff Some awks don't understand "\r". Code around this.
Paul Eggert <eggert@twinsun.com>
parents: 1800
diff changeset
105 dd = $3
66371f0b8aff Some awks don't understand "\r". Code around this.
Paul Eggert <eggert@twinsun.com>
parents: 1800
diff changeset
106 hh = substr($0,12,2)
66371f0b8aff Some awks don't understand "\r". Code around this.
Paul Eggert <eggert@twinsun.com>
parents: 1800
diff changeset
107 mm = substr($0,15,2)
66371f0b8aff Some awks don't understand "\r". Code around this.
Paul Eggert <eggert@twinsun.com>
parents: 1800
diff changeset
108 ss = substr($0,18,2)
66371f0b8aff Some awks don't understand "\r". Code around this.
Paul Eggert <eggert@twinsun.com>
parents: 1800
diff changeset
109 ss++
66371f0b8aff Some awks don't understand "\r". Code around this.
Paul Eggert <eggert@twinsun.com>
parents: 1800
diff changeset
110 if (ss == 60) {
66371f0b8aff Some awks don't understand "\r". Code around this.
Paul Eggert <eggert@twinsun.com>
parents: 1800
diff changeset
111 ss = 0
66371f0b8aff Some awks don't understand "\r". Code around this.
Paul Eggert <eggert@twinsun.com>
parents: 1800
diff changeset
112 mm++
66371f0b8aff Some awks don't understand "\r". Code around this.
Paul Eggert <eggert@twinsun.com>
parents: 1800
diff changeset
113 if (mm == 60) {
66371f0b8aff Some awks don't understand "\r". Code around this.
Paul Eggert <eggert@twinsun.com>
parents: 1800
diff changeset
114 mm = 0
66371f0b8aff Some awks don't understand "\r". Code around this.
Paul Eggert <eggert@twinsun.com>
parents: 1800
diff changeset
115 hh++
66371f0b8aff Some awks don't understand "\r". Code around this.
Paul Eggert <eggert@twinsun.com>
parents: 1800
diff changeset
116 if (hh == 24) {
66371f0b8aff Some awks don't understand "\r". Code around this.
Paul Eggert <eggert@twinsun.com>
parents: 1800
diff changeset
117 hh = 0
66371f0b8aff Some awks don't understand "\r". Code around this.
Paul Eggert <eggert@twinsun.com>
parents: 1800
diff changeset
118 dd++
66371f0b8aff Some awks don't understand "\r". Code around this.
Paul Eggert <eggert@twinsun.com>
parents: 1800
diff changeset
119 monthdays = mo[i+1] - mo[i]
66371f0b8aff Some awks don't understand "\r". Code around this.
Paul Eggert <eggert@twinsun.com>
parents: 1800
diff changeset
120 if (i == 1 && year%4 == 0 && (year%100 != 0 || year%400 == 0)) monthdays++
66371f0b8aff Some awks don't understand "\r". Code around this.
Paul Eggert <eggert@twinsun.com>
parents: 1800
diff changeset
121 if (dd == monthdays + 1) {
66371f0b8aff Some awks don't understand "\r". Code around this.
Paul Eggert <eggert@twinsun.com>
parents: 1800
diff changeset
122 dd = 1
66371f0b8aff Some awks don't understand "\r". Code around this.
Paul Eggert <eggert@twinsun.com>
parents: 1800
diff changeset
123 i++
66371f0b8aff Some awks don't understand "\r". Code around this.
Paul Eggert <eggert@twinsun.com>
parents: 1800
diff changeset
124 if (i == 12) {
66371f0b8aff Some awks don't understand "\r". Code around this.
Paul Eggert <eggert@twinsun.com>
parents: 1800
diff changeset
125 i = 0
66371f0b8aff Some awks don't understand "\r". Code around this.
Paul Eggert <eggert@twinsun.com>
parents: 1800
diff changeset
126 year++
66371f0b8aff Some awks don't understand "\r". Code around this.
Paul Eggert <eggert@twinsun.com>
parents: 1800
diff changeset
127 }
66371f0b8aff Some awks don't understand "\r". Code around this.
Paul Eggert <eggert@twinsun.com>
parents: 1800
diff changeset
128 }
66371f0b8aff Some awks don't understand "\r". Code around this.
Paul Eggert <eggert@twinsun.com>
parents: 1800
diff changeset
129 }
66371f0b8aff Some awks don't understand "\r". Code around this.
Paul Eggert <eggert@twinsun.com>
parents: 1800
diff changeset
130 }
66371f0b8aff Some awks don't understand "\r". Code around this.
Paul Eggert <eggert@twinsun.com>
parents: 1800
diff changeset
131 }
66371f0b8aff Some awks don't understand "\r". Code around this.
Paul Eggert <eggert@twinsun.com>
parents: 1800
diff changeset
132 printf "%d/%02d/%02d %02d:%02d:%02d\n", year, i+1, dd, hh, mm, ss
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
133 exit
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
134 }
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
135 '
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
136 d=`awk "$e" <ChangeLog` || exit
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
137 case $d in
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
138 ?*) date=$d
535
4b75abb93479 Don't munge $* when getting date from ChangeLog.
Paul Eggert <eggert@twinsun.com>
parents: 534
diff changeset
139 esac
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
140 fi
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
141 datearg="-d>$date"
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
142
8549
12b36ece5c25 Add support for CVS.
Paul Eggert <eggert@twinsun.com>
parents: 8496
diff changeset
143 repository=
12b36ece5c25 Add support for CVS.
Paul Eggert <eggert@twinsun.com>
parents: 8496
diff changeset
144 rlog=rlog
12b36ece5c25 Add support for CVS.
Paul Eggert <eggert@twinsun.com>
parents: 8496
diff changeset
145 case $CVSROOT in
12b36ece5c25 Add support for CVS.
Paul Eggert <eggert@twinsun.com>
parents: 8496
diff changeset
146 ?*)
12b36ece5c25 Add support for CVS.
Paul Eggert <eggert@twinsun.com>
parents: 8496
diff changeset
147 if test -d "$CVSROOT" && test -f CVS/Repository
12b36ece5c25 Add support for CVS.
Paul Eggert <eggert@twinsun.com>
parents: 8496
diff changeset
148 then
12b36ece5c25 Add support for CVS.
Paul Eggert <eggert@twinsun.com>
parents: 8496
diff changeset
149 r=`cat <CVS/Repository` || exit
12b36ece5c25 Add support for CVS.
Paul Eggert <eggert@twinsun.com>
parents: 8496
diff changeset
150 if test -d "$CVSROOT/$r"
12b36ece5c25 Add support for CVS.
Paul Eggert <eggert@twinsun.com>
parents: 8496
diff changeset
151 then
12b36ece5c25 Add support for CVS.
Paul Eggert <eggert@twinsun.com>
parents: 8496
diff changeset
152 repository=$CVSROOT/$r
12b36ece5c25 Add support for CVS.
Paul Eggert <eggert@twinsun.com>
parents: 8496
diff changeset
153 rlog='cvs log'
12b36ece5c25 Add support for CVS.
Paul Eggert <eggert@twinsun.com>
parents: 8496
diff changeset
154 fi
12b36ece5c25 Add support for CVS.
Paul Eggert <eggert@twinsun.com>
parents: 8496
diff changeset
155 fi
12b36ece5c25 Add support for CVS.
Paul Eggert <eggert@twinsun.com>
parents: 8496
diff changeset
156 esac
12b36ece5c25 Add support for CVS.
Paul Eggert <eggert@twinsun.com>
parents: 8496
diff changeset
157
3248
9ee93fc9aba0 When given no file arguments, inspect RCS/.* as well
Richard M. Stallman <rms@gnu.org>
parents: 2639
diff changeset
158 # 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
159 case $# in
9ee93fc9aba0 When given no file arguments, inspect RCS/.* as well
Richard M. Stallman <rms@gnu.org>
parents: 2639
diff changeset
160 0)
8549
12b36ece5c25 Add support for CVS.
Paul Eggert <eggert@twinsun.com>
parents: 8496
diff changeset
161 case $repository in
12b36ece5c25 Add support for CVS.
Paul Eggert <eggert@twinsun.com>
parents: 8496
diff changeset
162 '')
12b36ece5c25 Add support for CVS.
Paul Eggert <eggert@twinsun.com>
parents: 8496
diff changeset
163 files=
12b36ece5c25 Add support for CVS.
Paul Eggert <eggert@twinsun.com>
parents: 8496
diff changeset
164 for file in RCS/.* RCS/* .*,v *,v
12b36ece5c25 Add support for CVS.
Paul Eggert <eggert@twinsun.com>
parents: 8496
diff changeset
165 do
12b36ece5c25 Add support for CVS.
Paul Eggert <eggert@twinsun.com>
parents: 8496
diff changeset
166 case $file in
12b36ece5c25 Add support for CVS.
Paul Eggert <eggert@twinsun.com>
parents: 8496
diff changeset
167 RCS/. | RCS/..) continue;;
12b36ece5c25 Add support for CVS.
Paul Eggert <eggert@twinsun.com>
parents: 8496
diff changeset
168 RCS/.\* | RCS/\* | .\*,v | \*,v) test -f "$file" || continue
12b36ece5c25 Add support for CVS.
Paul Eggert <eggert@twinsun.com>
parents: 8496
diff changeset
169 esac
12b36ece5c25 Add support for CVS.
Paul Eggert <eggert@twinsun.com>
parents: 8496
diff changeset
170 files=$files$nl$file
12b36ece5c25 Add support for CVS.
Paul Eggert <eggert@twinsun.com>
parents: 8496
diff changeset
171 done
12b36ece5c25 Add support for CVS.
Paul Eggert <eggert@twinsun.com>
parents: 8496
diff changeset
172 case $files in
12b36ece5c25 Add support for CVS.
Paul Eggert <eggert@twinsun.com>
parents: 8496
diff changeset
173 '') exit 0
3248
9ee93fc9aba0 When given no file arguments, inspect RCS/.* as well
Richard M. Stallman <rms@gnu.org>
parents: 2639
diff changeset
174 esac
8549
12b36ece5c25 Add support for CVS.
Paul Eggert <eggert@twinsun.com>
parents: 8496
diff changeset
175 oldIFS=$IFS
12b36ece5c25 Add support for CVS.
Paul Eggert <eggert@twinsun.com>
parents: 8496
diff changeset
176 IFS=$nl
12b36ece5c25 Add support for CVS.
Paul Eggert <eggert@twinsun.com>
parents: 8496
diff changeset
177 set $files
12b36ece5c25 Add support for CVS.
Paul Eggert <eggert@twinsun.com>
parents: 8496
diff changeset
178 IFS=$oldIFS
3248
9ee93fc9aba0 When given no file arguments, inspect RCS/.* as well
Richard M. Stallman <rms@gnu.org>
parents: 2639
diff changeset
179 esac
9ee93fc9aba0 When given no file arguments, inspect RCS/.* as well
Richard M. Stallman <rms@gnu.org>
parents: 2639
diff changeset
180 esac
9ee93fc9aba0 When given no file arguments, inspect RCS/.* as well
Richard M. Stallman <rms@gnu.org>
parents: 2639
diff changeset
181
4783
7c75802f5a8b Add -h, -n, -r options.
Paul Eggert <eggert@twinsun.com>
parents: 4654
diff changeset
182 rlogout=$TMPDIR/rcs2log$$r
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
183 trap exit 1 2 13 15
4783
7c75802f5a8b Add -h, -n, -r options.
Paul Eggert <eggert@twinsun.com>
parents: 4654
diff changeset
184 trap "rm -f $loginsout $rlogout; exit 1" 0
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
185
8549
12b36ece5c25 Add support for CVS.
Paul Eggert <eggert@twinsun.com>
parents: 8496
diff changeset
186 $rlog "$datearg" $rlog_options ${1+"$@"} >$rlogout || exit
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
187
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
188
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
189 # 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
190 # to awk code that initializes the `fullname' awk associative array.
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
191 # Warning: foreign authors (i.e. not known in the passwd file) are mishandled;
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
192 # you have to fix the resulting output by hand.
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
193
4783
7c75802f5a8b Add -h, -n, -r options.
Paul Eggert <eggert@twinsun.com>
parents: 4654
diff changeset
194 case $loginsout in
7c75802f5a8b Add -h, -n, -r options.
Paul Eggert <eggert@twinsun.com>
parents: 4654
diff changeset
195 ?*) sort -u -o $loginsout <<EOF || exit
7c75802f5a8b Add -h, -n, -r options.
Paul Eggert <eggert@twinsun.com>
parents: 4654
diff changeset
196 $logins
7c75802f5a8b Add -h, -n, -r options.
Paul Eggert <eggert@twinsun.com>
parents: 4654
diff changeset
197 EOF
7c75802f5a8b Add -h, -n, -r options.
Paul Eggert <eggert@twinsun.com>
parents: 4654
diff changeset
198 esac
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
199 authors=`
8549
12b36ece5c25 Add support for CVS.
Paul Eggert <eggert@twinsun.com>
parents: 8496
diff changeset
200 sed -n 's|^date: *[0-9]*[-/][0-9][0-9][-/][0-9][0-9] [0-9][0-9]:[0-9][0-9]:[0-9][0-9][-+0-9]*; *author: *\([^; ]*\).*|\1|p' <$rlogout |
4783
7c75802f5a8b Add -h, -n, -r options.
Paul Eggert <eggert@twinsun.com>
parents: 4654
diff changeset
201 case $loginsout in
7c75802f5a8b Add -h, -n, -r options.
Paul Eggert <eggert@twinsun.com>
parents: 4654
diff changeset
202 '') sort -u;;
7c75802f5a8b Add -h, -n, -r options.
Paul Eggert <eggert@twinsun.com>
parents: 4654
diff changeset
203 ?*) sort -u | comm -23 - $loginsout
7c75802f5a8b Add -h, -n, -r options.
Paul Eggert <eggert@twinsun.com>
parents: 4654
diff changeset
204 esac
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
205 `
640
36e7f4e402bd Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents: 636
diff changeset
206 case $authors in
36e7f4e402bd Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents: 636
diff changeset
207 ?*)
36e7f4e402bd Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents: 636
diff changeset
208 initialize_author=
36e7f4e402bd Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents: 636
diff changeset
209 for author in $authors
36e7f4e402bd Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents: 636
diff changeset
210 do
36e7f4e402bd Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents: 636
diff changeset
211 initialize_author="$initialize_author
36e7f4e402bd Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents: 636
diff changeset
212 author[\"$author\"] = 1
36e7f4e402bd Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents: 636
diff changeset
213 "
36e7f4e402bd Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents: 636
diff changeset
214 done
36e7f4e402bd Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents: 636
diff changeset
215 awkscript='
36e7f4e402bd Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents: 636
diff changeset
216 BEGIN {
36e7f4e402bd Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents: 636
diff changeset
217 alphabet = "abcdefghijklmnopqrstuvwxyz"
36e7f4e402bd Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents: 636
diff changeset
218 ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
36e7f4e402bd Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents: 636
diff changeset
219 '"$initialize_author"'
36e7f4e402bd Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents: 636
diff changeset
220 }
36e7f4e402bd Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents: 636
diff changeset
221 {
36e7f4e402bd Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents: 636
diff changeset
222 if (author[$1]) {
36e7f4e402bd Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents: 636
diff changeset
223 fullname = $5
4504
65ef94a9e2c4 (awkscript): Some sites put comma-separated junk after the fullname.
Paul Eggert <eggert@twinsun.com>
parents: 3248
diff changeset
224 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
225 # 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
226 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
227 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
228 }
65ef94a9e2c4 (awkscript): Some sites put comma-separated junk after the fullname.
Paul Eggert <eggert@twinsun.com>
parents: 3248
diff changeset
229 if (fullname ~ /,[^ ]/) {
65ef94a9e2c4 (awkscript): Some sites put comma-separated junk after the fullname.
Paul Eggert <eggert@twinsun.com>
parents: 3248
diff changeset
230 # 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
231 # 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
232 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
233 }
640
36e7f4e402bd Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents: 636
diff changeset
234 abbr = index(fullname, "&")
36e7f4e402bd Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents: 636
diff changeset
235 if (abbr) {
36e7f4e402bd Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents: 636
diff changeset
236 a = substr($1, 1, 1)
36e7f4e402bd Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents: 636
diff changeset
237 A = a
36e7f4e402bd Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents: 636
diff changeset
238 i = index(alphabet, a)
36e7f4e402bd Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents: 636
diff changeset
239 if (i) A = substr(ALPHABET, i, 1)
36e7f4e402bd Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents: 636
diff changeset
240 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
241 }
36e7f4e402bd Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents: 636
diff changeset
242 printf "fullname[\"%s\"] = \"%s\"\n", $1, fullname
36e7f4e402bd Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents: 636
diff changeset
243 author[$1] = 0
36e7f4e402bd Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents: 636
diff changeset
244 }
36e7f4e402bd Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents: 636
diff changeset
245 }
36e7f4e402bd Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents: 636
diff changeset
246 '
36e7f4e402bd Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents: 636
diff changeset
247
36e7f4e402bd Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents: 636
diff changeset
248 initialize_fullname=`
36e7f4e402bd Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents: 636
diff changeset
249 (cat /etc/passwd; ypmatch $authors passwd) 2>/dev/null |
36e7f4e402bd Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents: 636
diff changeset
250 awk -F: "$awkscript"
4783
7c75802f5a8b Add -h, -n, -r options.
Paul Eggert <eggert@twinsun.com>
parents: 4654
diff changeset
251 `$initialize_fullname
640
36e7f4e402bd Call ypmatch at most once.
Paul Eggert <eggert@twinsun.com>
parents: 636
diff changeset
252 esac
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
253
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
254
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
255 # Function to print a single log line.
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
256 # We don't use awk functions, to stay compatible with old awk versions.
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
257 # `Log' is the log message (with \n replaced by \r).
594
efa0c124c178 Add clumpname support.
Paul Eggert <eggert@twinsun.com>
parents: 535
diff changeset
258 # `files' contains the affected files.
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
259 printlogline='{
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
260
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
261 # Following the GNU coding standards, rewrite
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
262 # * file: (function): comment
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
263 # to
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
264 # * file (function): comment
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
265 if (Log ~ /^\([^)]*\): /) {
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
266 i = index(Log, ")")
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
267 files = files " " substr(Log, 1, i)
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
268 Log = substr(Log, i+3)
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
269 }
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
270
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
271 # If "label: comment" is too long, break the line after the ":".
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
272 sep = " "
2220
66371f0b8aff Some awks don't understand "\r". Code around this.
Paul Eggert <eggert@twinsun.com>
parents: 1800
diff changeset
273 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
274
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
275 # Print the label.
534
6f7abc0e1f10 Add -i, -l, -t.
Paul Eggert <eggert@twinsun.com>
parents: 527
diff changeset
276 printf "%s*%s:", indent_string, files
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
277
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
278 # 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
279 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
280 logline = substr(Log, 1, i-1)
5b4f9564bfaf (printlogline): Don't generate lines containing only white space.
Paul Eggert <eggert@twinsun.com>
parents: 4783
diff changeset
281 if (logline ~ /[^ ]/) {
5b4f9564bfaf (printlogline): Don't generate lines containing only white space.
Paul Eggert <eggert@twinsun.com>
parents: 4783
diff changeset
282 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
283 } else {
5b4f9564bfaf (printlogline): Don't generate lines containing only white space.
Paul Eggert <eggert@twinsun.com>
parents: 4783
diff changeset
284 print ""
5b4f9564bfaf (printlogline): Don't generate lines containing only white space.
Paul Eggert <eggert@twinsun.com>
parents: 4783
diff changeset
285 }
534
6f7abc0e1f10 Add -i, -l, -t.
Paul Eggert <eggert@twinsun.com>
parents: 527
diff changeset
286 sep = indent_string
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
287 Log = substr(Log, i+1)
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
288 }
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
289 }'
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
290
4783
7c75802f5a8b Add -h, -n, -r options.
Paul Eggert <eggert@twinsun.com>
parents: 4654
diff changeset
291 case $hostname in
7c75802f5a8b Add -h, -n, -r options.
Paul Eggert <eggert@twinsun.com>
parents: 4654
diff changeset
292 '')
7c75802f5a8b Add -h, -n, -r options.
Paul Eggert <eggert@twinsun.com>
parents: 4654
diff changeset
293 hostname=`(
7c75802f5a8b Add -h, -n, -r options.
Paul Eggert <eggert@twinsun.com>
parents: 4654
diff changeset
294 hostname || uname -n || uuname -l || cat /etc/whoami
7c75802f5a8b Add -h, -n, -r options.
Paul Eggert <eggert@twinsun.com>
parents: 4654
diff changeset
295 ) 2>/dev/null` || {
7c75802f5a8b Add -h, -n, -r options.
Paul Eggert <eggert@twinsun.com>
parents: 4654
diff changeset
296 echo >&2 "$0: cannot deduce hostname"
7c75802f5a8b Add -h, -n, -r options.
Paul Eggert <eggert@twinsun.com>
parents: 4654
diff changeset
297 exit 1
7c75802f5a8b Add -h, -n, -r options.
Paul Eggert <eggert@twinsun.com>
parents: 4654
diff changeset
298 }
7c75802f5a8b Add -h, -n, -r options.
Paul Eggert <eggert@twinsun.com>
parents: 4654
diff changeset
299 esac
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
300
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
301
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
302 # Process the rlog output, generating ChangeLog style entries.
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
303
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
304 # First, reformat the rlog output so that each line contains one log entry.
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
305 # Transliterate \n to \r so that multiline entries fit on a single line.
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
306 # Discard irrelevant rlog output.
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
307 awk <$rlogout '
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
308 /^Working file:/ { filename = $3 }
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
309 /^date: /, /^(-----------*|===========*)$/ {
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
310 if ($0 ~ /^branches: /) { next }
8549
12b36ece5c25 Add support for CVS.
Paul Eggert <eggert@twinsun.com>
parents: 8496
diff changeset
311 if ($0 ~ /^date: [0-9][- +\/0-9:]*;/) {
12b36ece5c25 Add support for CVS.
Paul Eggert <eggert@twinsun.com>
parents: 8496
diff changeset
312 date = $2
12b36ece5c25 Add support for CVS.
Paul Eggert <eggert@twinsun.com>
parents: 8496
diff changeset
313 if (date ~ /-/) {
12b36ece5c25 Add support for CVS.
Paul Eggert <eggert@twinsun.com>
parents: 8496
diff changeset
314 # An ISO format date. Replace all "-"s with "/"s.
12b36ece5c25 Add support for CVS.
Paul Eggert <eggert@twinsun.com>
parents: 8496
diff changeset
315 newdate = ""
12b36ece5c25 Add support for CVS.
Paul Eggert <eggert@twinsun.com>
parents: 8496
diff changeset
316 while ((i = index(date, "-")) != 0) {
12b36ece5c25 Add support for CVS.
Paul Eggert <eggert@twinsun.com>
parents: 8496
diff changeset
317 newdate = newdate substr(date, 1, i-1) "/"
12b36ece5c25 Add support for CVS.
Paul Eggert <eggert@twinsun.com>
parents: 8496
diff changeset
318 date = substr(date, i+1)
12b36ece5c25 Add support for CVS.
Paul Eggert <eggert@twinsun.com>
parents: 8496
diff changeset
319 }
12b36ece5c25 Add support for CVS.
Paul Eggert <eggert@twinsun.com>
parents: 8496
diff changeset
320 date = newdate date
12b36ece5c25 Add support for CVS.
Paul Eggert <eggert@twinsun.com>
parents: 8496
diff changeset
321 }
12b36ece5c25 Add support for CVS.
Paul Eggert <eggert@twinsun.com>
parents: 8496
diff changeset
322 # Ignore any time zone; ChangeLog has no room for it.
12b36ece5c25 Add support for CVS.
Paul Eggert <eggert@twinsun.com>
parents: 8496
diff changeset
323 time = substr($3, 1, 8)
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
324 author = substr($5, 1, length($5)-1)
8549
12b36ece5c25 Add support for CVS.
Paul Eggert <eggert@twinsun.com>
parents: 8496
diff changeset
325 printf "%s %s %s %s %c", filename, date, time, author, 13
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
326 next
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
327 }
636
dce8cdbac0ea Ignore log messages that start with `#'.
Paul Eggert <eggert@twinsun.com>
parents: 602
diff changeset
328 if ($0 ~ /^(-----------*|===========*)$/) { print ""; next }
2220
66371f0b8aff Some awks don't understand "\r". Code around this.
Paul Eggert <eggert@twinsun.com>
parents: 1800
diff changeset
329 printf "%s%c", $0, 13
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
330 }
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
331 ' |
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
332
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
333 # Now each line is of the form
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
334 # FILENAME YYYY/MM/DD HH:MM:SS AUTHOR \rLOG
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
335 # where \r stands for a carriage return,
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
336 # 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
337 # Sort the log entries, first by date+time (in reverse order),
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
338 # 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
339 sort +1 -3r +3 +0 |
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
340
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
341 # Finally, reformat the sorted log entries.
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
342 awk '
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
343 BEGIN {
2220
66371f0b8aff Some awks don't understand "\r". Code around this.
Paul Eggert <eggert@twinsun.com>
parents: 1800
diff changeset
344 # Some awks do not understand "\r" or "\013", so we have to
66371f0b8aff Some awks don't understand "\r". Code around this.
Paul Eggert <eggert@twinsun.com>
parents: 1800
diff changeset
345 # 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
346 CR=" " # <-- There is a single CR between the " chars here.
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
347
4783
7c75802f5a8b Add -h, -n, -r options.
Paul Eggert <eggert@twinsun.com>
parents: 4654
diff changeset
348 # Initialize the fullname and mailaddr associative arrays.
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
349 '"$initialize_fullname"'
4783
7c75802f5a8b Add -h, -n, -r options.
Paul Eggert <eggert@twinsun.com>
parents: 4654
diff changeset
350 '"$initialize_mailaddr"'
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
351
534
6f7abc0e1f10 Add -i, -l, -t.
Paul Eggert <eggert@twinsun.com>
parents: 527
diff changeset
352 # Initialize indent string.
6f7abc0e1f10 Add -i, -l, -t.
Paul Eggert <eggert@twinsun.com>
parents: 527
diff changeset
353 indent_string = ""
6f7abc0e1f10 Add -i, -l, -t.
Paul Eggert <eggert@twinsun.com>
parents: 527
diff changeset
354 i = '"$indent"'
6f7abc0e1f10 Add -i, -l, -t.
Paul Eggert <eggert@twinsun.com>
parents: 527
diff changeset
355 if (0 < '"$tabwidth"')
6f7abc0e1f10 Add -i, -l, -t.
Paul Eggert <eggert@twinsun.com>
parents: 527
diff changeset
356 for (; '"$tabwidth"' <= i; i -= '"$tabwidth"')
6f7abc0e1f10 Add -i, -l, -t.
Paul Eggert <eggert@twinsun.com>
parents: 527
diff changeset
357 indent_string = indent_string "\t"
6f7abc0e1f10 Add -i, -l, -t.
Paul Eggert <eggert@twinsun.com>
parents: 527
diff changeset
358 while (1 <= i--)
6f7abc0e1f10 Add -i, -l, -t.
Paul Eggert <eggert@twinsun.com>
parents: 527
diff changeset
359 indent_string = indent_string " "
6f7abc0e1f10 Add -i, -l, -t.
Paul Eggert <eggert@twinsun.com>
parents: 527
diff changeset
360
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
361 # Set up date conversion tables.
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
362 # RCS uses a nice, clean, sortable format,
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
363 # but ChangeLog wants the traditional, ugly ctime format.
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
364
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
365 # January 1, 0 AD (Gregorian) was Saturday = 6
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
366 EPOCH_WEEKDAY = 6
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
367 # Of course, there was no 0 AD, but the algorithm works anyway.
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
368
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
369 w[0]="Sun"; w[1]="Mon"; w[2]="Tue"; w[3]="Wed"
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
370 w[4]="Thu"; w[5]="Fri"; w[6]="Sat"
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
371
2220
66371f0b8aff Some awks don't understand "\r". Code around this.
Paul Eggert <eggert@twinsun.com>
parents: 1800
diff changeset
372 '"$month_data"'
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
373 }
636
dce8cdbac0ea Ignore log messages that start with `#'.
Paul Eggert <eggert@twinsun.com>
parents: 602
diff changeset
374
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
375 {
2220
66371f0b8aff Some awks don't understand "\r". Code around this.
Paul Eggert <eggert@twinsun.com>
parents: 1800
diff changeset
376 newlog = substr($0, 1 + index($0, CR))
636
dce8cdbac0ea Ignore log messages that start with `#'.
Paul Eggert <eggert@twinsun.com>
parents: 602
diff changeset
377
dce8cdbac0ea Ignore log messages that start with `#'.
Paul Eggert <eggert@twinsun.com>
parents: 602
diff changeset
378 # Ignore log entries prefixed by "#".
dce8cdbac0ea Ignore log messages that start with `#'.
Paul Eggert <eggert@twinsun.com>
parents: 602
diff changeset
379 if (newlog ~ /^#/) { next }
dce8cdbac0ea Ignore log messages that start with `#'.
Paul Eggert <eggert@twinsun.com>
parents: 602
diff changeset
380
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
381 if (Log != newlog || date != $2 || author != $4) {
594
efa0c124c178 Add clumpname support.
Paul Eggert <eggert@twinsun.com>
parents: 535
diff changeset
382
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
383 # The previous log and this log differ.
594
efa0c124c178 Add clumpname support.
Paul Eggert <eggert@twinsun.com>
parents: 535
diff changeset
384
efa0c124c178 Add clumpname support.
Paul Eggert <eggert@twinsun.com>
parents: 535
diff changeset
385 # Print the old log.
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
386 if (date != "") '"$printlogline"'
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
387
594
efa0c124c178 Add clumpname support.
Paul Eggert <eggert@twinsun.com>
parents: 535
diff changeset
388 # Logs that begin with "{clumpname} " should be grouped together,
efa0c124c178 Add clumpname support.
Paul Eggert <eggert@twinsun.com>
parents: 535
diff changeset
389 # and the clumpname should be removed.
efa0c124c178 Add clumpname support.
Paul Eggert <eggert@twinsun.com>
parents: 535
diff changeset
390 # Extract the new clumpname from the log header,
efa0c124c178 Add clumpname support.
Paul Eggert <eggert@twinsun.com>
parents: 535
diff changeset
391 # and use it to decide whether to output a blank line.
efa0c124c178 Add clumpname support.
Paul Eggert <eggert@twinsun.com>
parents: 535
diff changeset
392 newclumpname = ""
efa0c124c178 Add clumpname support.
Paul Eggert <eggert@twinsun.com>
parents: 535
diff changeset
393 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
394 if (date == "") sep = ""
4654
0f5dd4938af9 Change /{/ to /\{/ for Posix compatibility; otherwise, HP awk complains.
Paul Eggert <eggert@twinsun.com>
parents: 4504
diff changeset
395 if (newlog ~ /^\{[^ }]*}[ ]/) {
594
efa0c124c178 Add clumpname support.
Paul Eggert <eggert@twinsun.com>
parents: 535
diff changeset
396 i = index(newlog, "}")
efa0c124c178 Add clumpname support.
Paul Eggert <eggert@twinsun.com>
parents: 535
diff changeset
397 newclumpname = substr(newlog, 1, i)
efa0c124c178 Add clumpname support.
Paul Eggert <eggert@twinsun.com>
parents: 535
diff changeset
398 while (substr(newlog, i+1) ~ /^[ ]/) i++
efa0c124c178 Add clumpname support.
Paul Eggert <eggert@twinsun.com>
parents: 535
diff changeset
399 newlog = substr(newlog, i+1)
efa0c124c178 Add clumpname support.
Paul Eggert <eggert@twinsun.com>
parents: 535
diff changeset
400 if (clumpname == newclumpname) sep = ""
efa0c124c178 Add clumpname support.
Paul Eggert <eggert@twinsun.com>
parents: 535
diff changeset
401 }
efa0c124c178 Add clumpname support.
Paul Eggert <eggert@twinsun.com>
parents: 535
diff changeset
402 printf sep
efa0c124c178 Add clumpname support.
Paul Eggert <eggert@twinsun.com>
parents: 535
diff changeset
403 clumpname = newclumpname
efa0c124c178 Add clumpname support.
Paul Eggert <eggert@twinsun.com>
parents: 535
diff changeset
404
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
405 # Get ready for the next log.
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
406 Log = newlog
534
6f7abc0e1f10 Add -i, -l, -t.
Paul Eggert <eggert@twinsun.com>
parents: 527
diff changeset
407 if (files != "")
6f7abc0e1f10 Add -i, -l, -t.
Paul Eggert <eggert@twinsun.com>
parents: 527
diff changeset
408 for (i in filesknown)
6f7abc0e1f10 Add -i, -l, -t.
Paul Eggert <eggert@twinsun.com>
parents: 527
diff changeset
409 filesknown[i] = 0
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
410 files = ""
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
411 }
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
412 if (date != $2 || author != $4) {
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
413 # The previous date+author and this date+author differ.
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
414 # Print the new one.
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
415 date = $2
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
416 author = $4
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
417
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
418 # Convert nice RCS date like "1992/01/03 00:03:44"
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
419 # into ugly ctime date like "Fri Jan 3 00:03:44 1992".
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
420 # Calculate day of week from Gregorian calendar.
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
421 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
422 year = substr($2, 1, i-1) + 0
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
423 monthday = substr($2, i+1)
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
424 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
425 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
426 day = substr(monthday, i+1) + 0
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
427 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
428 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
429 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
430
4783
7c75802f5a8b Add -h, -n, -r options.
Paul Eggert <eggert@twinsun.com>
parents: 4654
diff changeset
431 # Print "date fullname (email address)".
7c75802f5a8b Add -h, -n, -r options.
Paul Eggert <eggert@twinsun.com>
parents: 4654
diff changeset
432 # Get fullname and email address from associative arrays;
7c75802f5a8b Add -h, -n, -r options.
Paul Eggert <eggert@twinsun.com>
parents: 4654
diff changeset
433 # 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
434 if (fullname[author])
4783
7c75802f5a8b Add -h, -n, -r options.
Paul Eggert <eggert@twinsun.com>
parents: 4654
diff changeset
435 auth = fullname[author]
534
6f7abc0e1f10 Add -i, -l, -t.
Paul Eggert <eggert@twinsun.com>
parents: 527
diff changeset
436 else
4783
7c75802f5a8b Add -h, -n, -r options.
Paul Eggert <eggert@twinsun.com>
parents: 4654
diff changeset
437 auth = author
7c75802f5a8b Add -h, -n, -r options.
Paul Eggert <eggert@twinsun.com>
parents: 4654
diff changeset
438 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
439 if (mailaddr[author])
8496
2dba6eb73c65 Use <> to delimit email address.
Richard M. Stallman <rms@gnu.org>
parents: 4858
diff changeset
440 printf "<%s>\n\n", mailaddr[author]
4783
7c75802f5a8b Add -h, -n, -r options.
Paul Eggert <eggert@twinsun.com>
parents: 4654
diff changeset
441 else
8496
2dba6eb73c65 Use <> to delimit email address.
Richard M. Stallman <rms@gnu.org>
parents: 4858
diff changeset
442 printf "<%s@%s>\n\n", author, "'"$hostname"'"
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
443 }
534
6f7abc0e1f10 Add -i, -l, -t.
Paul Eggert <eggert@twinsun.com>
parents: 527
diff changeset
444 if (! filesknown[$1]) {
6f7abc0e1f10 Add -i, -l, -t.
Paul Eggert <eggert@twinsun.com>
parents: 527
diff changeset
445 filesknown[$1] = 1
594
efa0c124c178 Add clumpname support.
Paul Eggert <eggert@twinsun.com>
parents: 535
diff changeset
446 if (files == "") files = " " $1
efa0c124c178 Add clumpname support.
Paul Eggert <eggert@twinsun.com>
parents: 535
diff changeset
447 else files = files ", " $1
534
6f7abc0e1f10 Add -i, -l, -t.
Paul Eggert <eggert@twinsun.com>
parents: 527
diff changeset
448 }
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
449 }
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
450 END {
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
451 # Print the last log.
594
efa0c124c178 Add clumpname support.
Paul Eggert <eggert@twinsun.com>
parents: 535
diff changeset
452 if (date != "") {
efa0c124c178 Add clumpname support.
Paul Eggert <eggert@twinsun.com>
parents: 535
diff changeset
453 '"$printlogline"'
efa0c124c178 Add clumpname support.
Paul Eggert <eggert@twinsun.com>
parents: 535
diff changeset
454 printf "\n"
efa0c124c178 Add clumpname support.
Paul Eggert <eggert@twinsun.com>
parents: 535
diff changeset
455 }
527
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
456 }
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
457 ' &&
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
458
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
459
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
460 # Exit successfully.
703fd28f892d Initial revision
Paul Eggert <eggert@twinsun.com>
parents:
diff changeset
461
4783
7c75802f5a8b Add -h, -n, -r options.
Paul Eggert <eggert@twinsun.com>
parents: 4654
diff changeset
462 exec rm -f $loginsout $rlogout