Commit Graph

60 Commits

Author SHA1 Message Date
Pavel Roskin 3860ff7b34 * util.h: Rename compression types, add a type for uncompressed
files.
* util.c (is_gunzipable): Rename to ...
(get_compression_type): this.  Don't check archive length, since
it's unreliable if there is padding at the end of the file.
Eliminate prehistoric Linux workaround.  All callers adjusted.

* utilunix.c (close_error_pipe): Use "%s" in message () to
prevent possible crash.
(check_error_pipe): Likewise.
2002-07-02 21:09:25 +00:00
Pavel Roskin 7ca687c8ed * eregex.h: Update from glibc-2.2.5.
* regex.c: Likewise.
* find.c: Use eregex.h, not regex.h.
* util.c: Likewise.
* view.c: Likewise.
From Alexander Varakin <avarakin00@hotmail.com>
2002-03-18 21:08:18 +00:00
Andrew V. Samoilov aa2832dff9 * util.c [!HAVE_TRUNCATE] (truncate): Close fd if my_ftruncate
fails.

* util.c [HAVE_CHARSET] (is_printable): Eliminate printable.
* setup.c [HAVE_CHARSET] (load_setup): Don't use
init_printable_table().

* charset.c (printable): Removed.
(init_printable_table): Removed.
2002-02-04 18:09:42 +00:00
Pavel Roskin 030d1bf2ad * main.h: Remove dead declarations.
* setup.c: Remove defunct extension alignment support.
* util.c: Likewise.
* util.h: Likewise.
2002-01-17 07:17:54 +00:00
Andrew V. Samoilov 21c015b2f8 * util.c (string_perm) [S_IFDOOR]: Support Solaris doors.
screen.c (string_file_type) [S_IFDOOR]: Likewise.
2002-01-09 10:54:13 +00:00
Pavel Roskin fa89635b51 Fully eliminate all references to HAVE_X and HAVE_GNOME. 2001-11-14 23:20:37 +00:00
Pavel Roskin 7fe30fff07 * cmd.c (guess_message_value): Remove the argument. Adjust all
callers.
2001-09-16 00:18:39 +00:00
Pavel Roskin 13e92aca94 * layout.c: Use HAVE_TERMIOS_H and HAVE_SYS_IOCTL_H more
consistently.
* mouse.c: Likewise.
* subshell.c: Likewise.
* win.c: Likewise.
* util.c: Remove unused includes.
2001-09-11 02:18:02 +00:00
Pavel Roskin c11389facb * global.h: Include io.h, pwd.h, grp.h and utime.h. Adjust all
sources not to include them and to include global.h at the right
place.
2001-09-07 17:52:19 +00:00
Pavel Roskin a8ef641beb * x.h: Remove. Adjust all users. Make sure that global.h is
included instead.  Don't include sys/param.h unconditionally -
rely on global.h taking care of it.
* Makefile.in: Remove x.h.
2001-09-03 05:07:40 +00:00
Pavel Roskin 1ef25591d2 * util.c (size_trunc_len): Add units parameter. Change all
callers.
2001-08-30 16:41:08 +00:00
Pavel Roskin 242a26c03b * util.c (size_trunc_len): Print size values with some (little)
sense for tiny and even wee lengths (i.e. squeezed X terminals).
2001-08-30 16:19:45 +00:00
Pavel Roskin b5e64692df * util.c (strip_ctrl_codes): Rewrite using pointers. Fix
stripping sequences beginning with "e[".  Check is_printable().
2001-08-16 03:52:51 +00:00
Andrew V. Samoilov 78dbe61c6a * util.c [!HAVE_X] (is_printable): Don't duplicate declarations from
main.h.
(load_file): Use fopen and fstat to prevent race conditions.
(size_trunc): Make suffix const array.
(strip_password): Make prefixes const array.
(file_date): Make fmt auto variable.
2001-07-31 10:38:15 +00:00
Pavel Roskin 70fa991882 * util.c [!USE_VFS] (get_current_wd): Resurrect, this time using
g_get_current_dir().
2001-07-27 21:20:43 +00:00
Pavel Roskin b4be52ba78 * util.c (mc_mkstemps): Don't prepend $TMPDIR if prefix contains
path separator.
2001-07-27 19:27:09 +00:00
Pavel Roskin 11fd4abc0e * main.c [HAVE_X]: Disable eight_bit_clean and full_eight_bits.
* util.c (is_printable) [HAVE_X]: Simplify.
2001-07-26 05:01:26 +00:00
Pavel Roskin fd895e3759 * user.c: Eliminate static variable s_editwidget. Pass
edit_widget as argument.  All callers changed.
(expand_format): Fix expansion of %n and %b for the editor.
* util.c: Remove dead code.
2001-07-23 22:50:54 +00:00
Pavel Roskin c19dfa9175 * util.c (get_current_wd): Remove. It's obsoleted by
g_get_current_dir() from glib.
2001-07-18 03:49:08 +00:00
Pavel Roskin 4349ae1c4e * util.c (mc_mkstemps): Always use "unsigned long" for enthropy,
since gcc-2.7.2.1 on SunOS doesn't understand __extension__ and
checking for "long long" is not worth the trouble.
Reported by David Martin <dmartina@excite.es>
2001-07-17 18:38:46 +00:00
Pavel Roskin a5281c3ee4 * util.c (size_trunc_len): New function - print file size to
a buffer of limited length.
* util.h: Declare size_trunc_len().
* screen.c (string_file_size): Use size_trunc_len().
2001-06-28 04:17:28 +00:00
Pavel Roskin 521a886013 * utilunix.c (init_my_statfs): Move this ...
* util.c (my_statfs): ... and this ...
* mountlist.c: ... here.
* util.h: Move mountlist-related declarations ...
* mountlist.h: ... here.
* info.c: Include mountlist.h.
2001-06-18 22:24:04 +00:00
Pavel Roskin 7205d0210c * background.c: Include "x.h".
* panelize.c: Likewise.
* treestore.c: Likewise.
* user.c: Likewise.
* util.c: Likewise.
* command.c: Reorder includes. Include "x.h".
* complete.c: Likewise.
* find.c: Likewise.
* user.h: Declare user_menu_cmd() inconditionally.
* i18n.h [GAVE_GNOME]: Remove code that is now in x.h.
2001-06-15 23:37:59 +00:00
Pavel Roskin 58d8979490 * util.c (load_mc_home_file): New function. Load file from
mc_home, but try localized version of that file first.
* util.h: Declare load_mc_home_file().
* help.c (interactive_display): Use load_mc_home_file(). If the
first argument is NULL assume mc.hlp.
* dlg.c (dialog_handle_key): Use interactive_display() without
specifying the help file.
* tree.c (tree_copy): Likewise.
* cmd.c (help_cmd): Likewise.
(get_random_hint): Use load_mc_home_file().
2001-06-09 07:13:46 +00:00
Pavel Roskin cd1fd56223 * boxes.c [HAVE_CHARSET]: New charset selection dialog.
* main.c [HAVE_CHARSET]: Don't use eight_bit_clean and
full_eight_bits. Use source_codepage and display_codepage to
deduce the terminal 8-bitness.
* main.h [HAVE_CHARSET]: Change to match main.c.
* setup.c [HAVE_CHARSET]: Implement saving and loading charset
settings.
* util.c (is_printable) [HAVE_CHARSET]: Use charset settings.
* view.c [HAVE_CHARSET]: Implement charset support.
From Walery Studennikov <hqsoftware@mail.ru>.
2001-06-05 22:49:15 +00:00
Pavel Roskin a13c1d1928 * ext.c (exec_extension): Use g_free() on the result of
mc_mkstemps(). Don't free it if mc_mkstemps() fails - it's not
needed anymore.
* user.c (execute_menu_command): Likewise.
* util.c (mc_mkstemps): Return NULL in the filename in the case
of failure. Remove support for NULL as the first argument.
From Andrew V. Samoilov.
2001-05-22 07:10:43 +00:00
Pavel Roskin bea09b932d * src/ext.c (exec_extension): Use mc_mkstemps().
* src/user.c (execute_menu_command): Use mc_mkstemps().
* src/util.c (mc_mkstemps): New function - safely create and
open temporary file. Return the handle and the name.
* src/util.h: Declarations for init_tmpdir() and mc_mkstemps().
Define TMPDIR_DEFAULT and SCRIPT_SUFFIX.
* vfs/direntry.c (vfs_s_open): Use mc_mkstemps. Create and close
temporary file to reserve its name on the filesystem.
(vfs_s_retrieve_file): Use mc_mkstemps().
(g_tempnam): Remove.
* vfs/extfs.c (extfs_open): Use mc_mkstemps().
* vfs/sfs.c (redirect): Likewise.
* vfs/shared_ftp_fish.c (_get_file_entry): Likewise.
(retrieve_file): Likewise.
* vfs/vfs.c (mc_def_getlocalcopy): Likewise.
* vfs/xdirentry.h: Remove declaration of g_tempnam().
2001-05-21 16:21:07 +00:00
Alan Cox 1a0ab78ea8 As reported by Al Viro:
take Midnight Commander. Go to directory that contains some
files. Press <+><CR><+><+><CR><CR><+><+><CR> (<+> being the grey one).

