mc/edit/ChangeLog

1372 lines
43 KiB
Plaintext
Raw Blame History

2004-09-19 Roland Illig <roland.illig@gmx.de>
* editcmd.c (edit_replace_cmd): Added const qualifier.
* editwidget.c (edit_my_define): likewise.
* editcmd.c (edit_replace_prompt): Allocate the label text
dynamically instead of using catstrs. Don't handle
ENABLE_CHARSET specially.
2004-09-17 Andrew V. Samoilov <andrew@email.zp.ua>
* editcmd.c (edit_replace_prompt) [HAVE_CHARSET]: Warning hack.
2004-09-03 Pavel S. Shirshov <pavelsh@mail.ru>
* editwidget.c (edit_adjust_size): Fix warnings.
(edit_dialog_callback): Likewise.
* edit.c (menu_save_mode_cmd): Likewise.
Based on patch from Jakub Jelinek <jakub@redhat.com>
2004-09-02 Pavel S. Shirshov <pavelsh@mail.ru>
* editcmd.c (edit_save_as_cmd): Add hotkey to dialog.
(edit_save_confirm_cmd): Likewise. (edit_new_cmd): Likewise.
(edit_load_cmd): Likewise. (edit_block_move_cmd): Likewise.
(edit_block_delete): Likewise. (edit_ok_to_exit): Likewise.
2004-09-01 Pavel S. Shirshov <pavelsh@mail.ru>
* syntax.c (this_try_alloc_color_pair): Use g_strlcpy instead
sequence strncpy(), name[len] = '\0'
(edit_read_syntax_rules): Likewise.
2004-08-29 Roland Illig <roland.illig@gmx.de>
* Code cleanup: Added const qualifier for variables and
function declarations where possible. No functional changes.
2004-08-26 Leonard den Ottolander <leonard * den ottolander nl>
* edit/editcmd.c: Fix buffer overflows in edit replace code.
Based on patch from Jakub Jelinek <jakub@redhat.com>
2004-08-23 Jakub Jelinek <jakub@redhat.com>
* syntax.c: (edit_read_syntax_rules): Fix boundary conditions.
2004-08-23 David Sterba <dave@jikos.cz>
* syntax.c: (edit_read_syntax_rules): Dynamically allocate
more space for contexts and for words in context.
2004-08-16 Roland Illig <roland.illig@gmx.de>
* edit.c (several functions): Changed the data type of some
variables from int to size_t (for string lengths) or unsigned
long (for editor offsets) to avoid implicit sign conversions.
No functional changes.
* edit.c, editcmds.h: Moved the semicolon out of the macro
definition SHELL_COMMANDS_i, so that the declaration in edit.c
looks more natural. No functional changes.
* editcmd.c: Added missing initializers for QuickDialogs.i18n.
Replaced the last item in QuickWidgets from {0} to
NULL_QuickWidget (that is, added missing initializers).
(edit_completion_dialog): Made dlg_h and dlg_w unsigned to
avoid implicit sign conversion. No functional changes.
* editlock.c (lock_build_name, edit_lock_file): Casted pid to
int to avoid wrong type argument for printf. No other functional
changes.
* editoptions.c: Added missing initializers for QuickDialogs
and QuickWidgets. No functional changes.
* syntax.c (xx_strchr): Removed explicit loop unrolling. It's
the job of the compiler.
2004-02-04 Pavel Roskin <proski@gnu.org>
* editcmddef.h: Split CK_No_Command into CK_Insert_Char and
CK_Ignore_Key.
* editkeys.c (emacs_key_map): Ignore Ctrl-g. Requested by
Paul Seelig <pseelig@uni-mainz.de>
(edit_translate_key): Implement CK_Ignore_Key.
* edit.c (edit_execute_key_command): Return void, the result is
never used.
(edit_execute_cmd): Likewise.
2003-12-24 Dmitry Alexeyev <dmi_a@qnx.org.ru>
* syntax.c (edit_read_syntax_rules): Fix crash if syntax file
has more than 1024 keywords.
2003-11-27 Pavel Roskin <proski@gnu.org>
* editcmd.c: Use input_expand_dialog() instead of input_dialog()
for loading and saving files.
2003-11-24 Andrew V. Samoilov <sav@bcs.zp.ua>
* editcmd.c (pipe_mail): Eliminate g_strdup_printf().
(edit_complete_word_cmd): Fix possible buffer overflow.
2003-11-03 Andrew V. Samoilov <sav@bcs.zp.ua>
* editcmd.c (edit_mail_dialog): Trivial clean-up.
2003-10-23 Andrew V. Samoilov <sav@bcs.zp.ua>
* edit-widget.h (struct WEdit): Add GTree *defines field.
* syntax.c: Use edit->defines instead of static defines.
2003-10-16 Andrew V. Samoilov <sav@bcs.zp.ua>
* syntax.c (compare_word_to_right): More checks for braces and
brackets.
2003-10-16 Pavel Roskin <proski@gnu.org>
* syntax.c (compare_word_to_right): Fix recent breakage - rules
ending with wildcard (e.g. "$+") won't match.
2003-10-14 Pavel Roskin <proski@gnu.org>
* edit.h: Make static all functions and variables that don't
need to be global. Remove unused functions. Adjust all
dependencies.
2003-09-22 Pavel Roskin <proski@gnu.org>
* syntax.c: Give names to numeric tokens.
* syntax.c (compare_word_to_right): Add checks that we don't go
beyond text length for certain invalid rules.
Reported by Juan C. Olivares <juancri@TAGnet.org>
2003-09-12 Pavel Roskin <proski@gnu.org>
* editcmd.c (edit_raw_key_query): Use straight widget order.
(edit_completion_dialog): Likewise.
* editwidget.c (edit): Likewise.
2003-09-07 Pavel Roskin <proski@gnu.org>
* edit.h: Get rid of WIDGET_COMMAND, update all dependencies.
2003-07-31 Andrew V. Samoilov <sav@bcs.zp.ua>
* edit-widget.h: Resurrect "dir" field in WEdit to store
directory for relative filenames.
* edit.c (edit_clean): Release edit->dir.
* editcmd.c (edit_save_file): Use absolute filename.
Temporarily disable safe save and backups on remote VFS because
it doesn't work - again.
2003-07-25 Pavel Roskin <proski@gnu.org>
* edit.c (edit_execute_cmd): Enable user menu in mcedit.
2003-07-20 Pavel Roskin <proski@gnu.org>
* editcmd.c (edit_quit_cmd): Rename to ...
(edit_ok_to_exit): ... this. Don't stop dialog - this function
is called by the dialog code.
* editwidget.c (edit_dialog_callback): Process DLG_VALIDATE
event. Don't exit it the user wants to continue editing.
* edit.c (edit_execute_cmd): Close the dialog - it will ask user
if necessary.
* editcmd.c (edit_quit_cmd): Don't save this command in the undo
stack. Don't force any refresh. Don't delete unsaved files, do
it ...
* edit.c (edit_clean): ... here. This ensures that unsaved
files from the mcedit command line are erased on Ctrl-n.
* editwidget.c (edit): Remove unused variable "framed".
2003-07-08 Adam Byrtek <alpha@debian.org>
* edit.c (edit_clean): Remove stale lock if any.
2003-07-08 Pavel Roskin <proski@gnu.org>
* edit-widget.h: Add new field loading_done.
* edit.c (edit_init): Set loading_done.
(edit_insert): Don't call edit_modification() before the file is
completely loaded.
* edit-widget.h: Eliminate unused explicit_syntax field.
* edit-widget.h: Stop misusing "unsigned char" for boolean.
Eliminate have_frame - it's unused. Adjust all dependencies.
2003-06-14 Pavel Roskin <proski@gnu.org>
* editkeys.c: Leave only distinct entries in cooledit_key_map
and emacs_key_map. Move the rest to common_key_map.
2003-06-09 Pavel Roskin <proski@gnu.org>
* editkeys.c (emacs_key_map): Move Atl-'>' and Alt-'<' ...
(common_key_map): ... here.
2003-06-05 Andrew V. Samoilov <sav@bcs.zp.ua>
* editcmd.c (edit_ext_cmd): Fix memory leak.
2003-05-30 Michal Szwaczko <mikey@scene.pl>
* editcmd.c: Implement pasting the output of any external
command.
* editmenu.c: Add menu entries for that.
* editcmddef.h: Add new command CK_ExtCmd.
2003-04-04 Adam Byrtek <alpha@debian.org>
* edit.c: Move edit_modification() before actions to provide
proper repainting if there are dialogs invoked by actions.
* editlock.c: Split lock into user@host and pid and report them
separately.
2003-04-02 Pavel Roskin <proski@gnu.org>
* edit.c (edit_load_file): Use vfs_file_is_local(), not
vfs_current_is_local().
* editlock.c (edit_lock_file): Disable locking on VFS.
2003-04-01 Adam Byrtek <alpha@debian.org>
* editlock.c, editlock.h: New files. Implement file locking in
Emacs style, as documented in JED editor sources.
* Makefile.am: Add those files to build tree.
* edit-widget.c (WEdit): New property 'locked', 0 on edit_init.
* edit.c (edit_modification): Lock buffer on modification.
* editcmd.c (edit_save_cmd, edit_save_as_cmd): Handle locking
during file save.
(edit_load_file_from_filename): Unlock. Remove 2 duplicate
lines (handled by edit_init).
(edit_quit_cmd): Unlock.
2003-03-12 Pavel Roskin <proski@gnu.org>
* edit.h: Make it easier to tweak buffer size and maximal number
of buffers.
2003-03-07 Pavel Roskin <proski@gnu.org>
* editkeys.c (common_key_map): Delete previous word by
Alt-Backspace. Fix Ctrl-Backspace on some terminals.
Reported by Andrew V. Samoilov <sav@bcs.zp.ua>
2003-03-06 Andrew V. Samoilov <sav@bcs.zp.ua>
* syntax.c (edit_read_syntax_file): Fix segmentation violation.
2003-03-03 Andrew V. Samoilov <sav@bcs.zp.ua>
* syntax.c (edit_read_syntax_rules): Check for list of defines
is already initialized.
(edit_read_syntax_file): Process `include ...` before first
`file ...`, so color definitions can be stored separately.
* syntax.c (subst_defines): New function to substitute defines.
(this_try_alloc_color_pair): Move color substitution ...
(edit_read_syntax_rules): ... here. Use subst_defines() to
substitute colors for contexts and keywords. Allow multiword
defines.
2003-02-26 Andrew V. Samoilov <sav@bcs.zp.ua>
* syntax.c (edit_read_syntax_rules): Add args argument and use
it instead of own auto args array to share this area with ...
(edit_read_syntax_file): ... this. Adjust for the above.
Use strncpy() instead of unsafe strcpy().
2003-02-25 Andrew V. Samoilov <sav@bcs.zp.ua>
* syntax.c (defines): New static variable for list of defines.
(mc_defines_destroy): New function to release memory of key
pair.
(destroy_defines): New function to destroy list of defines
completely.
(this_try_alloc_color_pair): Use strncpy() instead of unsafe
strcpy(). Use values from list of defines to substitute given
parameters.
(edit_read_syntax_rules): Initialize list of defines and process
new "define" keyword. Use strncpy() instead of unsafe strcpy().
(edit_free_syntax_rules): Destroy list of defines.
2003-02-21 Andrew V. Samoilov <sav@bcs.zp.ua>
* editmenu.c (OptMenuEmacs): Define as OptMenu.
(SearReplMenuEmacs): Define as SearReplMenu.
(EditMenuEmacs): Define as EditMenu.
2002-12-28 Pavel Roskin <proski@gnu.org>
* editmenu.c (OptMenu): Add "Learn Keys".
(OptMenuEmacs): Likewise.
2003-01-27 Andrew V. Samoilov <sav@bcs.zp.ua>
* edit-widget.h (struct macro): Move definition ...
* edit.h: ... here to fix compilation on HP-UX.
2002-12-25 Pavel Roskin <proski@gnu.org>
* editkeys.c: Move key maps to the file scope. Put common keys
to a separate table common_key_map.
(edit_translate_key): Remove unused argument x_keycode.
* editkeys.c (edit_translate_key): Treat Shift-Enter as return
without indent. Useful when pasting multiline text with
Shift-button3 or Shift-Insert with autoindent enabled.
2002-12-23 Pavel Roskin <proski@gnu.org>
* editkeys.c (edit_translate_key): Treat Ctrl-Home and Ctrl-End
like Ctrl-PgUp and Ctrl-PgDown respectively.
* edit_key_translator.c: Rename to ...
* editkeys.c: ... this.
* edit.c (edit_translate_key): Move to editkeys.c.
* Makefile.am: Adjust for the above.
2002-12-21 Pavel Roskin <proski@gnu.org>
* edit.c (edit_translate_key): Remove x_state argument, it's now
a part of x_keycode.
* editwidget.c (get_key_state): Remove.
2002-12-18 Andrew V. Samoilov <sav@bcs.zp.ua>
* editcmd.c (edit_block_process_cmd): Quote filename.
* edit.h (edit_save_mode_t): New enum for file saving mode.
* editcmd.c (): Use edit_save_mode_t.
(pipe_mail): Quote to, subject and cc with name_quote().
* edit.c (edit_get_filter): Use quoted filename.
(edit_get_write_filter): Use quoted writename.
(edit_push_action): Use g_realloc().
2002-12-16 Pavel Roskin <proski@gnu.org>
* editcmd.c (edit_goto_cmd): Add support for negative line
numbers, which are counted from the last line. Use strtol(), so
hex numbers are supported as well.
* edit.c: Use edit->stack_disable instead of static variable.
2002-12-15 Pavel Roskin <proski@gnu.org>
* edit.c (check_file_access): Use non-blocking open() followed
by fstat() to avoid race conditions. Don't ask users to
recompile the editor.
* edit.c (edit_reload): Don't initialize edit->macro_i, because
edit_init() takes care of it.
* editwidget.c (edit): Likewise.
* edit.h: Don't inclide malloc.h. Use g_malloc() and g_free()
instead. Adjust all dependencies.
* edit.c (edit_load_file): Merge edit_open_file(). Disable fast
loading on non-local VFS because the file size can be wrong.
(init_dynamic_edit_buffers): Split into edit_init_buffers() and
edit_load_file_fast().
* edit.c (edit_init): Move file loading to ...
(edit_load_file): ... a separate function.
* edit.c (init_dynamic_edit_buffers): Remove unused code to
support loading text from buffer.
2002-12-14 Pavel Roskin <proski@gnu.org>
* editcmd.c (edit_split_filename): Rename to edit_set_filename,
use g_malloc() and g_free() on edit->filename.
2002-12-08 Pavel Roskin <proski@gnu.org>
* edit.c (edit_open_file): Remove "text" and "text_size"
arguments. Adjust all callers.
* edit.c (edit_move_to_column): Remove, use
edit_move_to_prev_col() instead.
* edit.c: Commit the rest of the position saving code.
(edit_load_position): New function, load position.
(edit_save_position): New function, save position.
(edit_init): Take new argument "line". If it's 0, load position
from .mc/filepos.
(edit_clean): Save file position to .mc/filepos even if the file
is not being saved.
* editwidget.c (edit): Don't set the initial line, pass it to
edit_init().
2002-12-07 Pavel Roskin <proski@gnu.org>
* syntax.c (edit_load_syntax): Reuse more informative error
message.
* edit.c (check_file_access): Use O_EXCL when opening new files.
Don't allow editing stale symlinks.
Reported by Max Derzhak <max@linux.zp.ua>
2002-12-05 Pavel Roskin <proski@gnu.org>
* edit-widget.h: Remove "from_here" and "to_here".
* edit.c (edit_purge_widget): New function - clean struct WEdit
except the Widget part.
2002-12-04 Pavel Roskin <proski@gnu.org>
* editcmd.c: Include dialog.h.
Reported by Fr<46>d<EFBFBD>ric L. W. Meunier <lists@pervalidus.net>
2002-11-30 Pavel Roskin <proski@gnu.org>
* edit.h: Remove "dir" field in WEdit - it's always an empty
string. Adjust all dependencies.
* editcmd.c (edit_get_load_file): Remove first argument, it's
unused.
(edit_get_save_file): Likewise.
* syntax.c: Make structures key_word, context_rule and
_syntax_marker opaque.
* edit.c: Use g_malloc() and g_free() on buffers1 and buffers2.
Eliminate CMalloc.
(edit_get_buffer_as_text): Remove, it's unused.
* editcmd.c (edit_set_search_parameters): Use g_malloc().
(edit_complete_word_cmd): Use g_free().
2002-11-29 Pavel Roskin <proski@gnu.org>
* edit.h: Don't define HAVE_SYNTAXH.
* syntax.c: Syntax highlighting is no more optional.
(edit_check_spelling): Remove.
* editoptions.c (edit_options_dialog): Add "Save file position"
option, make "Syntax highlighting" unconditional.
* edit.c: First part of the position saving code.
(edit_move_to_column): New function.
2002-11-29 Andrew V. Samoilov <sav@bcs.zp.ua>
* editoptions.c (edit_options_dialog): Use g_free() to release
variables allocated in quick_dialog().
2002-11-28 Pavel Roskin <proski@gnu.org>
* edit-widget.h: Move typedef WEdit and file names ...
* edit.h: ... here. Don't include edit-widget.h. Adjust all
dependencies.
2002-11-23 Andrew V. Samoilov <sav@bcs.zp.ua>
* editoptions.c (edit_options_dialog): Clean up and use g_snprintf()
instead of sprintf().
2002-11-14 Pavel Roskin <proski@gnu.org>
* edit.h: Decentralize includes.
* editmenu.c (edit_user_menu_cmd): Move to ../src/cmd.c.
* edit.c (edit_delete_line): Don't remove and restore the
preceding newline. Don't treat binary zero as newline.
From Dmitry Semyonov <Dmitry.Semyonov@oktet.ru>
2002-11-12 Pavel Roskin <proski@gnu.org>
* *.c: Fix all global functions without declarations - declare,
make static or remove.
* syntax.c (syntax_change_callback): Remove, it's unused.
(edit_set_syntax_change_callback): Likewise.
* edit.c (edit_execute_cmd): Fool gcc to prevent Y2K warning.
* editwidget.c (edit_adjust_size): Use find_buttonbar().
2002-11-11 Pavel Roskin <proski@gnu.org>
* editcmd.c: Warning fix for compilers that don't understand the
"const" keyword and variable size arrays.
2002-11-06 Pavel Roskin <proski@gnu.org>
* editcmd.c (edit_save_file): Restore ownership before access
mode, not after. Otherwise suid bit is lost.
Reported by Nerijus Baliunas <nerijus@users.sourceforge.net>
2002-10-30 Pavel Roskin <proski@gnu.org>
* edit.c: Include charset.h unconditionally, use new conversion
functions that don't require ifdefs.
* edit_key_translator.c: Likewise.
* editcmd.c: Likewise.
* editdraw.c: Likewise.
2002-10-20 Pavel Roskin <proski@gnu.org>
* edit-widget.h: Add new field macro_depth to control depth of
macro recursion.
* edit.c (edit_execute_macro): Make static. Increment
macro_depth on entry, decrement on exit, don't allow it to be
too large.
* wordproc.c (line_start): Remove incorrect optimization abusing
static variables. Internal formatting should be usable now.
2002-10-18 Pavel Roskin <proski@gnu.org>
* wordproc.c (begin_paragraph): Fix the same off-by-one error as
in end_paragraph() - it affects formatting of the paragraph
after the first line in the file it that line starts with a dot.
Remove unused argument.
* wordproc.c (end_paragraph): The last line of the file wasn't
tested for being blank, which resulted in the last newline
becoming a space after formatting.
2002-10-17 Pavel Roskin <proski@gnu.org>
* editoptions.c (edit_options_dialog): Don't allow
option_tab_spacing to be 0. Reset invalid values to 8.
Reported by Ury N. Stankevich <ury@bofh.homeunix.org>
2002-10-08 Pavel Roskin <proski@gnu.org>
* wordproc.c (format_paragraph): If formatting was successful,
scroll to the left to show the formatted paragraph.
2002-10-06 Pavel Roskin <proski@gnu.org>
* editdraw.c (print_to_widget): Eliminate use of floating point.
Change all callers.
2002-10-02 Andrew V. Samoilov <sav@bcs.zp.ua>
* editcmd.c (edit_insert_column_of_text): Fix infinite loop if
block of text is copied past the end of the buffer.
By Paul Sheer <psheer@icon.co.za>.
(stacked): Don't initialize static arrays by zeros.
2002-09-26 Andrew V. Samoilov <sav@bcs.zp.ua>
* edit.h (struct key_word): Remove time field.
* syntax.c: Remove MAD support.
2002-09-24 Pavel Roskin <proski@gnu.org>
* editwidget.c (edit): Make edit_dlg local variable.
* editmenu.c (edit_drop_menu_cmd): Don't use edit_dlg variable.
* edit.c: Remove all references to CR_LF_TRANSLATION.
* editcmd.c: Likewise.
2002-09-23 Pavel Roskin <proski@gnu.org>
* editwidget.c (edit): Install handler for DLG_RESIZE.
* editwidget.c (edit): Set edit_dlg to NULL after it's
destroyed.
* edit.h: Move style definitions ...
* editdraw.c: ... here. Multiply them by 256. Remove unused
styles.
(print_to_widget): Don't divide style by 256. Simplify logic
since we only have 4 styles now.
* edit.c (edit_move_forward3): Use caret notation for code 127
and below code 32.
* editdraw.c (edit_draw_this_line): Likewise. Print '.' for
other non-printable characters and remove this code from ...
(print_to_widget): ... here.
* edit.c (edit_move_forward3): Show '\r' as ^M.
* editdraw.c (edit_draw_this_line): Likewise. Use MOD_ABNORMAL
attribute.
From Alexander Varakin <avarakin00@hotmail.com>
* edit.h: Remove all references to O_TEXT, USE_O_TEXT and
MY_O_TEXT.
* edit.c: Use O_BINARY when opening files.
* editcmd.c: Likewise.
From Alexander Varakin <avarakin00@hotmail.com>
2002-09-20 Pavel Roskin <proski@gnu.org>
* editwidget.c (edit_event): Add support for mouse wheel events.
* edit.h: Add missing declarations for edit_move_up() and
edit_move_down().
2002-09-20 Andrew V. Samoilov <sav@bcs.zp.ua>
* edit.c: Don't initialize static selection and selection_history.
* editdraw.c (status_string): Remove font_width argument.
(edit_status): Fix calculation to use last column in the
status string.
2002-09-04 Pavel Roskin <proski@gnu.org>
* edit.c (edit_filters): Use gzip, not compress for *.Z files
for consistency with other parts of the code (viewer, mc.ext).
2002-09-03 Pavel Roskin <proski@gnu.org>
* editcmd.c: Recheck and fix all calls to create_dlg().
* editwidget.c: Likewise.
2002-09-02 Pavel Roskin <proski@gnu.org>
* editcmd.c (edit_raw_key_query): Eliminate
x_set_dialog_title().
2002-09-01 Pavel Roskin <proski@gnu.org>
* editcmd.c (edit_block_process_cmd): Restore third argument
(but make it /dev/null) for compatibility with old scripts.
Reported by Andrew V. Samoilov <sav@bcs.zp.ua>
2002-08-31 Pavel Roskin <proski@gnu.org>
* editwidget.c (edit): Avoid passing an uninitialized color
array to create_dlg() - pass NULL instead.
2002-08-27 Andrew V. Samoilov <sav@bcs.zp.ua>
* editcmd.c (edit_printf): Use g_vsnprintf() instead of sprintf().
2002-08-24 Pavel Roskin <proski@gnu.org>
* edit-widget.h: Eliminate ERROR_FILE.
* edit.c: Remove all references to ERROR_FILE.
* editcmd.c (edit_block_process_cmd): Revert to using catstrs(),
those strings are freed now. Use system(), not execute() to
execute commands. Use open_error_pipe() and close_error_pipe()
to keep track of errors.
2002-08-22 Pavel Roskin <proski@gnu.org>
* editcmd.c: Clean up global variables in the completion code.
* editwidget.c: Use new dialog flags.
* editcmd.c: Likewise.
(edit_completion_dialog): Set DLG_COMPACT for the dialog.
* editcmd.c (compl_callback): Use common_dialog_repaint().
* editcmd.c (raw_callback): Use standard common_dialog_repaint()
to handle DLG_DRAW.
2002-08-21 Pavel Roskin <proski@gnu.org>
* editwidget.c (edit): Make edit_bar a local variable.
2002-08-20 Pavel Roskin <proski@gnu.org>
* editcmd.c (freestrs): Set freed strings to NULL.
(catstrs): Use g_malloc() and g_free().
* editcmd.c (freestrs): New function to clean temporary strings.
* edit.c (edit_clean): Call freestrs().
2002-08-20 David Martin <dmartina@excite.com>
* editmenu.c: Use new create_menu() interface.
2002-08-18 Pavel Roskin <proski@gnu.org>
* editoptions.c: Make some variables static.
* edit.h: Take extern declarations from all C files.
* editcmd.c (edit_block_process_cmd): Plug memory leak.
Simplify logic, reformat.
2002-08-02 Paul Sheer <psheer@icon.co.za>
* edit.c (edit_push_action): Fix access to uninitialized memory.
Found by Valgrind.
2002-08-01 Pavel Roskin <proski@gnu.org>
* syntax.c: Remove all references to MAD.
* edit.h: Don't include mad.h.
2002-07-29 Andrew V. Samoilov <kai@cmail.ru>
* edit.h (edit_get_load_file): Mark message for translation.
(edit_get_save_file): Ditto.
2002-07-20 Pavel Roskin <proski@gnu.org>
* syntax.c (apply_rules_going_right): Recheck keyword rules when
a keyword is found on the left border of a context.
2002-07-14 Pavel Roskin <proski@gnu.org>
* syntax.c (edit_get_syntax_color): Return colorpair index, not
attribute, when syntax highlighting is disabled. Handle black
and white mode separately.
* syntax.c (edit_load_syntax): Do nothing in black and white
mode.
* edit.h [!HAVE_SLANG]: Enable syntax highlighting.
* editdraw.c [!HAVE_SLANG]: Respect attributes for color pairs
by using MY_COLOR_PAIR macro.
* edit.h (struct key_word): Remove unused "bg" field, rename
"fg" to "color", since it keeps all color information.
* syntax.c (edit_get_syntax_color): Replace "fg" and "bg"
arguments with a single argument "color".
Adjust all dependencies.
* editdraw.c (edit_draw_this_line): Fix setting MOD_ABNORMAL
attribute.
(print_to_widget): Fix displaying non-printable characters with
ncurses. Set color for every character even if syntax
highlighting is not compiled - it's needed to reset color after
non-printable characters.
* editdraw.c (edit_status): Use EDITOR_NORMAL_COLOR instead of
NORMAL_COLOR.
* syntax.c (edit_get_syntax_color) [!HAVE_SYNTAXH]: Likewise.
2002-06-24 Pavel Roskin <proski@gnu.org>
* edit.c (check_file_access): Return 1 on all errors, document
this behavior. Set edit->delete_file to 1 for newly created
files.
(edit_open_file): Don't set edit->delete_file, it's now done in
check_file_access().
Reported by Saso <saso@bojler.dhs.org>
2002-05-13 Andrew V. Samoilov <kai@cmail.ru>
* editcmd.c (edit_save_file): Call mc_chown() and mc_chmod()
before mc_open() to prevent hangs over ftpfs.
* edit.h: Remove open, close, write, read and mkdir definitions.
* edit.c: Use mc_open, mc_close, mc_write, mc_read, mc_rename,
mc_chmod and mc_chown. Don't cast (char *) to (unsigned long)
in pointer arithmetics.
* editcmd.c: Likewise.
2002-03-25 Andrew V. Samoilov <kai@cmail.ru>
* syntax.c (edit_read_syntax_file): Use system wide Syntax
Highlighting definitions' file if there is no users one.
2002-03-18 Pavel Roskin <proski@gnu.org>
* edit.h: Use eregex.h, not regex.h.
From Alexander Varakin <avarakin00@hotmail.com>
2002-02-27 Andrew V. Samoilov <kai@cmail.ru>
* editcmd.c (edit_replace_cmd): Eliminate fin_string
and use message() to fix possible buffer overflow.
(edit_search_cmd): Likewise.
2002-02-18 Andrew V. Samoilov <kai@cmail.ru>
* syntax.c (convert): Fix buffer overflow for ".*\" cases.
2002-01-22 Pavel Roskin <proski@gnu.org>
* editdraw.c (edit_scroll_screen_over_cursor): Do nothing if the
edit widget has zero width or height.
2002-01-21 Pavel Roskin <proski@gnu.org>
* edit.c: Rename DELETE to DELCHAR to avoid macro redefinition
on Win32.
* edit.h: Likewise.
2002-01-21 Matthias Urban <murban@cs.uni-magdeburg.de>
* edit.c: Add support for CK_Complete_Word event.
* editcmddef.h: Likewise.
* edit_key_translator.c (cooledit_key_map): Bind Alt-Tab to
CK_Complete_Word.
(emacs_key_map): Likewise.
* editcmd.c: Implement word completion.
2002-01-21 Pavel Roskin <proski@gnu.org>
* editmenu.c (CmdMenuEmacs): Add mail command without shortcut.
Users of emacs keys should be able to send mail too.
2002-01-15 Andrew V. Samoilov <kai@cmail.ru>
* syntax.c (syntax_g_free): New macro to release and NULLify
glib allocated memory area(s).
(strdup_convert): Rename to ...
(convert): ... this. Don't strdup() passed string.
(get_args): Use convert() instead of strdup_convert().
(free_args): Make it do nothing macro.
(open_include_file): Eliminate p array. Use glib function to
construct error_file_name. Use PATH_SEP instead of '/';
(edit_read_syntax_file): Use PATH_SEP_STR.
(edit_load_syntax): Use syntax_g_free to release error_file_name.
(edit_read_syntax_rules): Likewise.
Eliminate c->single_char. It's only written but never read.
* edit.h (struct context_rule): Comment out single_char field.
It is written once but never read.
* edit-widget.h: Use PATH_SEP_STR.
2001-12-22 Andrew V. Samoilov <kai@cmail.ru>
* editcmd.c (edit_goto_cmd): Use g_free() to release f.
(edit_save_file): Use PATH_SEP instead of '/'.
Undefine "close" before closing file created by mc_mkstemps.
Define close to mc_close() after it - temporary fix.
(sprintf_p): Don't cast (char *) to (unsigned long).
* syntax.c (read_one_line): Undo last patch - errno is a
function on some systems. Check ferror() status before
everything else if fgetc() returns EOF.
Accept last line without trailing newline.
(compare_word_to_right): Don't cast p and q to unsigned long.
(apply_rules_going_right): Likewise.
2001-12-21 Pavel Roskin <proski@gnu.org>
* edit.c (user_menu): Don't move the cursor before and after
inserting the block.
Reported by Matthias Urban <murban@cs.uni-magdeburg.de>
* syntax.c (read_one_line): Clear errno before using it. Don't
use the result of fgetc() if errno is EINTR.
2001-11-28 Andrew V. Samoilov <kai@cmail.ru>
* syntax.c (apply_rules_going_right): Fix crash for lines like
\s+ \n lightgray/13 red
in Syntax file.
(read_one_line): Use EOF instead of -1.
(get_args): Fix buffer overflow for l without trailing
whitespace(s).
(break_a): New macro.
(edit_read_syntax_rules): Use break_a to fix memory leaks.
(edit_load_syntax): Eliminate s and use message to prevent
buffer overflow.
* editdraw.c (edit_render): Eliminate f. It's only written
but never read.
2001-11-27 Andrew V. Samoilov <kai@cmail.ru>
* editmenu.c (edit_wrap_cmd): Use g_free() on the result
of input_dialog().
2001-11-22 Andrew V. Samoilov <kai@cmail.ru>
* editcmd.c (edit_save_file): Use g_free() on the result of
mc_mkstemps().
(edit_replace_cmd): Fix rare memory leaks.
2001-11-19 Andrew V. Samoilov <kai@cmail.ru>
* edit.c (edit_renew): Release dir after use.
* editcmd.c (edit_replace_dialog): Eliminate tsearch_text,
treplace_text and targ_order.
(edit_replace_cmd): edit_replace_dialog gives g_malloced
strings, so g_strdup/g_free have to be used. Accept only
positive pattern number in Scanf search and replace.
(edit_save_file): Enable safe save and backups on remote VFS.
2001-11-16 Andrew V. Samoilov <kai@cmail.ru>
* edit_key_translator.c (cooledit_key_map):
Add C-k, CK_Delete_To_Line_End.
* edit.c (user_menu): Don't assign block_file twice.
2001-11-07 Andrew V. Samoilov <kai@cmail.ru>
* edit.c (edit_reload): destroy_dlg g_free()s widget(s), so
g_malloc/g_free have to be used.
(edit_init): Ditto. Eliminate st.
2001-11-05 Andrew V. Samoilov <kai@cmail.ru>
* edit.h (edit_execute_cmd): Declare it here.
* edit.c: Remove edit_execute_cmd declaration.
(edit_execute_cmd): Use edit_print_string instead of edit_printf.
* editcmd.c: Remove edit_execute_cmd declaration.
(edit_search_dialog): Eliminate tsearch_text.
(edit_search_cmd): edit_search_dialog gives g_malloc()ed exp.
Use g_strdup/g_free instead of strdup/free.
(edit_mail_dialog): quick_dialog use g_strdup, so g_free
must be used.
(edit_load_cmd): input_dialog returns g_malloc(ed) string,
so g_free has to be used.
(edit_save_block_cmd): Likewise.
(edit_insert_file_cmd): Likewise.
(edit_sort_cmd): Likewise.
(edit_save_as_cmd): Likewise. Memory leak fixed.
* bookmark.c (book_mark_clear): Eliminate rend.
It's only written but never read.
(book_mark_flush): Likewise.
(book_mark_inc): Likewise.
(book_mark_dec): Likewise.
2001-10-23 Pavel Roskin <proski@gnu.org>
* edit.c (user_menu): If the error file is missing, treat it as
success. Truncate block file unconditionally.
2001-10-22 Pavel Roskin <proski@gnu.org>
* edit.c: Stop using _EDIT_C definition. Move variable
declarations from edit.h, make static or eliminate if possible.
Report errors immediately.
* edit.h: Likewise.
* editwidget.c (edit): Don't report errors from edit_init(),
they are reported in place.
2001-10-20 Pavel Roskin <proski@gnu.org>
* editcmd.c (sprintf_p): Declare with the printf attribute.
Make static.
* edit.h: Declare edit_printf() with the printf attribute.
2001-10-18 Pavel Roskin <proski@gnu.org>
* edit.c (check_file_access): Only allow to edit regular files.
Use stat() before open() to prevent hangs on pipes, use fstat()
afterwards if stat() was unsuccessful.
2001-09-17 Pavel Roskin <proski@gnu.org>
* edit.h: Don't use macro `stat' - it's already a macro on
Solaris 8 with large file support.
* editcmd.c: Replace stat() with mc_stat().
* edit.c: Likewise.
2001-09-11 Pavel Roskin <proski@gnu.org>
* syntax.c (syntax_text): Remove, it's a separate file now.
(upgrade_syntax_file): Remove.
(edit_read_syntax_file): Use check_for_default().
2001-09-08 Pavel Roskin <proski@gnu.org>
* edit.h: Remove some useless definitions.
2001-09-07 Pavel Roskin <proski@gnu.org>
* Makefile.am: Don't define "MIDNIGHT" - it's unused now.
* edit.c: Eliminate all code disabled for the text edition.
* editcmddef.h: Likewise.
* editmenu.c: Likewise.
* editwidget.c: Likewise.
* syntax.c: Likewise.
* wordproc.c: Likewise.
* edit-widget.h: Change ~/.cedit to ~/.mc/cedit to keep mcedit
files separate from cooledit.
* bookmark.c: Eliminate all code disabled for the text edition.
* edit-widget.h: Likewise.
* editcmd.c: Likewise.
* editdraw.c: Likewise.
* editoptions.c: Likewise.
* edit.h: Eliminate all code disabled for the text edition.
Reorder and simplify includes.
* edit.c: Likewise.
2001-09-06 Pavel Roskin <proski@gnu.org>
* syntax.c (syntax_text): Add PHP support from Cooledit.
2001-09-04 Pavel Roskin <proski@gnu.org>
* Makefile.am (AM_CFLAGS): Remove CFLAGS, don't use substituted
values directly.
* syntax.c (syntax_text): Remove useless ']' in the Perl and
Python rules. Change shell script rule to use more portable
regular expression.
* editcmd.c (edit_block_process_cmd): Prepend space to the
command to avoid polluting bash history. Document arguments.
Fix crash if block is 0 - not used currently.
2001-08-26 Pavel Roskin <proski@gnu.org>
* Makefile.am: Don't install libedit.a.
* Makefile.in: Converted to ...
* Makefile.am: ... this.
2001-08-24 Pavel Roskin <proski@gnu.org>
* Makefile.in (EDITSRC): Add headers.
(CPPFLAGS): Remove reference to gtkedit.
Copy all necessary files from gtkedit.
* Makefile.in (EDITLINKS): Merge with EDITSRC, remove all
references.
2001-08-24 Pavel Roskin <proski@gnu.org>
* syntax.c (syntax_text): Fix recognizing pdksh and zsh scripts.
2001-08-23 Pavel Roskin <proski@gnu.org>
* editcmd.c (edit_block_process_cmd): Use execute(), not
my_system() to relieve interactive scripts, such as spell
checker, from saving and restoring the terminal.
2001-08-19 Pavel Roskin <proski@gnu.org>
* gtkedit.c: Include <sys/param.h> if present - it should always
be included before <glib.h> to avoid redefining MIN and MAX.
* editcmd.c [!MIDNIGHT]: Undefine B_ENTER and B_CANCEL before
redefining them.
* edit.h: Include <sys/param.h> if present. Include Gtk+
headers as system headers.
* gtkedit.c: Include Gtk+ headers as system headers.
2001-08-18 Pavel Roskin <proski@gnu.org>
* syntax.c (syntax_text): Highlight *.pot as PO files.
* edit.h [GTK]: Fix definition of edit_message_dialog().
* gtkedit.c (gtk_edit_dialog_message): Use "OK" button, not
"Cancel", for consistency with the text edition.
2001-08-17 Pavel Roskin <proski@gnu.org>
* syntax.c (syntax_text): Add support for PO files.
2001-08-12 Pavel Roskin <proski@gnu.org>
* edit.c: Handle CK_Shell.
* editcmddef.h: Define CK_Shell.
* editmenu.c (FileMenu): Remove C-o from the "Open file..."
item.
(FileMenuEmacs): Likewise.
2001-08-06 Andrew V. Samoilov <kai@cmail.ru>
* editcmd.c (edit_replace_prompt): Fix menu location calculation.
2001-08-01 Pavel Roskin <proski@gnu.org>
* editcmd.c (edit_save_file): Temporarily disable safe save
and backups on remote VFS because it doesn't work. Use
mc_mkstemps() instead of tempnam().
2001-07-29 Pavel Roskin <proski@gnu.org>
* syntax.c (syntax_text): Add support for S-Lang.
2001-07-28 Pavel Roskin <proski@gnu.org>
* editcmd.c (menu_save_mode_cmd): Resurrect i18n code lost in
the last resync with Cooledit.
Reported by David Martin <dmartina@excite.es>
* gtkedit.c (gtk_edit_delete_cb): Handler for "delete_event".
(edit): Connect it.
2001-07-27 Pavel Roskin <proski@gnu.org>
* edit.c: Fix include.
2001-07-20 Pavel Roskin <proski@gnu.org>
* syntax.c (open_include_file) [GTK]: Use mc_home instead of
LIBDIR.
2001-07-19 Pavel Roskin <proski@gnu.org>
* editcmd.c (edit_canonicalize_pathname): Don't ever use
getwd(), use g_get_current_dir() instead.
* editoptions.c (edit_options_dialog): Call edit_load_syntax()
if user turned syntax highlighting off to unload the rules.
2001-07-17 Pavel Roskin <proski@gnu.org>
* edit.h [MIDNIGHT]: Declare wedit.
* editmenu.c: Remove wedit declaration.
* editoptions.c (edit_options_dialog): Load syntax rules if user
turned syntax highlighting on.
* syntax.c (edit_load_syntax): Don't load rules if syntax
highlighting is disabled.
2001-07-13 Pavel Roskin <proski@gnu.org>
* editoptions.c (edit_options_dialog): Allow numbers for tab
spacing. Reported by mharris@redhat.com.
http://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=34852
* editcmd.c (menu_save_mode_cmd): Give meaningful names to the
input fields instead of "i" so that they have separate history.
* editoptions.c (edit_options_dialog): Likewise.
2001-07-11 Pavel Roskin <proski@gnu.org>
* editdraw.c (status_string): Use g_snprintf() instead of
snprintf().
From Libor Moty<74>ka <l_motycka@ortex.cz>
2001-07-10 Pavel Roskin <proski@gnu.org>
* gtkeditkey.c (edit_translate_key): When processing bindings
with Alt check that Shift is not pressed - it's handled later.
2001-07-05 Pavel Roskin <proski@gnu.org>
* editdraw.c: Comment fixes.
2001-06-26 Pavel Roskin <proski@gnu.org>
* edit-widget.h (editor_widget): Rename `stat' to `stat1' to
avoid problems on Solaris with 64-bit file access, when `stat'
is a macro. All users adjusted.
Reported by Maksym Polyakov <polyama@yahoo.com>.
2001-06-25 Pavel Roskin <proski@gnu.org>
* gtkedit.c: Remove home_dir - it's declared in main.c.
2001-06-15 Pavel Roskin <proski@gnu.org>
* editcmd.c (canonicalize_pathname) [GTK]: Rename to ...
(edit_canonicalize_pathname): ... this to avoid namespace clash.
* edit.h [MIDNIGHT]: Include "src/cmd.h" and "src/user.h".
Remove declarations duplicating "src/user.h".
[GTK]: Include "src/dialog.h" and "src/util.h".
* editmenu.c (edit_wrap_cmd): Fix declaration.
(edit_about_cmd): Likewise.
* editwidget.c (get_key_state): Likewise.
* editcmd.c (edit_quit_cmd): Don't use strcmp on the result of
gtk_dialog_cauldron() since it's NULL if the dialog has been
closed without using buttons.
* edit.c (edit_execute_cmd): Put time format to a variable to
avoid gcc warning about Y2K issues with %c in strftime().
2001-06-14 Pavel Roskin <proski@gnu.org>
* edit.c: Declare cmd_F* static. Comment out cmd_F9.
* edit.c: Use indented #error for compatibility with old C
compilers.
2001-06-13 Pavel Roskin <proski@gnu.org>
* edit.c (edit_execute_cmd) [GTK]: Disable user menu - it
doesn't work.
(user_menu) [GTK]: Disable.
* gtkedit.c (tb_items): Use complete words. Disable pull-down
menu.
2001-06-09 Pavel Roskin <proski@gnu.org>
* editcmd.c (catstrs): Use interactive_display() without
specifying the help file.
From Andrew V. Samoilov.
2001-06-08 Andrew V. Samoilov <sav@bcs.zp.ua>
* editcmd.c [HAVE_CHARSET]: Really include charset.h.
* editmenu.c (edit_wrap_cmd): Memory leaking fixed.
2001-06-05 Pavel Roskin <proski@gnu.org>
* edit.c [HAVE_CHARSET]: Include charsets.h and selcodepage.h.
* editcmd.c [HAVE_CHARSET]: Add charset conversion support.
* editdraw.c [HAVE_CHARSET]: Likewise.
From Andrew V. Samoilov <sav@bcs.zp.ua>
and Walery Studennikov <hqsoftware@mail.ru>.
2001-06-01 Pavel Roskin <proski@gnu.org>
* gtkedit.h: Warning fix - use stricter declarations for
destroy_me and destroy_me_user_data.
2001-05-31 Pavel Roskin <proski@gnu.org>
* Makefile.in: Define HAVE_X and HAVE_GNOME, not just GTK -
header files are using them.
* editdraw.c (edit_render) [GTK]: Revert previous patch, it
broke compilation.
2001-05-31 Andrew V. Samoilov <sav@bcs.zp.ua>
* editdraw.c (edit_status): Use strcpy (s, ) instead of
sprintf (s, "%s", ).
(set_color) [MIDNIGHT]: Became a macro.
(render_edit_text) [defined(MIDNIGHT) || defined(GTK)]: Warning fix.
(edit_render) [GTK]: Eliminate win variable.
(key_pending) [!GTK]: Warning fix.
2001-05-30 Pavel Roskin <proski@gnu.org>
* editdraw.c (status_string): Use is_printable(). Declare
static. Eliminate intermediate buffer. Use memset() for filling.
Print byte as unsigned. Use C notation for hex numbers.
* editdraw.c (status_string): Don't print non-printable chars.
Better formatting. Print "<EOF>" at the end of file instead of
-1. Use snprintf instead of sprintf.
2001-05-30 Andrew V. Samoilov <sav@bcs.zp.ua>
* syntax.c (open_include_file) [MIDNIGHT]: Don't hardcode location
of syntax file(s) with LIBDIR, use mc_home instead.
From Ludovic Drolez <ludovic.drolez@freealter.com>.
(syntax_text): Use perl.syntax to highlight perl modules (.pm).
2001-05-18 Pavel Roskin <proski@gnu.org>
* editcmd.c (edit_replace_prompt): Warning fix.
2001-02-26 Pavel Roskin <proski@gnu.org>
* editcmd.c (edit_delete_macro_cmd) [MIDNIGHT]: Don't use
CK_Macro on the argument to edit_delete_macro().
* edit.c (edit_init_file): Remove, it's useless. All the
necessary files should be created when needed.
* edit.h: Remove declaration of edit_init_file().
2000-11-01 Andrew V. Samoilov <sav@bcs.zp.ua>
* editcmd.c (canonicalize_pathname) [GTK]: memory leaking fixed
2000-10-30 Pavel Roskin <proski@gnu.org>
* editcmd.c (canonicalize_pathname) [GTK]: Make the argument
constant.
(edit_split_filename) [GTK]: Make the second argument constant
to match the declaration.
2000-10-30 Andrew V. Samoilov <sav@bcs.zp.ua>
* editcmd.c (edit_save_file): better error handling on writing
(edit_sort_cmd): saved sort options proposed in dialog
edit.h, editcmd.c: declaration for edit_save_block () added
(edit_split_filename): f constified
* edit.c (edit_init) [ENABLE_NLS]: option_whole_chars_search
expanded by national letters using current locale on first call
(edit_file_is_open) [MIDNIGHT]: all occurrences and related code
are commented
(edit_execute_cmd): typo in error message fixed
2000-09-30 Pavel Roskin <proski@gnu.org>
* libgettext.h: Removed, shouldn't be here.
* Makefile.in: Adjusted to remove libgettext.h
2000-09-15 Andrew V. Samoilov <sav@bcs.zp.ua>
* editcmd.c (edit_delete_macro, edit_(load|save)_macro_cmd): don't
translate keywords written to macro file or macro don't work, at least
for Cyrillic. Made this as separate commit, so, if it seriously breaks
compatibility it's easy to revert it.
2000-09-15 Andrew V. Samoilov <sav@bcs.zp.ua>
* editcmd.c (edit_save_file): fopen()+fwrite()+fclose() replaced
by open()+write()+close() to restore possibility to edit files
over Midnight Commander's VFSes
(edit_replace_cmd) [MIDNIGHT]: some more right algorithm to calculate
menu coordinates used. I don't like if menu hides replaced text.
(edit_goto_cmd): Memory leaking fixed when f is empty string
2000-09-07 Andrew V. Samoilov <sav@bcs.zp.ua>
* edit.c (check_file_access) [MIDNIGHT,GTK]: error message localized;
some cosmetics changes to avoid annoying warnings
* editcmd.c (edit_save_file): pclose returns 0 on success,
file fclose()d when fwrite fails
(pipe_mail): malloc () + sprintf () replaced by g_strdup_printf ()
* syntax.c (syntax_text): Makefile replaced by [Mm]akefile to cover
makefile and GNUmakefile
(upgrade_syntax_file): infinitive loop fixed when rule file
is outdated but it cannot be unlinked/overwritten
2000-08-30 Pavel Roskin <proski@gnu.org>
* editwidget.c [!MIDNIGHT]: include xdnd.h
* Makefile.in: distribute xdnd.h
2000-08-18 Pavel Roskin <proski@gnu.org>
* Makefile.in: adjusted list of distributed files.
Added rule for rebuilding Makefile
2000-08-08 Pavel Roskin <proski@gnu.org>
* gtkedit.c [GTK]: don't include mousemark.h
* gtkedit.h [GTK]: likewise
2000-08-03 Pavel Roskin <proski@gnu.org>
* mousemark.c, mousemark.h: removed
* Makefile.in: don't distribute mousemark.h
* gtkedit.c [MIDNIGHT]: don't include mousemark.h
* gtkedit.h [MIDNIGHT]: likewise
2000-07-20 Andrew V. Samoilov <sav@bcs.zp.ua>
* gtkedit/editcmd.c (edit_save_file): check fclose()s return value
to prevent loss of data
(edit_block_process_cmd): don't translate empty string
* gtkedit/edit.h (edit_get_write_filter, edit_write_stream,
edit_init_file): added declarations
* edit.c (edit_filters): constified
(edit_get_write_filter): filename constified
(user_menu): don't translate empty string
* syntax.c (syntax_text): constified
(upgrade_syntax_file): syntax_line constified, f closed after use