diff options
Diffstat (limited to 'lib-src')
| -rwxr-xr-x | lib-src/rcs2log | 72 |
1 files changed, 54 insertions, 18 deletions
diff --git a/lib-src/rcs2log b/lib-src/rcs2log index d6c18c054fa..c61ca42d7ea 100755 --- a/lib-src/rcs2log +++ b/lib-src/rcs2log | |||
| @@ -12,7 +12,7 @@ | |||
| 12 | 12 | ||
| 13 | # Author: Paul Eggert <eggert@twinsun.com> | 13 | # Author: Paul Eggert <eggert@twinsun.com> |
| 14 | 14 | ||
| 15 | # $Id: rcs2log,v 1.8 1992/09/27 01:55:21 roland Exp eggert $ | 15 | # $Id: rcs2log,v 1.9 1993/01/15 05:33:29 eggert Exp $ |
| 16 | 16 | ||
| 17 | # Copyright 1992, 1993 Free Software Foundation, Inc. | 17 | # Copyright 1992, 1993 Free Software Foundation, Inc. |
| 18 | 18 | ||
| @@ -51,6 +51,19 @@ do | |||
| 51 | shift; shift | 51 | shift; shift |
| 52 | done | 52 | done |
| 53 | 53 | ||
| 54 | month_data=' | ||
| 55 | m[0]="Jan"; m[1]="Feb"; m[2]="Mar" | ||
| 56 | m[3]="Apr"; m[4]="May"; m[5]="Jun" | ||
| 57 | m[6]="Jul"; m[7]="Aug"; m[8]="Sep" | ||
| 58 | m[9]="Oct"; m[10]="Nov"; m[11]="Dec" | ||
| 59 | |||
| 60 | # days in non-leap year thus far, indexed by month (0-12) | ||
| 61 | mo[0]=0; mo[1]=31; mo[2]=59; mo[3]=90 | ||
| 62 | mo[4]=120; mo[5]=151; mo[6]=181; mo[7]=212 | ||
| 63 | mo[8]=243; mo[9]=273; mo[10]=304; mo[11]=334 | ||
| 64 | mo[12]=365 | ||
| 65 | ' | ||
| 66 | |||
| 54 | 67 | ||
| 55 | # Log into $rlogout the revisions checked in since the first ChangeLog entry. | 68 | # Log into $rlogout the revisions checked in since the first ChangeLog entry. |
| 56 | 69 | ||
| @@ -58,10 +71,39 @@ date=1970 | |||
| 58 | if test -s ChangeLog | 71 | if test -s ChangeLog |
| 59 | then | 72 | then |
| 60 | # Add 1 to seconds to avoid duplicating most recent log. | 73 | # Add 1 to seconds to avoid duplicating most recent log. |
| 61 | # It's a good thing `rlog' doesn't mind a time ending in `:60'. | ||
| 62 | e=' | 74 | e=' |
| 63 | /^... ... [ 0-9][0-9] [ 0-9][0-9]:[0-9][0-9]:[0-9][0-9] [0-9]+ /{ | 75 | /^... ... [ 0-9][0-9] [ 0-9][0-9]:[0-9][0-9]:[0-9][0-9] [0-9]+ /{ |
| 64 | printf "%s%02d %s\n", substr($0,1,17), substr($0,18,2)+1, $5 | 76 | '"$month_data"' |
| 77 | year = $5 | ||
| 78 | for (i=0; i<=11; i++) if (m[i] == $2) break | ||
| 79 | dd = $3 | ||
| 80 | hh = substr($0,12,2) | ||
| 81 | mm = substr($0,15,2) | ||
| 82 | ss = substr($0,18,2) | ||
| 83 | ss++ | ||
| 84 | if (ss == 60) { | ||
| 85 | ss = 0 | ||
| 86 | mm++ | ||
| 87 | if (mm == 60) { | ||
| 88 | mm = 0 | ||
| 89 | hh++ | ||
| 90 | if (hh == 24) { | ||
| 91 | hh = 0 | ||
| 92 | dd++ | ||
| 93 | monthdays = mo[i+1] - mo[i] | ||
| 94 | if (i == 1 && year%4 == 0 && (year%100 != 0 || year%400 == 0)) monthdays++ | ||
| 95 | if (dd == monthdays + 1) { | ||
| 96 | dd = 1 | ||
| 97 | i++ | ||
| 98 | if (i == 12) { | ||
| 99 | i = 0 | ||
| 100 | year++ | ||
| 101 | } | ||
| 102 | } | ||
| 103 | } | ||
| 104 | } | ||
| 105 | } | ||
| 106 | printf "%d/%02d/%02d %02d:%02d:%02d\n", year, i+1, dd, hh, mm, ss | ||
| 65 | exit | 107 | exit |
| 66 | } | 108 | } |
| 67 | ' | 109 | ' |
| @@ -151,13 +193,13 @@ printlogline='{ | |||
| 151 | 193 | ||
| 152 | # If "label: comment" is too long, break the line after the ":". | 194 | # If "label: comment" is too long, break the line after the ":". |
| 153 | sep = " " | 195 | sep = " " |
| 154 | if ('"$length"' <= '"$indent"' + 1 + length(files) + index(Log, "\r")) sep = "\n" indent_string | 196 | if ('"$length"' <= '"$indent"' + 1 + length(files) + index(Log, CR)) sep = "\n" indent_string |
| 155 | 197 | ||
| 156 | # Print the label. | 198 | # Print the label. |
| 157 | printf "%s*%s:", indent_string, files | 199 | printf "%s*%s:", indent_string, files |
| 158 | 200 | ||
| 159 | # Print each line of the log, transliterating \r to \n. | 201 | # Print each line of the log, transliterating \r to \n. |
| 160 | while ((i = index(Log, "\r")) != 0) { | 202 | while ((i = index(Log, CR)) != 0) { |
| 161 | printf "%s%s\n", sep, substr(Log, 1, i-1) | 203 | printf "%s%s\n", sep, substr(Log, 1, i-1) |
| 162 | sep = indent_string | 204 | sep = indent_string |
| 163 | Log = substr(Log, i+1) | 205 | Log = substr(Log, i+1) |
| @@ -184,11 +226,11 @@ awk <$rlogout ' | |||
| 184 | if ($0 ~ /^date: [0-9][ /0-9:]*;/) { | 226 | if ($0 ~ /^date: [0-9][ /0-9:]*;/) { |
| 185 | time = substr($3, 1, length($3)-1) | 227 | time = substr($3, 1, length($3)-1) |
| 186 | author = substr($5, 1, length($5)-1) | 228 | author = substr($5, 1, length($5)-1) |
| 187 | printf "%s %s %s %s \r", filename, $2, time, author | 229 | printf "%s %s %s %s %c", filename, $2, time, author, 13 |
| 188 | next | 230 | next |
| 189 | } | 231 | } |
| 190 | if ($0 ~ /^(-----------*|===========*)$/) { print ""; next } | 232 | if ($0 ~ /^(-----------*|===========*)$/) { print ""; next } |
| 191 | printf "%s\r", $0 | 233 | printf "%s%c", $0, 13 |
| 192 | } | 234 | } |
| 193 | ' | | 235 | ' | |
| 194 | 236 | ||
| @@ -203,6 +245,9 @@ sort +1 -3r +3 +0 | | |||
| 203 | # Finally, reformat the sorted log entries. | 245 | # Finally, reformat the sorted log entries. |
| 204 | awk ' | 246 | awk ' |
| 205 | BEGIN { | 247 | BEGIN { |
| 248 | # Some awks do not understand "\r" or "\013", so we have to | ||
| 249 | # put a carriage return directly in the file. | ||
| 250 | CR=" " # <-- There is a single CR between the " chars here. | ||
| 206 | 251 | ||
| 207 | # Initialize the fullname associative array. | 252 | # Initialize the fullname associative array. |
| 208 | '"$initialize_fullname"' | 253 | '"$initialize_fullname"' |
| @@ -227,20 +272,11 @@ awk ' | |||
| 227 | w[0]="Sun"; w[1]="Mon"; w[2]="Tue"; w[3]="Wed" | 272 | w[0]="Sun"; w[1]="Mon"; w[2]="Tue"; w[3]="Wed" |
| 228 | w[4]="Thu"; w[5]="Fri"; w[6]="Sat" | 273 | w[4]="Thu"; w[5]="Fri"; w[6]="Sat" |
| 229 | 274 | ||
| 230 | m[0]="Jan"; m[1]="Feb"; m[2]="Mar" | 275 | '"$month_data"' |
| 231 | m[3]="Apr"; m[4]="May"; m[5]="Jun" | ||
| 232 | m[6]="Jul"; m[7]="Aug"; m[8]="Sep" | ||
| 233 | m[9]="Oct"; m[10]="Nov"; m[11]="Dec" | ||
| 234 | |||
| 235 | # days in non-leap year thus far, indexed by month (0-12) | ||
| 236 | mo[0]=0; mo[1]=31; mo[2]=59; mo[3]=90 | ||
| 237 | mo[4]=120; mo[5]=151; mo[6]=181; mo[7]=212 | ||
| 238 | mo[8]=243; mo[9]=273; mo[10]=304; mo[11]=334 | ||
| 239 | mo[12]=365 | ||
| 240 | } | 276 | } |
| 241 | 277 | ||
| 242 | { | 278 | { |
| 243 | newlog = substr($0, 1 + index($0, "\r")) | 279 | newlog = substr($0, 1 + index($0, CR)) |
| 244 | 280 | ||
| 245 | # Ignore log entries prefixed by "#". | 281 | # Ignore log entries prefixed by "#". |
| 246 | if (newlog ~ /^#/) { next } | 282 | if (newlog ~ /^#/) { next } |