IOW, the first invalid regexp and we are toast - old_pattern is freed and
not reset to NULL. Next call of regexp_match() and we've got a double-free.
What's really pissing off is that caller takes care to tell you that
regexp is invalid. In large red window. I.e. they had added error reporting
and had _never_ given it a try, not to mention giving code a review. Sigh...
2000-12-18 16:42:20 +00:00
Pavel Roskin e828211662 Updated address of Free Software Foundation 2000-08-22 22:50:00 +00:00
Andrew V. Samoilov 40c1c50201 2000-06-14 Andrew V. Samoilov <sav@bcs.zp.ua>
* panel.h, util.[ch] (struct WPanel, size_trunc, size_trunc_sep): size
	parameters and WPanel.total field became double, thus, total size
	of selected files/directories is shown in the mini status correctly
	when it exceeds 2 GB.
2000-06-15 07:03:49 +00:00
Norbert Warmuth d836e5a79a 1999-09-19 Andrew V. Samoilov <sav@bcs.zp.ua>
* src/user.c (check_patterns): char* is used instead of char [] in sizeof

* src/util.c (string_perm): prefix named pipes by 'p' and not by `s'


1999-09-19  David Martin <dmartina@usa.net>

* gtkedit/editcmd.c (edit_print_string): Use unsigned char so that
8 bit chars from strftime get displayed when inserting date.

* lib/mc.ext.in: Add entries for bzip2 compressed pages as used in
Mandrake 6.0. The generic entry for bzip2 moved to the end of the
file to avoid interferences. In this one I changed the extension check
to a type check (as used for gzip) which might give problems in some
systems.

* configure.in: Use -Tlatin1 to format man pages when available and
"view" 8 bit chars.


1999-09-19  Norbert Warmuth  <nwarmuth@privat.circular.de>

* gtkedit/edit.h: Include files reordered in order to make it compile with
--with-debug

* gtkedit/editcmd.c (menu_save_mode_cmd): calculate dialog width
dependent on lenght of translated strings to display.

* src/mad.c, mad.h, util.c, util.h: Move mad-functions from util.[ch]
to mad.[ch]

* src/option.c: Include files reordered in order to make it compile with
--with-debug

* src/mad.c (mad_init): New function. Initialize debug FILE pointer to
stderr (moved to a function because not on every system stderr is
a constant).
(mad_set_debug): added const qualifier

* src/main.c (main): call mad_init

* po/*.po: s/defination/definition/

* gnome/Makefile.in ($(MAGICDEV_GENERATED)): Make it compile with $buildir
!= $srcdir.

* vfs/ftpfs.c (ftpfs_set_debug), vfs.h: added const qualifier.

* vfs/mcserv.c: removed definition of mad_strconcat which is also
in mad.c.
1999-09-19 23:09:07 +00:00
Norbert Warmuth 946ac9b60b This commit mainly adds a password dialog to smbfs. In the Gnome Edition
this dialog doesn't look perfect but at least it doesn't break gmc.


1999-09-14  Norbert Warmuth  <nwarmuth@privat.circular.de>

* gnome/layout: Added the new samba password dialog.

* src/widget.[ch] (input_new): added const qualifier

* src/util.c (wipe_password): Check for NULL.


1999-09-14  Norbert Warmuth  <nwarmuth@privat.circular.de>

* vfs/smbfs.c (various places): Store filenames in memory with the unix
character set and convert it back to the dos character set when filenames
are passed back to the samba server. If samba is configured correctly
this will fix the problems with filenames which contain national characters.

(bucket_set_authinfo): Set domain, username and password which will
be used to log on and authenticate against the samba server and remember this
information on a host/share basis. If set use PASSWD to get the
password. If already authenticated against the host and share use this
information. If already authenticated against host and IPC$ use this
information. If neither of the former is true ask the user how to
log on.

(authinfo_get_authinfo_from_user): New function. Query the user for
domain, username and password to use for authentication.

(authinfo_free): New function. Free memory in authentication structure.

(authinfo_free_all): New function. Free the list used to remember
authentication information.

(authinfo_compare_host_and_share, authinfo_compare_host): New functions.
Helper functions used to search the authentication list.

(authinfo_add): New function. Add one authentication entry to the
authlist.

(authinfo_remove): New function. Remove one entry from the authlist.

(free_bucket): Free memory associated with one bucket.

(smbfs_get_free_bucket): Initialize the complete connection array
with 0. Free the memory allocated for a bucket and initialize the
bucket before reusing it.

(smbfs_open_link): use new functions to get authentication information

(get_stat_info, smbfs_stat): remove unused variables.
1999-09-14 18:20:02 +00:00
Norbert Warmuth 972271c9e2 1999-08-06 Norbert Warmuth <nwarmuth@privat.circular.de>
* gnome/gconf.h (PORT_STATIC_IN_STRING_FILE_XTIME): new port specific
feature. The Gnome edition first calls all string_file functions
and then uses the return values of these functions. Therefore additional
static buffers in string_file_[acm]time are needed.

* src/screen.c (string_file_[amc]time): These three functions use
file_date which returns a pointer to a static buffer. In the
Gnome edition this buffer has to be coppied to a static buffer
which isn't used in the other two functions (Fix Bug #1766).

* src/util.c, util.h: Moved some constants to util.h

* vfs/tar.c (read_header): Don't segfault when a symlink points to the
root directory.


1999-08-04  Norbert Warmuth  <nwarmuth@privat.circular.de>

* src/widget.c (push_history): Add SMB Link to the list of input dialogs
where urls are input without vfs prefix.

Translate the titles of these input dialogs only once.

Removed Gnome specific code because the Gnome edition doesn't use
the input history any more.

* src/util.c (strip_password): Add /#smb: to the list of urls which might
be input with password.
1999-08-06 19:24:04 +00:00
Miguel de Icaza 9ffbc3ae81 1999-06-01 Akira Higuchi <a-higuti@math.sci.hokudai.ac.jp>
* gnome/gdesktop-icon.h:
	* gnome/gmc-chargrid.c: Replace gdk_font_load() with
	gdk_fontset_load(), and change the default font names.

1999-06-01  Akira Higuchi <a-higuti@math.sci.hokudai.ac.jp>

	* util.c (is_printable): in GNOME all characters are printable.
1999-06-01 22:38:56 +00:00
Miguel de Icaza 83378922d7 David Martina's strftime's patches 1999-04-30 12:41:41 +00:00
Norbert Warmuth 2c53bb4eb5 Tue Apr 27 20:31:13 1999 Norbert Warmuth <nwarmuth@privat.circular.de>
* src/util.c (strip_home_and_password): Don't split the path in the
middle of a directory, e.g. "/home/bofh" will not be translated to
"~h" (fixes the bug reported by Alex Fortuna <alex@rdc.ru>)
1999-04-28 04:03:30 +00:00
Miguel de Icaza 0ef58f89a5 1999-04-06 David Martin <dmartina@usa.net>
* gcmd.c: marked message for translation.


1999-04-06  David Martin <dmartina@usa.net>

	* info.c (text out of box and locale layout).

	* util.c: If gmc uses strftime() why mc doesn't?

	* view.c: a) Tune status line so it does fit in a Quick View Panel
	b) Let Hex View resize cleanly. I think it's fixed for panel
	re-split and SIGWINCH signal in xterm. gmc still fails. There was
	a tiny risk of division by zero when pressing F4 in a very small
	box. True hard work... Must try and check it.

1999-04-06  David Martin <dmartina@usa.net>

	* Updated es.po
1999-04-06 19:00:16 +00:00
Norbert Warmuth bfa7724f00 Sun Mar 28 23:39:48 1999 Norbert Warmuth <nwarmuth@privat.circular.de>
* configure.in: Deleted duplicate VFS checks. GNOME_VFS_CHECKS
now contains all VFS checks.

* src/util.c (is_printable): Character 155 is non printable even when
full eight bit output is enabled (on the linux console 155 is
interpreted as "ESC [").

* vfs/vfs.h (vfs_translate_url): Fixed the macro which is used when
compiling without vfs.

* macros/gnome-vfs.m4: Add --with-vfs option. GNOME_VFS_LIBS still needs
to be fixed but that's not a problem because there's no libvfs, yet.
1999-03-29 05:06:50 +00:00
Timur Bakeyev 79c0c8442f Thu Mar 18 16:09:09 1999 Timur Bakeyev <mc@bat.ru>
* panel.h, screen.c: Add an ability to center justify fields in
	panel, in addition to left and right justificatin. Just for fun.
	Try =name in user format.

	* util.c (name_quote): Quote "~@^|;:". Hope, that's all :)
1999-03-18 13:40:23 +00:00
Norbert Warmuth 809247dd1c Wed Mar 10 22:05:46 1999 Norbert Warmuth <nwarmuth@privat.circular.de>
* es.po: Updated with David Martins translation.

Wed Mar 10 21:52:55 1999  David Martin <dmartina@usa.net>
* gtkedit/editcmd.c: Added missing translation tags.

* gtkedit/editoptions.c: Added missing translation tags. Translate
radio buttons on first use.

Wed Mar 10 22:21:19 1999  David Martin <dmartina@usa.net>
* util.c (my_putenv): char* was used to store the length of a string

* info.c (info_show_info): cast st_dev and st_ino when passing
to printw.
1999-03-10 21:56:08 +00:00
Norbert Warmuth d2b509780d Tue Mar 2 22:54:50 1999 Norbert Warmuth <nwarmuth@privat.circular.de>
* util.c (name_quote): Quote '<' and '>'.
1999-03-02 21:49:03 +00:00
Miguel de Icaza 883be3772e 1999-02-24 Miguel de Icaza <miguel@nuclecu.unam.mx>
* util.c: Test for glibc/linux and if so, do not use getwd, but
	getcwd as on this system it is better than popen ("pwd").
1999-02-24 21:26:49 +00:00
Miguel de Icaza cae3f1b9ab Various typo fixes in gnome-file-property-dialog.c. nd in gdialogs.c.
It does not look as it was tested a lot.

Miguel

v
1999-02-13 20:12:35 +00:00
Norbert Warmuth 04ebcebc1b Wed Feb 3 22:27:04 1999 Norbert Warmuth <nwarmuth@privat.circular.de>
* src/util.c (strip_password): Extented to find the url in the first
parameter. The second parameter tells whether it should search the
url (indicated by known prefixes) in the first parameter or whether
the first parameter is a url without a prefix ("ftp://", "/#ftp:",
"/#mc:").

* src/main.c (directory_history_add): Strip the password (if any) from
the freshly added value.

* src/widget.c (push_history): ditto. There's a ugly special casing
necessary for the network and ftp link dialogs (urls are entered
with out prefix).

* src/widget.c (history_put): Restrict read and write access to the
history file to the owner (Just in case I forgot to strip passwords
somewhere).


Mon Feb  1 19:32:12 1999  Norbert Warmuth  <nwarmuth@privat.circular.de>

* vfs/ftpfs.c (insert_dots): renamed from insert_dot. We have to
insert ".." as well or directories from ftp servers which don't
list "." and ".." are displayed with an additional "/".
1999-02-03 23:19:40 +00:00
Timur Bakeyev a39568367e Glibing..... (2)
Wed Jan 27 03:17:44 1999  Timur Bakeyev <mc@bat.ru>

	* Converted memory managment to Glib. Now we use g_new()/g_malloc()/
	g_strdup()/g_free() routings. Also, copy_strings() replaced by
	g_strconcat(), strcasecmp() -> g_strcasecmp(),and sprintf() by
	g_snprintf().

	* Some sequences of malloc()/sprintf() changed to g_strdup_printf().

	* mad.[ch]: Modified, to work with new GLib's memory managment. Fixed
	a missing #undef for tempnam, which caused dead loop. Add several new
	functions to emulate GLib memory managment.

	*main.c, mad.[ch]: Add a new switch  "-M", which allows to redirect MAD
	messages to the file.

	* util.[ch], utilunix.c: Modified, deleted our variants of strcasecmp()
	and strdup() - we have g_ equivalences. Remove get_full_name() - it is
	similar to concat_dir_and_file(). Some other tricks with g_* functions.

	* global.h: Modified, extended. Now it is main memory mangment include -
	i.e. all inclusions of <stdlib.h>, <malloc.h>, <glib.h>, "fs.h", "mem.h",
	"util.h" and "mad.h" done there. This elimanates problem with proper or-
	der of #include's.

	* All around the source - changed order of #include's, most of them gone
	to global.h (see above), minor changes, like "0" -> NULL in string func-
	tions.
1999-01-27 01:08:30 +00:00
Miguel de Icaza ef9e7021eb Temporary fix:
Use the system regex.h header file.

Miguel
1999-01-26 20:56:57 +00:00
Miguel de Icaza 565db7bee7 Until all its done, fix this 1999-01-21 03:38:56 +00:00
Timur Bakeyev f16c1a5fa1 Commit changes, that allow coexist Glib'ed VFS and not converted MC. Affects
mad.[ch], util.[ch]
1999-01-20 22:13:40 +00:00
Miguel de Icaza 7bae04e59d 1999-01-11 Miguel de Icaza <miguel@nuclecu.unam.mx>
* util.c: Provide workarounds for Linux kernel bug.
1999-01-12 02:24:52 +00:00
Timur Bakeyev 4b0254f4e1 Just add "{","}" to the list of quoted chars. 1999-01-12 00:26:59 +00:00