diff options
| author | Paul Eggert | 1997-05-11 20:02:32 +0000 |
|---|---|---|
| committer | Paul Eggert | 1997-05-11 20:02:32 +0000 |
| commit | d74a9f24b3c852e47e5ab0b6e862a1544fda2ef7 (patch) | |
| tree | 718b2f8683036500e580ce322e26ac6afee5610f /lib-src | |
| parent | 8726160d7ee3e2b9080e40d85e0e234a078b3098 (diff) | |
| download | emacs-d74a9f24b3c852e47e5ab0b6e862a1544fda2ef7.tar.gz emacs-d74a9f24b3c852e47e5ab0b6e862a1544fda2ef7.zip | |
(loginFullnameMailaddrs, logins, rlog_options, files): Don't prepend $nl
since this causes some shells to generate the empty string when IFS is $nl.
(printlogline): Use SOH (octal code 1), not CR, since some PC-based shells
mishandle CR.
Diffstat (limited to 'lib-src')
| -rwxr-xr-x | lib-src/rcs2log | 63 |
1 files changed, 42 insertions, 21 deletions
diff --git a/lib-src/rcs2log b/lib-src/rcs2log index a983b53a6ec..d6abdeb0d0b 100755 --- a/lib-src/rcs2log +++ b/lib-src/rcs2log | |||
| @@ -28,7 +28,7 @@ Options: | |||
| 28 | 28 | ||
| 29 | Report bugs to <bug-gnu-emacs@prep.ai.mit.edu>.' | 29 | Report bugs to <bug-gnu-emacs@prep.ai.mit.edu>.' |
| 30 | 30 | ||
| 31 | Id='$Id: rcs2log,v 1.38 1997/03/23 18:46:03 eggert Exp eggert $' | 31 | Id='$Id: rcs2log,v 1.39 1997/05/11 18:43:55 eggert Exp eggert $' |
| 32 | 32 | ||
| 33 | # Copyright 1992, 1993, 1994, 1995, 1996, 1997 Free Software Foundation, Inc. | 33 | # Copyright 1992, 1993, 1994, 1995, 1996, 1997 Free Software Foundation, Inc. |
| 34 | 34 | ||
| @@ -90,7 +90,10 @@ do | |||
| 90 | echo >&2 "$0: -n '$2' '$3' '$4': tabs, newlines not allowed" | 90 | echo >&2 "$0: -n '$2' '$3' '$4': tabs, newlines not allowed" |
| 91 | exit 1 | 91 | exit 1 |
| 92 | esac | 92 | esac |
| 93 | loginFullnameMailaddrs=$loginFullnameMailaddrs$nl$2$tab$3$tab$4 | 93 | case $loginFullnameMailaddrs in |
| 94 | '') loginFullnameMailaddrs=$2$tab$3$tab$4;; | ||
| 95 | ?*) loginFullnameMailaddrs=$loginFullnameMailaddrs$nl$2$tab$3$tab$4 | ||
| 96 | esac | ||
| 94 | shift; shift; shift;; | 97 | shift; shift; shift;; |
| 95 | -u) | 98 | -u) |
| 96 | # If $2 is not tab-separated, use colon for separator. | 99 | # If $2 is not tab-separated, use colon for separator. |
| @@ -113,12 +116,23 @@ do | |||
| 113 | echo >&2 "$0: -u '$2': not enough fields" | 116 | echo >&2 "$0: -u '$2': not enough fields" |
| 114 | exit 1 | 117 | exit 1 |
| 115 | esac | 118 | esac |
| 116 | loginFullnameMailaddrs=$loginFullnameMailaddrs$nl$2 | 119 | case $loginFullnameMailaddrs in |
| 120 | '') loginFullnameMailaddrs=$2;; | ||
| 121 | ?*) loginFullnameMailaddrs=$loginFullnameMailaddrs$nl$2 | ||
| 122 | esac | ||
| 117 | shift | 123 | shift |
| 118 | esac | 124 | esac |
| 119 | logins=$logins$nl$login | 125 | case $logins in |
| 126 | '') logins=$login;; | ||
| 127 | ?*) logins=$logins$nl$login | ||
| 128 | esac | ||
| 120 | ;; | 129 | ;; |
| 121 | -r) rlog_options=$rlog_options$nl${2?}; shift;; | 130 | -r) |
| 131 | case $rlog_options in | ||
| 132 | '') rlog_options=${2?};; | ||
| 133 | ?*) rlog_options=$rlog_options$nl${2?} | ||
| 134 | esac | ||
| 135 | shift;; | ||
| 122 | -R) recursive=t;; | 136 | -R) recursive=t;; |
| 123 | -t) tabwidth=${2?}; shift;; | 137 | -t) tabwidth=${2?}; shift;; |
| 124 | -v) revision=t;; | 138 | -v) revision=t;; |
| @@ -225,7 +239,11 @@ fi | |||
| 225 | # Use $rlog's -zLT option, if $rlog supports it. | 239 | # Use $rlog's -zLT option, if $rlog supports it. |
| 226 | case `$rlog -zLT 2>&1` in | 240 | case `$rlog -zLT 2>&1` in |
| 227 | *' option'*) ;; | 241 | *' option'*) ;; |
| 228 | *) rlog_options=-zLT$nl$rlog_options | 242 | *) |
| 243 | case $rlog_options in | ||
| 244 | '') rlog_options=-zLT;; | ||
| 245 | ?*) rlog_options=-zLT$nl$rlog_options | ||
| 246 | esac | ||
| 229 | esac | 247 | esac |
| 230 | 248 | ||
| 231 | # With no arguments, examine all files under the RCS directory. | 249 | # With no arguments, examine all files under the RCS directory. |
| @@ -265,7 +283,10 @@ case $# in | |||
| 265 | RCS/.rcsfreeze.log | RCS/.rcsfreeze.ver) continue;; | 283 | RCS/.rcsfreeze.log | RCS/.rcsfreeze.ver) continue;; |
| 266 | RCS/.\* | RCS/\* | .\*,v | \*,v) test -f "$file" || continue | 284 | RCS/.\* | RCS/\* | .\*,v | \*,v) test -f "$file" || continue |
| 267 | esac | 285 | esac |
| 268 | files=$files$nl$file | 286 | case $files in |
| 287 | '') files=$file;; | ||
| 288 | ?*) files=$files$nl$file | ||
| 289 | esac | ||
| 269 | done | 290 | done |
| 270 | case $files in | 291 | case $files in |
| 271 | '') exit 0 | 292 | '') exit 0 |
| @@ -416,7 +437,7 @@ esac | |||
| 416 | 437 | ||
| 417 | # Function to print a single log line. | 438 | # Function to print a single log line. |
| 418 | # We don't use awk functions, to stay compatible with old awk versions. | 439 | # We don't use awk functions, to stay compatible with old awk versions. |
| 419 | # `Log' is the log message (with \n replaced by \r). | 440 | # `Log' is the log message (with \n replaced by \001). |
| 420 | # `files' contains the affected files. | 441 | # `files' contains the affected files. |
| 421 | printlogline='{ | 442 | printlogline='{ |
| 422 | 443 | ||
| @@ -432,13 +453,13 @@ printlogline='{ | |||
| 432 | 453 | ||
| 433 | # If "label: comment" is too long, break the line after the ":". | 454 | # If "label: comment" is too long, break the line after the ":". |
| 434 | sep = " " | 455 | sep = " " |
| 435 | if ('"$length"' <= '"$indent"' + 1 + length(files) + index(Log, CR)) sep = "\n" indent_string | 456 | if ('"$length"' <= '"$indent"' + 1 + length(files) + index(Log, SOH)) sep = "\n" indent_string |
| 436 | 457 | ||
| 437 | # Print the label. | 458 | # Print the label. |
| 438 | printf "%s*%s:", indent_string, files | 459 | printf "%s*%s:", indent_string, files |
| 439 | 460 | ||
| 440 | # Print each line of the log, transliterating \r to \n. | 461 | # Print each line of the log, transliterating \001 to \n. |
| 441 | while ((i = index(Log, CR)) != 0) { | 462 | while ((i = index(Log, SOH)) != 0) { |
| 442 | logline = substr(Log, 1, i-1) | 463 | logline = substr(Log, 1, i-1) |
| 443 | if (logline ~ /[^'"$tab"' ]/) { | 464 | if (logline ~ /[^'"$tab"' ]/) { |
| 444 | printf "%s%s\n", sep, logline | 465 | printf "%s%s\n", sep, logline |
| @@ -476,7 +497,7 @@ esac | |||
| 476 | # Process the rlog output, generating ChangeLog style entries. | 497 | # Process the rlog output, generating ChangeLog style entries. |
| 477 | 498 | ||
| 478 | # First, reformat the rlog output so that each line contains one log entry. | 499 | # First, reformat the rlog output so that each line contains one log entry. |
| 479 | # Transliterate \n to \r so that multiline entries fit on a single line. | 500 | # Transliterate \n to \001 so that multiline entries fit on a single line. |
| 480 | # Discard irrelevant rlog output. | 501 | # Discard irrelevant rlog output. |
| 481 | $AWK <$rlogout ' | 502 | $AWK <$rlogout ' |
| 482 | BEGIN { repository = "'"$repository"'" } | 503 | BEGIN { repository = "'"$repository"'" } |
| @@ -517,7 +538,7 @@ $AWK <$rlogout ' | |||
| 517 | } | 538 | } |
| 518 | time = substr($3, 1, length($3) - 1) | 539 | time = substr($3, 1, length($3) - 1) |
| 519 | author = substr($5, 1, length($5)-1) | 540 | author = substr($5, 1, length($5)-1) |
| 520 | printf "%s %s %s %s %s %c", filename, rev, date, time, author, 13 | 541 | printf "%s %s %s %s %s %c", filename, rev, date, time, author, 1 |
| 521 | rev = "?" | 542 | rev = "?" |
| 522 | next | 543 | next |
| 523 | } | 544 | } |
| @@ -526,14 +547,14 @@ $AWK <$rlogout ' | |||
| 526 | if ($0 == "Initial revision" || $0 ~ /^file .+ was initially added on branch .+\.$/) { | 547 | if ($0 == "Initial revision" || $0 ~ /^file .+ was initially added on branch .+\.$/) { |
| 527 | $0 = "New file." | 548 | $0 = "New file." |
| 528 | } | 549 | } |
| 529 | printf "%s%c", $0, 13 | 550 | printf "%s%c", $0, 1 |
| 530 | } | 551 | } |
| 531 | ' | | 552 | ' | |
| 532 | 553 | ||
| 533 | # Now each line is of the form | 554 | # Now each line is of the form |
| 534 | # FILENAME REVISION YYYY-MM-DD HH:MM:SS[+-TIMEZONE] AUTHOR \rLOG | 555 | # FILENAME REVISION YYYY-MM-DD HH:MM:SS[+-TIMEZONE] AUTHOR \001LOG |
| 535 | # where \r stands for a carriage return, | 556 | # where \001 stands for a carriage return, |
| 536 | # and each line of the log is terminated by \r instead of \n. | 557 | # and each line of the log is terminated by \001 instead of \n. |
| 537 | # Sort the log entries, first by date+time (in reverse order), | 558 | # Sort the log entries, first by date+time (in reverse order), |
| 538 | # then by author, then by log entry, and finally by file name and revision | 559 | # then by author, then by log entry, and finally by file name and revision |
| 539 | # (just in case). | 560 | # (just in case). |
| @@ -545,9 +566,9 @@ $AWK ' | |||
| 545 | logTZ = "'"$logTZ"'" | 566 | logTZ = "'"$logTZ"'" |
| 546 | revision = "'"$revision"'" | 567 | revision = "'"$revision"'" |
| 547 | 568 | ||
| 548 | # Some awk variants do not understand "\r" or "\015", so we have to | 569 | # Some awk variants do not understand "\001", so we have to |
| 549 | # put a carriage return directly in the file. | 570 | # put the char directly in the file. |
| 550 | CR=" " # <-- There is a single CR between the " chars here. | 571 | SOH="" # <-- There is a single SOH (octal code 001) here. |
| 551 | 572 | ||
| 552 | # Initialize the fullname and mailaddr associative arrays. | 573 | # Initialize the fullname and mailaddr associative arrays. |
| 553 | '"$initialize_fullname"' | 574 | '"$initialize_fullname"' |
| @@ -564,7 +585,7 @@ $AWK ' | |||
| 564 | } | 585 | } |
| 565 | 586 | ||
| 566 | { | 587 | { |
| 567 | newlog = substr($0, 1 + index($0, CR)) | 588 | newlog = substr($0, 1 + index($0, SOH)) |
| 568 | 589 | ||
| 569 | # Ignore log entries prefixed by "#". | 590 | # Ignore log entries prefixed by "#". |
| 570 | if (newlog ~ /^#/) { next } | 591 | if (newlog ~ /^#/) { next } |