diff options
| author | Paul Eggert | 2015-01-27 22:24:19 -0800 |
|---|---|---|
| committer | Paul Eggert | 2015-01-27 22:24:47 -0800 |
| commit | 39c2fa3f4e5bf332cc30266d36d5410c4ffeaac4 (patch) | |
| tree | e3331217ed3d9fab50de7d92fa1f2074138ac407 /lib-src | |
| parent | 0cdd599c54aeda36e7e0696b2f90d2c286153a1d (diff) | |
| download | emacs-39c2fa3f4e5bf332cc30266d36d5410c4ffeaac4.tar.gz emacs-39c2fa3f4e5bf332cc30266d36d5410c4ffeaac4.zip | |
Merge from gnulib and try to repair bad merge
This attempts to repair problems introduced by the bad merge
5491fd1098d27b3ba3db054076b9ab60fb3558dc. The easiest way for me
to fix the badly-merged gnulib files was to run
'admin/merge-gnulib', so I did that, which also imported the
following changes:
* build-aux/update-copyright, m4/gnulib.m4:
Update from gnulib, incorporating:
2015-01-15 time: port to MinGW32 3.21
2015-01-15 update-copyright: apply to self
2015-01-11 update-copyright: recognize groff's \(co marker
Diffstat (limited to 'lib-src')
| -rwxr-xr-x | lib-src/grep-changelog | 265 | ||||
| -rw-r--r-- | lib-src/test-distrib.c | 88 |
2 files changed, 0 insertions, 353 deletions
diff --git a/lib-src/grep-changelog b/lib-src/grep-changelog deleted file mode 100755 index 3e08734d7e9..00000000000 --- a/lib-src/grep-changelog +++ /dev/null | |||
| @@ -1,265 +0,0 @@ | |||
| 1 | #! /usr/bin/perl | ||
| 2 | |||
| 3 | # Copyright (C) 1999-2015 Free Software Foundation, Inc. | ||
| 4 | # | ||
| 5 | # This file is part of GNU Emacs. | ||
| 6 | |||
| 7 | # GNU Emacs is free software: you can redistribute it and/or modify | ||
| 8 | # it under the terms of the GNU General Public License as published by | ||
| 9 | # the Free Software Foundation, either version 3 of the License, or | ||
| 10 | # (at your option) any later version. | ||
| 11 | |||
| 12 | # GNU Emacs is distributed in the hope that it will be useful, | ||
| 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 15 | # GNU General Public License for more details. | ||
| 16 | |||
| 17 | # You should have received a copy of the GNU General Public License | ||
| 18 | # along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. | ||
| 19 | |||
| 20 | |||
| 21 | # Extract entries from ChangeLogs matching specified criteria. | ||
| 22 | # Optionally format the resulting output to a form suitable for RCS | ||
| 23 | # logs, like they are used in Emacs, for example. In this format, | ||
| 24 | # author lines, leading spaces, and file names are removed. | ||
| 25 | |||
| 26 | require 5; | ||
| 27 | use strict; | ||
| 28 | |||
| 29 | # Parse command line options. | ||
| 30 | |||
| 31 | use vars qw($author $regexp $exclude $from_date $to_date | ||
| 32 | $rcs_log $with_date $version $help $reverse | ||
| 33 | @entries); | ||
| 34 | |||
| 35 | use Getopt::Long; | ||
| 36 | |||
| 37 | my $result; | ||
| 38 | |||
| 39 | if (@ARGV == 0) { | ||
| 40 | |||
| 41 | # No arguments cannot possibly mean "show everything"!! | ||
| 42 | $result = 0; | ||
| 43 | |||
| 44 | } else { | ||
| 45 | |||
| 46 | $result = GetOptions ("author=s" => \$author, | ||
| 47 | "text=s" => \$regexp, | ||
| 48 | "exclude=s" => \$exclude, | ||
| 49 | "from-date=s" => \$from_date, | ||
| 50 | "to-date=s" => \$to_date, | ||
| 51 | "rcs-log" => \$rcs_log, | ||
| 52 | "with-date" => \$with_date, | ||
| 53 | "reverse!" => \$reverse, | ||
| 54 | "version" => \$version, | ||
| 55 | "help" => \$help); | ||
| 56 | |||
| 57 | # If date options are specified, check that they have the format | ||
| 58 | # YYYY-MM-DD. | ||
| 59 | |||
| 60 | $result = 0 if $from_date && $from_date !~ /^\d\d\d\d-\d\d-\d\d$/; | ||
| 61 | $result = 0 if $to_date && $to_date !~ /^\d\d\d\d-\d\d-\d\d$/; | ||
| 62 | } | ||
| 63 | |||
| 64 | # Print usage information and exit when necessary. | ||
| 65 | |||
| 66 | if ($result == 0 || $help) { | ||
| 67 | print <<USAGE; | ||
| 68 | |||
| 69 | Usage: $0 [options] [CHANGELOG...] | ||
| 70 | |||
| 71 | Print entries in ChangeLogs matching various criteria. | ||
| 72 | Valid options are: | ||
| 73 | |||
| 74 | --author=AUTHOR Match entries whose author line matches | ||
| 75 | regular expression AUTHOR | ||
| 76 | --text=TEXT Match entries whose text matches regular | ||
| 77 | expression TEXT | ||
| 78 | --exclude=TEXT Exclude entries matching TEXT | ||
| 79 | --from-date=YYYY-MM-DD Match entries not older than given date | ||
| 80 | --to-date=YYYY-MM-DD Match entries not younger than given date | ||
| 81 | --rcs-log Format output suitable for RCS log entries | ||
| 82 | --with-date Print short date line in RCS log | ||
| 83 | --reverse Show entries in reverse (chronological) order | ||
| 84 | --version Print version info | ||
| 85 | --help Print this help | ||
| 86 | |||
| 87 | If no CHANGELOG is specified scan the files "ChangeLog" and | ||
| 88 | "ChangeLog.N+" in the current directory. Old-style dates in ChangeLogs | ||
| 89 | are not recognized. | ||
| 90 | USAGE | ||
| 91 | exit !$help; | ||
| 92 | } | ||
| 93 | |||
| 94 | # Print version info and exit if `--version' was specified. | ||
| 95 | |||
| 96 | if ($version) { | ||
| 97 | print "0.3\n"; | ||
| 98 | exit 0; | ||
| 99 | } | ||
| 100 | |||
| 101 | |||
| 102 | # Value is non-zero if HEADER matches according to command line | ||
| 103 | # options specified, i.e. it matches $author, and its date is in | ||
| 104 | # the range $from_date <= date <= $to_date. | ||
| 105 | |||
| 106 | sub header_match_p { | ||
| 107 | my $header = shift; | ||
| 108 | |||
| 109 | return 0 unless $header; | ||
| 110 | |||
| 111 | # No match if AUTHOR-regexp specified and doesn't match. | ||
| 112 | return 0 if $author && $header !~ /$author/; | ||
| 113 | |||
| 114 | # Check that the date of the entry matches if date options | ||
| 115 | # `--from-date' and/or `--to-date' were specified . Old-style | ||
| 116 | # dates in ChangeLogs are not recognized, and never match. | ||
| 117 | if ($from_date || $to_date) { | ||
| 118 | if ($header =~ /^(\d\d\d\d-\d\d-\d\d)/) { | ||
| 119 | my $date = $1; | ||
| 120 | return 0 if $from_date && $date lt $from_date; | ||
| 121 | return 0 if $to_date && $date gt $to_date; | ||
| 122 | } else { | ||
| 123 | # Don't bother recognizing old-style dates. | ||
| 124 | return 0; | ||
| 125 | } | ||
| 126 | } | ||
| 127 | |||
| 128 | return 1; | ||
| 129 | } | ||
| 130 | |||
| 131 | |||
| 132 | # Value is non-zero if ENTRY matches the criteria specified on the | ||
| 133 | # command line, i.e. it matches $regexp, and it doesn't match | ||
| 134 | # $exclude. | ||
| 135 | |||
| 136 | sub entry_match_p { | ||
| 137 | my $entry = shift; | ||
| 138 | |||
| 139 | return 0 unless $entry; | ||
| 140 | |||
| 141 | if ($regexp) { | ||
| 142 | return 1 if ($entry =~ /$regexp/ | ||
| 143 | && (!$exclude || $entry !~ $exclude)); | ||
| 144 | } else { | ||
| 145 | return 1 if !$exclude || $entry !~ $exclude; | ||
| 146 | } | ||
| 147 | |||
| 148 | return 0; | ||
| 149 | } | ||
| 150 | |||
| 151 | |||
| 152 | # Print HEADER and/or ENTRY in a format suitable for what was | ||
| 153 | # specified on the command line. If $rcs_log is specified, author | ||
| 154 | # lines are not printed, and leading spaces and file names are removed | ||
| 155 | # from ChangeLog entries. | ||
| 156 | |||
| 157 | sub print_log { | ||
| 158 | my ($header, $entry) = @_; | ||
| 159 | my $output = ''; | ||
| 160 | |||
| 161 | if ($rcs_log) { | ||
| 162 | # Remove leading whitespace from entry. | ||
| 163 | $entry =~ s/^\s+//mg; | ||
| 164 | # Remove file name parts. | ||
| 165 | $entry =~ s/^\*.*\(/(/mg; | ||
| 166 | # Remove file name parts, 2. | ||
| 167 | $entry =~ s/^\*.*://mg; | ||
| 168 | if ($with_date) { | ||
| 169 | $header =~ /(\d\d\d\d-\d\d-\d\d)/; | ||
| 170 | $output = "!changelog-date $1\n"; | ||
| 171 | } | ||
| 172 | $output .= $entry; | ||
| 173 | } else { | ||
| 174 | $output .= $header . $entry; | ||
| 175 | } | ||
| 176 | |||
| 177 | if ($reverse) { | ||
| 178 | push @entries, $output; | ||
| 179 | } else { | ||
| 180 | print $output; | ||
| 181 | } | ||
| 182 | } | ||
| 183 | |||
| 184 | # Scan LOG for matching entries, and print them to standard output. | ||
| 185 | |||
| 186 | sub parse_changelog { | ||
| 187 | my $log = shift; | ||
| 188 | my $entry = undef; | ||
| 189 | my $header = undef; | ||
| 190 | |||
| 191 | @entries = () if $reverse; | ||
| 192 | |||
| 193 | # Open the ChangeLog. | ||
| 194 | open (IN, "< $log") || die "Cannot open $log: $!"; | ||
| 195 | |||
| 196 | while (defined(my $line = <IN>)) { | ||
| 197 | if ($line =~ /^\S/) { | ||
| 198 | # Line is an author-line. Print previous entry if | ||
| 199 | # it matches. | ||
| 200 | print_log ($header, $entry) | ||
| 201 | if header_match_p ($header) && entry_match_p ($entry); | ||
| 202 | |||
| 203 | $entry = ""; | ||
| 204 | $header = $line; | ||
| 205 | |||
| 206 | # Add empty lines below the header. | ||
| 207 | while (defined($line = <IN>) && $line =~ /^\s*$/) { | ||
| 208 | $header = "$header$line"; | ||
| 209 | } | ||
| 210 | } | ||
| 211 | |||
| 212 | last unless defined $line; | ||
| 213 | |||
| 214 | if ($line =~ /^\s*\*/) { | ||
| 215 | # LINE is the first line of a ChangeLog entry. Print | ||
| 216 | # previous entry if it matches. | ||
| 217 | print_log ($header, $entry) | ||
| 218 | if header_match_p ($header) && entry_match_p ($entry); | ||
| 219 | $entry = $line; | ||
| 220 | } else { | ||
| 221 | # Add LINE to the current entry. | ||
| 222 | $entry = "$entry$line"; | ||
| 223 | } | ||
| 224 | } | ||
| 225 | |||
| 226 | # Print last entry if it matches. | ||
| 227 | print_log ($header, $entry) | ||
| 228 | if header_match_p ($header) && entry_match_p ($entry); | ||
| 229 | |||
| 230 | close IN; | ||
| 231 | |||
| 232 | if ($reverse) { | ||
| 233 | for (my $entry = @entries; $entry; $entry--) { | ||
| 234 | print $entries[$entry-1]; | ||
| 235 | } | ||
| 236 | } | ||
| 237 | } | ||
| 238 | |||
| 239 | |||
| 240 | # Main program. Process ChangeLogs. | ||
| 241 | |||
| 242 | # If files were specified on the command line, parse those files in the | ||
| 243 | # order supplied by the user; otherwise parse default files ChangeLog and | ||
| 244 | # ChangeLog.NNN according to $reverse. | ||
| 245 | unless (@ARGV > 0) { | ||
| 246 | @ARGV = ("ChangeLog"); | ||
| 247 | |||
| 248 | push @ARGV, | ||
| 249 | map {"ChangeLog.$_"} | ||
| 250 | sort {$b <=> $a} | ||
| 251 | map {/\.(\d+)$/; $1} | ||
| 252 | do { | ||
| 253 | opendir D, '.'; | ||
| 254 | grep /^ChangeLog\.\d+$/, readdir D; | ||
| 255 | }; | ||
| 256 | |||
| 257 | @ARGV = reverse @ARGV if $reverse; | ||
| 258 | } | ||
| 259 | |||
| 260 | while (defined (my $log = shift @ARGV)) { | ||
| 261 | parse_changelog ($log) if -f $log; | ||
| 262 | } | ||
| 263 | |||
| 264 | |||
| 265 | # grep-changelog ends here. | ||
diff --git a/lib-src/test-distrib.c b/lib-src/test-distrib.c deleted file mode 100644 index 6a12201b894..00000000000 --- a/lib-src/test-distrib.c +++ /dev/null | |||
| @@ -1,88 +0,0 @@ | |||
| 1 | /* test-distrib.c --- testing distribution of nonprinting chars | ||
| 2 | |||
| 3 | Copyright (C) 1987, 1993-1995, 1999, 2001-2015 Free Software Foundation, | ||
| 4 | Inc. | ||
| 5 | |||
| 6 | This file is part of GNU Emacs. | ||
| 7 | |||
| 8 | GNU Emacs is free software: you can redistribute it and/or modify | ||
| 9 | it under the terms of the GNU General Public License as published by | ||
| 10 | the Free Software Foundation, either version 3 of the License, or | ||
| 11 | (at your option) any later version. | ||
| 12 | |||
| 13 | GNU Emacs is distributed in the hope that it will be useful, | ||
| 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 16 | GNU General Public License for more details. | ||
| 17 | |||
| 18 | You should have received a copy of the GNU General Public License | ||
| 19 | along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | ||
| 20 | |||
| 21 | |||
| 22 | #include <config.h> | ||
| 23 | #include <stdio.h> | ||
| 24 | #include <fcntl.h> | ||
| 25 | #include <unistd.h> | ||
| 26 | |||
| 27 | /* Break string in two parts to avoid buggy C compilers that ignore characters | ||
| 28 | after nulls in strings. */ | ||
| 29 | |||
| 30 | static char string1[] = "Testing distribution of nonprinting chars:\n\ | ||
| 31 | Should be 0177: \177 Should be 0377: \377 Should be 0212: \212.\n\ | ||
| 32 | Should be 0000: "; | ||
| 33 | |||
| 34 | static char string2[] = ".\n\ | ||
| 35 | This file is read by the `test-distribution' program.\n\ | ||
| 36 | If you change it, you will make that program fail.\n"; | ||
| 37 | |||
| 38 | /* Like `read' but keeps trying until it gets SIZE bytes or reaches eof. */ | ||
| 39 | static int | ||
| 40 | cool_read (int fd, char *buf, size_t size) | ||
| 41 | { | ||
| 42 | ssize_t num; | ||
| 43 | ssize_t sofar = 0; | ||
| 44 | |||
| 45 | while (1) | ||
| 46 | { | ||
| 47 | if ((num = read (fd, buf + sofar, size - sofar)) == 0) | ||
| 48 | return sofar; | ||
| 49 | else if (num < 0) | ||
| 50 | return num; | ||
| 51 | sofar += num; | ||
| 52 | } | ||
| 53 | } | ||
| 54 | |||
| 55 | int | ||
| 56 | main (int argc, char **argv) | ||
| 57 | { | ||
| 58 | int fd; | ||
| 59 | char buf[300]; | ||
| 60 | |||
| 61 | if (argc != 2) | ||
| 62 | { | ||
| 63 | fprintf (stderr, "Usage: %s testfile\n", argv[0]); | ||
| 64 | exit (EXIT_FAILURE); | ||
| 65 | } | ||
| 66 | fd = open (argv[1], O_RDONLY); | ||
| 67 | if (fd < 0) | ||
| 68 | { | ||
| 69 | perror (argv[1]); | ||
| 70 | exit (EXIT_FAILURE); | ||
| 71 | } | ||
| 72 | if (cool_read (fd, buf, sizeof string1) != sizeof string1 || | ||
| 73 | strcmp (buf, string1) || | ||
| 74 | cool_read (fd, buf, sizeof string2) != sizeof string2 - 1 || | ||
| 75 | strncmp (buf, string2, sizeof string2 - 1)) | ||
| 76 | { | ||
| 77 | fprintf (stderr, "Data in file `%s' has been damaged.\n\ | ||
| 78 | Most likely this means that many nonprinting characters\n\ | ||
| 79 | have been corrupted in the files of Emacs, and it will not work.\n", | ||
| 80 | argv[1]); | ||
| 81 | exit (EXIT_FAILURE); | ||
| 82 | } | ||
| 83 | close (fd); | ||
| 84 | return EXIT_SUCCESS; | ||
| 85 | } | ||
| 86 | |||
| 87 | |||
| 88 | /* test-distrib.c ends here */ | ||