Mercurial > emacs
annotate lib-src/grep-changelog @ 83431:76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
* src/termhooks.h (struct device): Rename to `terminal'. Rename member
`next_device' to `next_terminal'.
(device_list): Rename to `terminal_list'.
(FRAME_DEVICE): Rename to `FRAME_TERMINAL'.
(DEVICE_TERMINAL_CODING): Rename to `TERMINAL_TERMINAL_CODING'.
(TERMINAL_KEYBOARD_CODING): Rename to `TERMINAL_KEYBOARD_CODING'.
(DEVICE_ACTIVE_P): Rename to `TERMINAL_ACTIVE_P'.
Update declarations and macro definitions.
* src/termchar.h (tty_display_info): Rename member `device' to `terminal'.
(FRAME_TTY): Update for renames.
* src/xterm.h (x_display_info): Rename member `device' to `terminal'.
* src/frame.h (frame): Rename `device' member to `terminal'.
(FRAME_KBOARD, FRAME_LIVE_P, Qdevice, Qdisplay_live_p):
Update for renames.
* src/lisp.h (set_process_environment): Rename to `set_global_environment'.
(device): Rename to `terminal'.
* src/dispextern.h: Update declarations and macro definitions.
* src/terminal.c (device_list): Rename to `terminal_list'.
(next_device_id): Rename to `next_terminal_id'.
(initial_device): Rename to `initial_terminal'.
(get_device): Rename to `get_terminal'.
(create_device): Rename to `create_terminal'.
(mark_devices): Rename to `mark_terminals'.
(delete_device): Rename to `delete_terminal'.
(Fdelete_display): Rename to `Fdelete_terminal'.
(Fframe_terminal): Move here from frame.c.
(Fdisplay_live_p): Rename to `Fterminal_live_p'.
(Fdisplay_list): Rename to `Fterminal_list'.
(Fdisplay_name): Rename to `Fterminal_name'.
(init_initial_device): Rename to `init_initial_terminal'.
(delete_initial_device): Rename to `delete_initial_terminal'.
(ring_bell, update_begin, update_end, set_terminal_window)
(cursor_to, raw_cursor_to, clear_to_end, clear_frame)
(clear_end_of_line, write_glyphs, insert_glyphs, delete_glyphs)
(ins_del_lines, get_terminal_param, store_terminal_param)
(Fterminal_parameters, Fterminal_parameter)
(Fmodify_terminal_parameters, Fset_terminal_parameter)
(syms_of_terminal): Update for renames.
* src/term.c (get_tty_device): Rename to `get_tty_terminal'. Update.
(Fdisplay_tty_type): Rename to `Ftty_type'.
(Fdisplay_controlling_tty_p): Rename to `Fcontrolling_tty_p'.
(delete_tty, tty_set_terminal_modes, tty_reset_terminal_modes)
(Ftty_display_color_p, Ftty_display_color_cells, get_named_tty)
(Ftty_no_underline, Fsuspend_tty, Fresume_tty, create_tty_output)
(init_tty, maybe_fatal, delete_tty, syms_of_term): Update for rename.
* src/frame.c (Qdevice): Rename to `Qterminal'.
(Qdisplay_live_p): Rename to `Qterminal_live_p'.
(terminal_frame_count): Rename to `tty_frame_count'.
(Fframe_display): Move to terminal.c, rename to `Fframe_terminal'.
(make_frame_without_minibuffer, make_initial_frame)
(make_terminal_frame, Fmodify_frame_parameters)
(do_switch_frame, Fdelete_frame, Fmouse_position)
(Fmouse_pixel_position, Fraise_frame, Flower_frame)
(Fredirect_frame_focus, set_term_frame_name, syms_of_frame):
Update for renames.
* src/xdisp.c (message2_nolog, message3_nolog, redisplay_internal)
(set_vertical_scroll_bar, redisplay_window, check_x_display_info)
(x_set_scroll_bar_foreground, x_set_scroll_bar_background)
(Fx_create_frame, Fxw_display_color_p, Fx_display_grayscale_p)
(Fx_display_pixel_width, Fx_display_pixel_height)
(Fx_display_planes, Fx_display_color_cells)
(Fx_server_max_request_size, Fx_server_vendor, Fx_server_version)
(Fx_display_screens, Fx_display_mm_height, Fx_display_mm_width)
(Fx_display_backing_store, Fx_display_visual_class)
(Fx_display_save_under, Fx_close_connection, x_create_tip_frame):
Update for renames.
* xterm.c (handle_one_xevent): Initialize `f' to NULL.
(x_delete_device): Rename to `x_delete_terminal'.
(x_create_device): Rename to `x_create_terminal'.
(XTset_terminal_modes, XTreset_terminal_modes)
(XTread_socket, x_connection_closed, x_term_init)
(x_term_init, x_delete_display): Update for renames.
* src/dispnew.c (Fredraw_frame, Fsend_string_to_terminal)
(Fsend_string_to_terminal, init_display): Update for renames.
* src/keyboard.c (push_frame_kboard, pop_kboard, pop_kboard)
(kbd_buffer_get_event, read_avail_input, tty_read_avail_input)
(interrupt_signal, Fset_output_flow_control)
(Fset_input_meta_mode, Fset_quit_char, delete_kboard)
(syms_of_keyboard): Update for renames.
* src/alloc.c (mark_devices): Update declaration.
(Fgarbage_collect): Update for renames.
* src/coding.c (Fset_terminal_coding_system_internal)
(Fterminal_coding_system4)
(Fset_keyboard_coding_system_internal)
(Fkeyboard_coding_system): Update for renames.
* src/data.c (Fterminal_local_value, Fset_terminal_local_value):
Update for renames.
* src/minibuf.c (read_minibuf): Update for renames.
* src/sysdep.c (init_sys_modes, reset_sys_modes): Update for renames.
* xselect.c (x_handle_selection_clear): Update for renames.
* lisp/files.el (save-buffers-kill-display): Rename to `save-buffers-kill-terminal'.
(save-buffers-kill-terminal, ctl-x-map): Update for renames.
* frame.el (make-frame): Rename 'device frame parameter to 'terminal. Update.
(frames-on-display-list, framep-on-display, suspend-frame): Update for renames.
(selected-display): Rename to `selected-terminal'.
* server.el (server-save-buffers-kill-display): Rename to
`server-save-buffers-kill-terminal'.
(server-delete-client, server-handle-delete-frame)
(server-handle-suspend-tty, server-process-filter)
(server-switch-buffer): Update for renames.
* startup.el (normal-splash-screen, normal-splash-screen): Update for renames.
* talk.el (talk): Update for renames.
* termdev.el (terminal-id): Update for renames.
* xt-mouse.el (turn-on-xterm-mouse-tracking-on-terminal)
(turn-off-xterm-mouse-tracking-on-terminal)
(xterm-mouse-handle-delete-frame): Update for renames.
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-471
author | Karoly Lorentey <lorentey@elte.hu> |
---|---|
date | Thu, 29 Dec 2005 18:20:26 +0000 |
parents | 6358e3c6075c |
children | 3661e9b3c48f 2d92f5c9d6ae |
rev | line source |
---|---|
28823 | 1 #! /usr/bin/perl |
25216 | 2 |
64769
6358e3c6075c
Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
64083
diff
changeset
|
3 # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, |
6358e3c6075c
Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
64083
diff
changeset
|
4 # 2005 Free Software Foundation, Inc. |
25216 | 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 2, or (at your option) | |
11 # 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; see the file COPYING. If not, write to the | |
64083 | 20 # Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
21 # Boston, MA 02110-1301, USA. | |
25216 | 22 |
23 | |
24 # Extract entries from ChangeLogs matching specified criteria. | |
25 # Optionally format the resulting output to a form suitable for RCS | |
26 # logs, like they are used in Emacs, for example. In this format, | |
38551
6bd3c93022e7
(parse_changelog): Remove unused local variable.
Gerd Moellmann <gerd@gnu.org>
parents:
38510
diff
changeset
|
27 # author lines, leading spaces, and file names are removed. |
25216 | 28 |
29 require 5; | |
38509
59acf1c91dd2
(main, parse_changelog): Make "use strict"-clean.
Gerd Moellmann <gerd@gnu.org>
parents:
38504
diff
changeset
|
30 use strict; |
25216 | 31 |
32 # Parse command line options. | |
33 | |
38509
59acf1c91dd2
(main, parse_changelog): Make "use strict"-clean.
Gerd Moellmann <gerd@gnu.org>
parents:
38504
diff
changeset
|
34 use vars qw($author $regexp $exclude $from_date $to_date |
38551
6bd3c93022e7
(parse_changelog): Remove unused local variable.
Gerd Moellmann <gerd@gnu.org>
parents:
38510
diff
changeset
|
35 $rcs_log $with_date $version $help $reverse |
6bd3c93022e7
(parse_changelog): Remove unused local variable.
Gerd Moellmann <gerd@gnu.org>
parents:
38510
diff
changeset
|
36 @entries); |
38509
59acf1c91dd2
(main, parse_changelog): Make "use strict"-clean.
Gerd Moellmann <gerd@gnu.org>
parents:
38504
diff
changeset
|
37 |
25216 | 38 use Getopt::Long; |
38509
59acf1c91dd2
(main, parse_changelog): Make "use strict"-clean.
Gerd Moellmann <gerd@gnu.org>
parents:
38504
diff
changeset
|
39 my $result = GetOptions ("author=s" => \$author, |
59acf1c91dd2
(main, parse_changelog): Make "use strict"-clean.
Gerd Moellmann <gerd@gnu.org>
parents:
38504
diff
changeset
|
40 "text=s" => \$regexp, |
59acf1c91dd2
(main, parse_changelog): Make "use strict"-clean.
Gerd Moellmann <gerd@gnu.org>
parents:
38504
diff
changeset
|
41 "exclude=s" => \$exclude, |
59acf1c91dd2
(main, parse_changelog): Make "use strict"-clean.
Gerd Moellmann <gerd@gnu.org>
parents:
38504
diff
changeset
|
42 "from-date=s" => \$from_date, |
59acf1c91dd2
(main, parse_changelog): Make "use strict"-clean.
Gerd Moellmann <gerd@gnu.org>
parents:
38504
diff
changeset
|
43 "to-date=s" => \$to_date, |
59acf1c91dd2
(main, parse_changelog): Make "use strict"-clean.
Gerd Moellmann <gerd@gnu.org>
parents:
38504
diff
changeset
|
44 "rcs-log" => \$rcs_log, |
59acf1c91dd2
(main, parse_changelog): Make "use strict"-clean.
Gerd Moellmann <gerd@gnu.org>
parents:
38504
diff
changeset
|
45 "with-date" => \$with_date, |
38551
6bd3c93022e7
(parse_changelog): Remove unused local variable.
Gerd Moellmann <gerd@gnu.org>
parents:
38510
diff
changeset
|
46 "reverse!" => \$reverse, |
38509
59acf1c91dd2
(main, parse_changelog): Make "use strict"-clean.
Gerd Moellmann <gerd@gnu.org>
parents:
38504
diff
changeset
|
47 "version" => \$version, |
59acf1c91dd2
(main, parse_changelog): Make "use strict"-clean.
Gerd Moellmann <gerd@gnu.org>
parents:
38504
diff
changeset
|
48 "help" => \$help); |
25216 | 49 |
50 # If date options are specified, check that they have the format | |
51 # YYYY-MM-DD. | |
52 | |
53 $result = 0 if $from_date && $from_date !~ /^\d\d\d\d-\d\d-\d\d$/; | |
54 $result = 0 if $to_date && $to_date !~ /^\d\d\d\d-\d\d-\d\d$/; | |
55 | |
56 # Print usage information and exit when necessary. | |
57 | |
58 if ($result == 0 || $help) { | |
59 print <<USAGE; | |
54324
bdf4aa3226e7
Changes to support ChangeLog.10+.
Juanma Barranquero <lekktu@gmail.com>
parents:
52401
diff
changeset
|
60 |
25216 | 61 Usage: $0 [options] [CHANGELOG...] |
62 | |
54324
bdf4aa3226e7
Changes to support ChangeLog.10+.
Juanma Barranquero <lekktu@gmail.com>
parents:
52401
diff
changeset
|
63 Print entries in ChangeLogs matching various criteria. |
bdf4aa3226e7
Changes to support ChangeLog.10+.
Juanma Barranquero <lekktu@gmail.com>
parents:
52401
diff
changeset
|
64 Valid options are: |
bdf4aa3226e7
Changes to support ChangeLog.10+.
Juanma Barranquero <lekktu@gmail.com>
parents:
52401
diff
changeset
|
65 |
bdf4aa3226e7
Changes to support ChangeLog.10+.
Juanma Barranquero <lekktu@gmail.com>
parents:
52401
diff
changeset
|
66 --author=AUTHOR Match entries whose author line matches |
25216 | 67 regular expression AUTHOR |
54324
bdf4aa3226e7
Changes to support ChangeLog.10+.
Juanma Barranquero <lekktu@gmail.com>
parents:
52401
diff
changeset
|
68 --text=TEXT Match entries whose text matches regular |
bdf4aa3226e7
Changes to support ChangeLog.10+.
Juanma Barranquero <lekktu@gmail.com>
parents:
52401
diff
changeset
|
69 expression TEXT |
bdf4aa3226e7
Changes to support ChangeLog.10+.
Juanma Barranquero <lekktu@gmail.com>
parents:
52401
diff
changeset
|
70 --exclude=TEXT Exclude entries matching TEXT |
bdf4aa3226e7
Changes to support ChangeLog.10+.
Juanma Barranquero <lekktu@gmail.com>
parents:
52401
diff
changeset
|
71 --from-date=YYYY-MM-DD Match entries not older than given date |
bdf4aa3226e7
Changes to support ChangeLog.10+.
Juanma Barranquero <lekktu@gmail.com>
parents:
52401
diff
changeset
|
72 --to-date=YYYY-MM-DD Match entries not younger than given date |
bdf4aa3226e7
Changes to support ChangeLog.10+.
Juanma Barranquero <lekktu@gmail.com>
parents:
52401
diff
changeset
|
73 --rcs-log Format output suitable for RCS log entries |
bdf4aa3226e7
Changes to support ChangeLog.10+.
Juanma Barranquero <lekktu@gmail.com>
parents:
52401
diff
changeset
|
74 --with-date Print short date line in RCS log |
bdf4aa3226e7
Changes to support ChangeLog.10+.
Juanma Barranquero <lekktu@gmail.com>
parents:
52401
diff
changeset
|
75 --reverse Show entries in reverse (chronological) order |
bdf4aa3226e7
Changes to support ChangeLog.10+.
Juanma Barranquero <lekktu@gmail.com>
parents:
52401
diff
changeset
|
76 --version Print version info |
bdf4aa3226e7
Changes to support ChangeLog.10+.
Juanma Barranquero <lekktu@gmail.com>
parents:
52401
diff
changeset
|
77 --help Print this help |
25216 | 78 |
79 If no CHANGELOG is specified scan the files "ChangeLog" and | |
54324
bdf4aa3226e7
Changes to support ChangeLog.10+.
Juanma Barranquero <lekktu@gmail.com>
parents:
52401
diff
changeset
|
80 "ChangeLog.1+" in the current directory. Old-style dates in ChangeLogs |
25216 | 81 are not recognized. |
82 USAGE | |
54324
bdf4aa3226e7
Changes to support ChangeLog.10+.
Juanma Barranquero <lekktu@gmail.com>
parents:
52401
diff
changeset
|
83 exit !$help; |
25216 | 84 } |
85 | |
86 # Print version info and exit if `--version' was specified. | |
87 | |
88 if ($version) { | |
54324
bdf4aa3226e7
Changes to support ChangeLog.10+.
Juanma Barranquero <lekktu@gmail.com>
parents:
52401
diff
changeset
|
89 print "0.2\n"; |
25216 | 90 exit 0; |
91 } | |
92 | |
93 | |
94 # Value is non-zero if HEADER matches according to command line | |
95 # options specified, i.e. it matches $author, and its date is in | |
96 # the range $from_date <= date <= $to_date. | |
97 | |
54324
bdf4aa3226e7
Changes to support ChangeLog.10+.
Juanma Barranquero <lekktu@gmail.com>
parents:
52401
diff
changeset
|
98 sub header_match_p { |
25216 | 99 my $header = shift; |
100 | |
38502
180f542bf5b4
(entry_match_p, header_match_p): Fix handling of null or empty
Gerd Moellmann <gerd@gnu.org>
parents:
38500
diff
changeset
|
101 return 0 unless $header; |
180f542bf5b4
(entry_match_p, header_match_p): Fix handling of null or empty
Gerd Moellmann <gerd@gnu.org>
parents:
38500
diff
changeset
|
102 |
25216 | 103 # No match if AUTHOR-regexp specified and doesn't match. |
104 return 0 if $author && $header !~ /$author/; | |
105 | |
106 # Check that the date of the entry matches if date options | |
107 # `--from-date' and/or `--to-date' were specified . Old-style | |
108 # dates in ChangeLogs are not recognized, and never match. | |
109 if ($from_date || $to_date) { | |
110 if ($header =~ /^(\d\d\d\d-\d\d-\d\d)/) { | |
111 my $date = $1; | |
112 return 0 if $from_date && $date lt $from_date; | |
113 return 0 if $to_date && $date gt $to_date; | |
114 } else { | |
115 # Don't bother recognizing old-style dates. | |
116 return 0; | |
117 } | |
118 } | |
119 | |
120 return 1; | |
121 } | |
122 | |
123 | |
29638
f6a97d806845
Fix typos in comments. Remove trailing blanks.
Jim Meyering <jim@meyering.net>
parents:
28823
diff
changeset
|
124 # Value is non-zero if ENTRY matches the criteria specified on the |
25216 | 125 # command line, i.e. it matches $regexp, and it doesn't match |
126 # $exclude. | |
127 | |
54324
bdf4aa3226e7
Changes to support ChangeLog.10+.
Juanma Barranquero <lekktu@gmail.com>
parents:
52401
diff
changeset
|
128 sub entry_match_p { |
25216 | 129 my $entry = shift; |
130 | |
38502
180f542bf5b4
(entry_match_p, header_match_p): Fix handling of null or empty
Gerd Moellmann <gerd@gnu.org>
parents:
38500
diff
changeset
|
131 return 0 unless $entry; |
180f542bf5b4
(entry_match_p, header_match_p): Fix handling of null or empty
Gerd Moellmann <gerd@gnu.org>
parents:
38500
diff
changeset
|
132 |
25216 | 133 if ($regexp) { |
29638
f6a97d806845
Fix typos in comments. Remove trailing blanks.
Jim Meyering <jim@meyering.net>
parents:
28823
diff
changeset
|
134 return 1 if ($entry =~ /$regexp/ |
25216 | 135 && (!$exclude || $entry !~ $exclude)); |
136 } else { | |
137 return 1 if !$exclude || $entry !~ $exclude; | |
138 } | |
139 | |
140 return 0; | |
141 } | |
142 | |
143 | |
144 # Print HEADER and/or ENTRY in a format suitable for what was | |
145 # specified on the command line. If $rcs_log is specified, author | |
146 # lines are not printed, and leading spaces and file names are removed | |
147 # from ChangeLog entries. | |
148 | |
54324
bdf4aa3226e7
Changes to support ChangeLog.10+.
Juanma Barranquero <lekktu@gmail.com>
parents:
52401
diff
changeset
|
149 sub print_log { |
25216 | 150 my ($header, $entry) = @_; |
38551
6bd3c93022e7
(parse_changelog): Remove unused local variable.
Gerd Moellmann <gerd@gnu.org>
parents:
38510
diff
changeset
|
151 my $output = ''; |
25216 | 152 |
153 if ($rcs_log) { | |
154 # Remove leading whitespace from entry. | |
155 $entry =~ s/^\s+//mg; | |
156 # Remove file name parts. | |
157 $entry =~ s/^\*.*\(/(/mg; | |
158 # Remove file name parts, 2. | |
159 $entry =~ s/^\*.*://mg; | |
160 if ($with_date) { | |
161 $header =~ /(\d\d\d\d-\d\d-\d\d)/; | |
38551
6bd3c93022e7
(parse_changelog): Remove unused local variable.
Gerd Moellmann <gerd@gnu.org>
parents:
38510
diff
changeset
|
162 $output = "!changelog-date $1\n"; |
25216 | 163 } |
38551
6bd3c93022e7
(parse_changelog): Remove unused local variable.
Gerd Moellmann <gerd@gnu.org>
parents:
38510
diff
changeset
|
164 $output .= $entry; |
25216 | 165 } else { |
38551
6bd3c93022e7
(parse_changelog): Remove unused local variable.
Gerd Moellmann <gerd@gnu.org>
parents:
38510
diff
changeset
|
166 $output .= $header . $entry; |
6bd3c93022e7
(parse_changelog): Remove unused local variable.
Gerd Moellmann <gerd@gnu.org>
parents:
38510
diff
changeset
|
167 } |
6bd3c93022e7
(parse_changelog): Remove unused local variable.
Gerd Moellmann <gerd@gnu.org>
parents:
38510
diff
changeset
|
168 |
6bd3c93022e7
(parse_changelog): Remove unused local variable.
Gerd Moellmann <gerd@gnu.org>
parents:
38510
diff
changeset
|
169 if ($reverse) { |
6bd3c93022e7
(parse_changelog): Remove unused local variable.
Gerd Moellmann <gerd@gnu.org>
parents:
38510
diff
changeset
|
170 push @entries, $output; |
6bd3c93022e7
(parse_changelog): Remove unused local variable.
Gerd Moellmann <gerd@gnu.org>
parents:
38510
diff
changeset
|
171 } else { |
6bd3c93022e7
(parse_changelog): Remove unused local variable.
Gerd Moellmann <gerd@gnu.org>
parents:
38510
diff
changeset
|
172 print $output; |
25216 | 173 } |
174 } | |
175 | |
176 # Scan LOG for matching entries, and print them to standard output. | |
177 | |
54324
bdf4aa3226e7
Changes to support ChangeLog.10+.
Juanma Barranquero <lekktu@gmail.com>
parents:
52401
diff
changeset
|
178 sub parse_changelog { |
25216 | 179 my $log = shift; |
38509
59acf1c91dd2
(main, parse_changelog): Make "use strict"-clean.
Gerd Moellmann <gerd@gnu.org>
parents:
38504
diff
changeset
|
180 my $entry = undef; |
59acf1c91dd2
(main, parse_changelog): Make "use strict"-clean.
Gerd Moellmann <gerd@gnu.org>
parents:
38504
diff
changeset
|
181 my $header = undef; |
38551
6bd3c93022e7
(parse_changelog): Remove unused local variable.
Gerd Moellmann <gerd@gnu.org>
parents:
38510
diff
changeset
|
182 |
6bd3c93022e7
(parse_changelog): Remove unused local variable.
Gerd Moellmann <gerd@gnu.org>
parents:
38510
diff
changeset
|
183 @entries = () if $reverse; |
25216 | 184 |
185 # Open the ChangeLog. | |
186 open (IN, "< $log") || die "Cannot open $log: $!"; | |
187 | |
38509
59acf1c91dd2
(main, parse_changelog): Make "use strict"-clean.
Gerd Moellmann <gerd@gnu.org>
parents:
38504
diff
changeset
|
188 while (defined(my $line = <IN>)) { |
25216 | 189 if ($line =~ /^\S/) { |
190 # Line is an author-line. Print previous entry if | |
191 # it matches. | |
29638
f6a97d806845
Fix typos in comments. Remove trailing blanks.
Jim Meyering <jim@meyering.net>
parents:
28823
diff
changeset
|
192 print_log ($header, $entry) |
25216 | 193 if header_match_p ($header) && entry_match_p ($entry); |
194 | |
195 $entry = ""; | |
196 $header = $line; | |
197 | |
198 # Add empty lines below the header. | |
38500
3db3b0888252
(parse_changelog): Add test for defined value to
Gerd Moellmann <gerd@gnu.org>
parents:
29638
diff
changeset
|
199 while (defined($line = <IN>) && $line =~ /^\s*$/) { |
25216 | 200 $header = "$header$line"; |
201 } | |
29638
f6a97d806845
Fix typos in comments. Remove trailing blanks.
Jim Meyering <jim@meyering.net>
parents:
28823
diff
changeset
|
202 } |
25216 | 203 |
38504
1d53627a58ae
(parse_changelog): Add another test for defined value to
Gerd Moellmann <gerd@gnu.org>
parents:
38502
diff
changeset
|
204 last unless defined $line; |
1d53627a58ae
(parse_changelog): Add another test for defined value to
Gerd Moellmann <gerd@gnu.org>
parents:
38502
diff
changeset
|
205 |
25216 | 206 if ($line =~ /^\s*\*/) { |
207 # LINE is the first line of a ChangeLog entry. Print | |
208 # previous entry if it matches. | |
29638
f6a97d806845
Fix typos in comments. Remove trailing blanks.
Jim Meyering <jim@meyering.net>
parents:
28823
diff
changeset
|
209 print_log ($header, $entry) |
25216 | 210 if header_match_p ($header) && entry_match_p ($entry); |
211 $entry = $line; | |
212 } else { | |
213 # Add LINE to the current entry. | |
214 $entry = "$entry$line"; | |
215 } | |
216 } | |
217 | |
218 # Print last entry if it matches. | |
29638
f6a97d806845
Fix typos in comments. Remove trailing blanks.
Jim Meyering <jim@meyering.net>
parents:
28823
diff
changeset
|
219 print_log ($header, $entry) |
25216 | 220 if header_match_p ($header) && entry_match_p ($entry); |
221 | |
222 close IN; | |
38551
6bd3c93022e7
(parse_changelog): Remove unused local variable.
Gerd Moellmann <gerd@gnu.org>
parents:
38510
diff
changeset
|
223 |
6bd3c93022e7
(parse_changelog): Remove unused local variable.
Gerd Moellmann <gerd@gnu.org>
parents:
38510
diff
changeset
|
224 if ($reverse) { |
54324
bdf4aa3226e7
Changes to support ChangeLog.10+.
Juanma Barranquero <lekktu@gmail.com>
parents:
52401
diff
changeset
|
225 for (my $entry = @entries; $entry; $entry--) { |
bdf4aa3226e7
Changes to support ChangeLog.10+.
Juanma Barranquero <lekktu@gmail.com>
parents:
52401
diff
changeset
|
226 print $entries[$entry-1]; |
38551
6bd3c93022e7
(parse_changelog): Remove unused local variable.
Gerd Moellmann <gerd@gnu.org>
parents:
38510
diff
changeset
|
227 } |
6bd3c93022e7
(parse_changelog): Remove unused local variable.
Gerd Moellmann <gerd@gnu.org>
parents:
38510
diff
changeset
|
228 } |
25216 | 229 } |
230 | |
231 | |
232 # Main program. Process ChangeLogs. | |
233 | |
38551
6bd3c93022e7
(parse_changelog): Remove unused local variable.
Gerd Moellmann <gerd@gnu.org>
parents:
38510
diff
changeset
|
234 # If files were specified on the command line, parse those files in the |
6bd3c93022e7
(parse_changelog): Remove unused local variable.
Gerd Moellmann <gerd@gnu.org>
parents:
38510
diff
changeset
|
235 # order supplied by the user; otherwise parse default files ChangeLog and |
54324
bdf4aa3226e7
Changes to support ChangeLog.10+.
Juanma Barranquero <lekktu@gmail.com>
parents:
52401
diff
changeset
|
236 # ChangeLog.1+ according to $reverse. |
38551
6bd3c93022e7
(parse_changelog): Remove unused local variable.
Gerd Moellmann <gerd@gnu.org>
parents:
38510
diff
changeset
|
237 unless (@ARGV > 0) { |
54324
bdf4aa3226e7
Changes to support ChangeLog.10+.
Juanma Barranquero <lekktu@gmail.com>
parents:
52401
diff
changeset
|
238 @ARGV = ("ChangeLog"); |
bdf4aa3226e7
Changes to support ChangeLog.10+.
Juanma Barranquero <lekktu@gmail.com>
parents:
52401
diff
changeset
|
239 |
bdf4aa3226e7
Changes to support ChangeLog.10+.
Juanma Barranquero <lekktu@gmail.com>
parents:
52401
diff
changeset
|
240 push @ARGV, |
bdf4aa3226e7
Changes to support ChangeLog.10+.
Juanma Barranquero <lekktu@gmail.com>
parents:
52401
diff
changeset
|
241 map {"ChangeLog.$_"} |
bdf4aa3226e7
Changes to support ChangeLog.10+.
Juanma Barranquero <lekktu@gmail.com>
parents:
52401
diff
changeset
|
242 sort {$b <=> $a} |
bdf4aa3226e7
Changes to support ChangeLog.10+.
Juanma Barranquero <lekktu@gmail.com>
parents:
52401
diff
changeset
|
243 map {/\.(\d+)$/; $1} |
bdf4aa3226e7
Changes to support ChangeLog.10+.
Juanma Barranquero <lekktu@gmail.com>
parents:
52401
diff
changeset
|
244 do { |
bdf4aa3226e7
Changes to support ChangeLog.10+.
Juanma Barranquero <lekktu@gmail.com>
parents:
52401
diff
changeset
|
245 opendir D, '.'; |
bdf4aa3226e7
Changes to support ChangeLog.10+.
Juanma Barranquero <lekktu@gmail.com>
parents:
52401
diff
changeset
|
246 grep /^ChangeLog\.\d+$/, readdir D; |
bdf4aa3226e7
Changes to support ChangeLog.10+.
Juanma Barranquero <lekktu@gmail.com>
parents:
52401
diff
changeset
|
247 }; |
bdf4aa3226e7
Changes to support ChangeLog.10+.
Juanma Barranquero <lekktu@gmail.com>
parents:
52401
diff
changeset
|
248 |
38551
6bd3c93022e7
(parse_changelog): Remove unused local variable.
Gerd Moellmann <gerd@gnu.org>
parents:
38510
diff
changeset
|
249 @ARGV = reverse @ARGV if $reverse; |
6bd3c93022e7
(parse_changelog): Remove unused local variable.
Gerd Moellmann <gerd@gnu.org>
parents:
38510
diff
changeset
|
250 } |
6bd3c93022e7
(parse_changelog): Remove unused local variable.
Gerd Moellmann <gerd@gnu.org>
parents:
38510
diff
changeset
|
251 |
6bd3c93022e7
(parse_changelog): Remove unused local variable.
Gerd Moellmann <gerd@gnu.org>
parents:
38510
diff
changeset
|
252 while (defined (my $log = shift @ARGV)) { |
6bd3c93022e7
(parse_changelog): Remove unused local variable.
Gerd Moellmann <gerd@gnu.org>
parents:
38510
diff
changeset
|
253 parse_changelog ($log) if -f $log; |
25216 | 254 } |
255 | |
256 | |
52401 | 257 # arch-tag: 9e4f6749-e053-4bb7-b3ad-11947318418e |
29638
f6a97d806845
Fix typos in comments. Remove trailing blanks.
Jim Meyering <jim@meyering.net>
parents:
28823
diff
changeset
|
258 # grep-changelog ends here. |