summaryrefslogtreecommitdiff
path: root/lib-src
diff options
context:
space:
mode:
authorPaul Eggert <eggert@twinsun.com>1992-04-01 08:57:55 +0000
committerPaul Eggert <eggert@twinsun.com>1992-04-01 08:57:55 +0000
commit528c510270f0de761c6e05763812a8886b614328 (patch)
tree4dc4ee5c15ad5d898b57df5cf440d09c42539a5e /lib-src
parent032f531f2f3af5cdec8ecc0ef71a5f2be2a1555a (diff)
downloademacs-528c510270f0de761c6e05763812a8886b614328.tar.gz
Don't duplicate most recent logs. Fix bug in dates after Feb 29 in leap year.
Diffstat (limited to 'lib-src')
-rw-r--r--lib-src/=rcs2log31
-rwxr-xr-xlib-src/rcs2log31
2 files changed, 40 insertions, 22 deletions
diff --git a/lib-src/=rcs2log b/lib-src/=rcs2log
index 22b2157e6ad..9869b12ff0d 100644
--- a/lib-src/=rcs2log
+++ b/lib-src/=rcs2log
@@ -2,7 +2,7 @@
# RCS to ChangeLog generator
-# $Id: rcs2clog,v 1.3 1992/02/05 17:25:10 eggert Exp eggert $
+# $Id: rcs2log,v 1.4 1992/03/21 05:58:05 eggert Exp eggert $
# Generate a change log prefix from RCS/* and the existing ChangeLog (if any).
# Output the new prefix to standard output.
@@ -32,15 +32,23 @@ done
# Log into $rlogout the revisions checked in since the first ChangeLog entry.
-datearg=-d'>1970'
+date=1970
if test -s ChangeLog
then
- e='s/^\(...\) \(...\) \(..\) \(..:..:..\) \(....\) .*/\1 \2 \3 \4 \5/p; 1q'
- date=`sed -n "$e" <ChangeLog` || exit
- case $date in
- ?*) datearg="-d>$date"
+ # Add 1 to seconds to avoid duplicating most recent log.
+ # It's a good thing `rlog' doesn't mind a time ending in `:60'.
+ e='
+ /^... ... [ 0-9][0-9] [ 0-9][0-9]:[0-9][0-9]:[0-9][0-9] [0-9]+ /{
+ printf "%s%.2d %s\n", substr($0,1,17), substr($0,18,2)+1, $5
+ exit
+ }
+ '
+ d=`awk "$e" <ChangeLog` || exit
+ case $d in
+ ?*) date=$d
esac
fi
+datearg="-d>$date"
rlogout=/tmp/chg$$
trap exit 1 2 13 15
@@ -153,7 +161,7 @@ awk <$rlogout '
# and each line of the log is terminated by \r instead of \n.
# Sort the log entries, first by date (in reverse order),
# then by author, then by log entry, and finally by file name (just in case).
-sort +1 -2r +3 +0 |
+sort +1 -3r +3 +0 |
# Finally, reformat the sorted log entries.
awk '
@@ -208,6 +216,7 @@ awk '
# and use it to decide whether to output a blank line.
newclumpname = ""
sep = "\n"
+ if (date == "") sep = ""
if (newlog ~ /^{[^ }]+}[ ]/) {
i = index(newlog, "}")
newclumpname = substr(newlog, 1, i)
@@ -235,13 +244,13 @@ awk '
# into ugly ctime date like "Fri Jan 3 00:03:44 1992".
# Calculate day of week from Gregorian calendar.
i = index($2, "/")
- year = substr($2, 1, i-1)
+ year = substr($2, 1, i-1) + 0
monthday = substr($2, i+1)
i = index(monthday, "/")
- month = substr(monthday, 1, i-1)
- day = substr(monthday, i+1)
+ month = substr(monthday, 1, i-1) + 0
+ day = substr(monthday, i+1) + 0
leap = 0
- if (2 <= month && year%4 == 0 && (year%100 != 0 || year%400 == 0)) leap = 1
+ if (2 < month && year%4 == 0 && (year%100 != 0 || year%400 == 0)) leap = 1
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
# Print "date fullname (email address)" if the fullname is known;
diff --git a/lib-src/rcs2log b/lib-src/rcs2log
index 22b2157e6ad..9869b12ff0d 100755
--- a/lib-src/rcs2log
+++ b/lib-src/rcs2log
@@ -2,7 +2,7 @@
# RCS to ChangeLog generator
-# $Id: rcs2clog,v 1.3 1992/02/05 17:25:10 eggert Exp eggert $
+# $Id: rcs2log,v 1.4 1992/03/21 05:58:05 eggert Exp eggert $
# Generate a change log prefix from RCS/* and the existing ChangeLog (if any).
# Output the new prefix to standard output.
@@ -32,15 +32,23 @@ done
# Log into $rlogout the revisions checked in since the first ChangeLog entry.
-datearg=-d'>1970'
+date=1970
if test -s ChangeLog
then
- e='s/^\(...\) \(...\) \(..\) \(..:..:..\) \(....\) .*/\1 \2 \3 \4 \5/p; 1q'
- date=`sed -n "$e" <ChangeLog` || exit
- case $date in
- ?*) datearg="-d>$date"
+ # Add 1 to seconds to avoid duplicating most recent log.
+ # It's a good thing `rlog' doesn't mind a time ending in `:60'.
+ e='
+ /^... ... [ 0-9][0-9] [ 0-9][0-9]:[0-9][0-9]:[0-9][0-9] [0-9]+ /{
+ printf "%s%.2d %s\n", substr($0,1,17), substr($0,18,2)+1, $5
+ exit
+ }
+ '
+ d=`awk "$e" <ChangeLog` || exit
+ case $d in
+ ?*) date=$d
esac
fi
+datearg="-d>$date"
rlogout=/tmp/chg$$
trap exit 1 2 13 15
@@ -153,7 +161,7 @@ awk <$rlogout '
# and each line of the log is terminated by \r instead of \n.
# Sort the log entries, first by date (in reverse order),
# then by author, then by log entry, and finally by file name (just in case).
-sort +1 -2r +3 +0 |
+sort +1 -3r +3 +0 |
# Finally, reformat the sorted log entries.
awk '
@@ -208,6 +216,7 @@ awk '
# and use it to decide whether to output a blank line.
newclumpname = ""
sep = "\n"
+ if (date == "") sep = ""
if (newlog ~ /^{[^ }]+}[ ]/) {
i = index(newlog, "}")
newclumpname = substr(newlog, 1, i)
@@ -235,13 +244,13 @@ awk '
# into ugly ctime date like "Fri Jan 3 00:03:44 1992".
# Calculate day of week from Gregorian calendar.
i = index($2, "/")
- year = substr($2, 1, i-1)
+ year = substr($2, 1, i-1) + 0
monthday = substr($2, i+1)
i = index(monthday, "/")
- month = substr(monthday, 1, i-1)
- day = substr(monthday, i+1)
+ month = substr(monthday, 1, i-1) + 0
+ day = substr(monthday, i+1) + 0
leap = 0
- if (2 <= month && year%4 == 0 && (year%100 != 0 || year%400 == 0)) leap = 1
+ if (2 < month && year%4 == 0 && (year%100 != 0 || year%400 == 0)) leap = 1
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
# Print "date fullname (email address)" if the fullname is known;