Re: [RFE][PATCH] Display free space on device in panels

2006-02-01 Thread Jindrich Novy
Hello,

On Mon, 2006-01-02 at 14:41 +0100, Jindrich Novy wrote:
 thanks for your comments, attaching the patch better matching the mc
 coding style.

I modified the patch so that it can be switched on/off in the
Options/Layout dialog to display free space on device.

termshot(TM) is attached:
┌─~──v┐┌─~/CVS/mc/devel──v┐
│   Name   │Size│  MTime││   Name   │Size │  MTime│
│/..   │UP--│   ▲│/..   │UP--D│   ▲
│/.Azureus │4096│Dec 29 15: ●│/CVS  │ 4096│Jan 25 13: ●
│/.TeXmacs │4096│Oct  6 10: ▒│/i386 │ 4096│Feb  1 07: ▒
│/.Trash   │4096│Jan  8 22: ▒│/mc-4.6.1a│ 4096│Feb  1 07: ▒
│/.aMule   │4096│Nov 26 21: ▒│ .cvs~nore│   18│Dec  6 13: ▒
│/.amaya   │4096│Jan 10 14: ▒│ Makefile │  175│Sep  9  20 ▒
│/.anjuta  │4096│Dec 30 15: ▒│ mc-2~atch│  501│Jan 31 12: ▒
│/.cam~erts│4096│Aug 20 21: ▒│ mc-4~.rpm│2950K│Jan 25 16: ▒
│/.cdd~lave│4096│Jan  1 01: ▒│ mc-4~.rpm│2951K│Feb  1 07: ▒
│/.comments│4096│Jan 15 21: ▒│ mc-4~.bz2│2862K│Nov 29 22: ▒
│/.ddd │4096│Jan 28 14: ▒│ mc-4~.new│2863K│Jan 29 19: ▒
├2787M (12%) of 21G─▼├─2787M (12%) of 21G─▼
│/..   │UP--│drwxr-xr-x ││/..   │UP--D│drwxr-xr-x │
└───┘└┘
enigma:~/CVS/mc/devel$  [^]

what shows how the free space on device is displayed.

ChangeLog:
2006-02-01  Jindrich Novy  [EMAIL PROTECTED]

* screen.c: Add new function show_free_space() to display free
space on device. Add calls so that show_free_space() is called
when panels are drawn.
* layout.c (struct check_options, b2left_cback, b2right_cback
layout_callback, init_layout): Add configuration option to
Options/Layout dialog.

Regards,
Jindrich
-- 
Jindrich Novy [EMAIL PROTECTED], http://people.redhat.com/jnovy/
(o_   _o)
//\  The worst evil in the world is refusal to think. //\
V_/_ _\_V

--- mc-4.6.1a/src/screen.c.showfree	2006-01-31 21:59:12.0 +0100
+++ mc-4.6.1a/src/screen.c	2006-01-31 21:59:12.0 +0100
@@ -49,6 +49,7 @@
 #define WANT_WIDGETS
 #include main.h		/* the_menubar */
 #include unixcompat.h
+#include mountlist.h		/* my_statfs */
 
 #define ELEMENTS(arr) ( sizeof(arr) / sizeof((arr)[0]) )
 
@@ -106,6 +107,12 @@ int filetype_mode = 1;
 /* The hook list for the select file function */
 Hook *select_file_hook = 0;
 
+/* Old current working directory for displaying free space */
+char *old_cwd = NULL;
+
+/* Used to figure out how many free space we have */
+struct my_statfs myfs_stats;
+
 static cb_ret_t panel_callback (Widget *, widget_msg_t msg, int parm);
 static int panel_event (Gpm_Event *event, void *);
 static void paint_frame (WPanel *panel);
@@ -851,6 +858,41 @@ paint_dir (WPanel *panel)
 standend ();
 }
 
+
+static void
+show_free_space(WPanel *panel)
+{
+struct stat st;
+
+/* Don't try to stat non-local fs */
+if (!vfs_file_is_local(panel-cwd))
+	return;
+
+if (old_cwd == NULL || strcmp(old_cwd, panel-cwd) == 0) {
+	init_my_statfs();
+	g_free(old_cwd);
+	old_cwd = g_strdup(panel-cwd);
+}
+
+my_statfs (myfs_stats, panel-cwd);
+st = panel-dir.list [panel-selected].st;
+	
+if (myfs_stats.avail  0 || myfs_stats.total  0) {
+	char buffer1 [6], buffer2[6], *tmp;
+	size_trunc_len (buffer1, 5, myfs_stats.avail, 1);
+	size_trunc_len (buffer2, 5, myfs_stats.total, 1);
+	tmp = g_strdup_printf (_(%s (%d%%) of %s), buffer1, myfs_stats.total  0 ?
+			   (int)(100 * (double)myfs_stats.avail / myfs_stats.total) : 0,
+			   buffer2);
+	widget_move (panel-widget, panel-widget.lines-3, panel-widget.cols-2-strlen(tmp));
+	if (panel-active)
+	attrset (REVERSE_COLOR);
+	addstr (tmp);
+	attrset (NORMAL_COLOR);
+	g_free (tmp);
+}
+}
+
 static void
 mini_info_separator (WPanel *panel)
 {
@@ -866,6 +908,7 @@ mini_info_separator (WPanel *panel)
 hline ((slow_terminal ? '-' : ACS_HLINE) | NORMAL_COLOR,
 	   panel-widget.cols - 2);
 #endif/* !HAVE_SLANG */
+if (free_space) show_free_space (panel);
 }
 
 static void
@@ -929,6 +972,8 @@ show_dir (WPanel *panel)
 widget_move (panel-widget, 0, panel-widget.cols - 3);
 addstr (v);
 
+mini_info_separator (panel);
+
 if (panel-active)
 	standend ();
 }
--- mc-4.6.1a/src/layout.c.showfree	2006-01-31 21:59:12.0 +0100
+++ mc-4.6.1a/src/layout.c	2006-01-31 22:02:28.0 +0100
@@ -99,6 +99,9 @@ int message_visible = 1;
 /* Set to show current working dir in xterm window title */
 int xterm_title = 1;
 
+/* Set to show free space on device assigned to current directory */
+int free_space = 1;
+
 /* The starting line for the output of the subprogram */
 int output_start_y = 0;
 
@@ -128,6 +131,7 @@ static int _command_prompt;
 static int _keybar_visible;
 static int _message_visible;
 static int _xterm_title;
+static int _free_space;
 static int 

Re: [RFE] [PATCH] star vfs and xattr feature request

2006-02-01 Thread Pavel Tsekov
On Tue, 31 Jan 2006, Curtis Doty wrote:

 Pavel Tsekov wrote:

 On Mon, 30 Jan 2006, Curtis Doty wrote:
 
 Hi, I'm the original poster of this patch to the redhat bugzilla. Where
 it was closed summarily. However, I really thing adding support for
 tarball extended attributes is increasingly valuable on selinux systems.
 
 And star seems to be the best tool for the job. Are there other ways of
 safely extracting files from a tarball with these extensions? I'm happy
 to rebuild the patch against the mc cvs if there is positive feedback.
 
 another reference:
 http://cdrecord.berlios.de/old/private/star.html
 
 
 
 Since star archives are esentially tar archives with extended information
 I don't see why a extfs solution is necessary. We can just update the
 tar code to support the required extension keywords. It's just a matter of
 parsing a few strings.
 
 
 Hrmm, maybe I'm over-thinking the problem, but according to this
 http://cvs.fedora.redhat.com/viewcvs/devel/star/star-1.5-selinux.patch
 it had to be compiled against the selinux headers. Is that an
 appropriate direction for mc/vfs/tar.c?

I think - yes. Btw there was at least one request (in bugzilla or the
mailing list) about adding support for extended attributes to MC.
___
Mc-devel mailing list
http://mail.gnome.org/mailman/listinfo/mc-devel


current CVS mc isn't compilable

2006-02-01 Thread Jindrich Novy
Hello mc-devel,

the patch says it all.

Regards,
Jindrich
-- 
Jindrich Novy [EMAIL PROTECTED], http://people.redhat.com/jnovy/
(o_   _o)
//\  The worst evil in the world is refusal to think. //\
V_/_ _\_V

--- mc-4.6.1a/src/view.c.bracket	2006-01-31 15:39:30.0 +0100
+++ mc-4.6.1a/src/view.c	2006-02-01 14:52:39.0 +0100
@@ -1744,7 +1744,7 @@ view_display_hex (WView *view)
 const screen_dimen width = view-data_area.width;
 const int ngroups = view-bytes_per_line / 4;
 const screen_dimen text_start =
-	8 + 13 * ngroups + ((width  80) ? 0 : (ngroups - 1 + 1);
+	8 + 13 * ngroups + ((width  80) ? 0 : (ngroups - 1 + 1));
 /* 8 characters are used for the file offset, and every hex group
  * takes 13 characters. On ``big'' screens, the groups are separated
  * by an extra vertical line, and there is an extra space before the
___
Mc-devel mailing list
http://mail.gnome.org/mailman/listinfo/mc-devel


[PATCH] Update file system and mount info in acinclude.m4

2006-02-01 Thread Leonard den Ottolander
Hi,

Although this patch doesn't fix any current issue it might be still a
good a idea to update the code in acinclude.m4 that acquires the file
system and mount information to a more recent version.

The original blocks were taken from fileutils-3.12. I've updated these
to the corresponding code from coreutils-5.93. To make the origins more
clear I've also m4_include()d the corresponding files instead of copying
them inline.

Code builds fine on Linux (FC4) but I can't be sure of other platforms.
Comments?

Leonard.

-- 
mount -t life -o ro /dev/dna /genetic/research



mc.acinclude.patch.gz
Description: GNU Zip compressed data
___
Mc-devel mailing list
http://mail.gnome.org/mailman/listinfo/mc-devel


Re: [slang-users] Suspicious code in slang-2.0.5

2006-02-01 Thread Leonard den Ottolander
Hello Vladimir,

Good to see you again.

(From the slang user list: )
On Mon, 2006-01-30 at 17:39 +0100, Vladimir Nadvornik wrote:
 We got this bugreport from David Binderman [EMAIL PROTECTED]:
 /usr/src/packages/BUILD/slang-2.0.5/src/slcommon.c(107): warning #187: use of
 = where == may have been intended

 Maybe the programmer intended
 
if (((locale == NULL) || (*locale == 0))
 ((NULL == (locale = getenv (LC_ALL))) || (*locale == 0))
 ((NULL == (locale = getenv (LC_CTYPE))) || (*locale == 0))
 ((NULL == (locale = getenv (LANG))) || (*locale == 0)))
  return 0;

Committed to mc CVS.

Leonard.

-- 
mount -t life -o ro /dev/dna /genetic/research


___
Mc-devel mailing list
http://mail.gnome.org/mailman/listinfo/mc-devel


Re: current CVS mc isn't compilable

2006-02-01 Thread Pavel Tsekov
Fixed.

___
Mc-devel mailing list
http://mail.gnome.org/mailman/listinfo/mc-devel


Re: current CVS mc isn't compilable

2006-02-01 Thread Leonard den Ottolander
Hi Jindrich,

On Wed, 2006-02-01 at 15:10 +0100, Jindrich Novy wrote:
 the patch says it all.

It appears Pavel Tsekov has done a commit to fix this, but as he has
used the CVS tag HEAD it does not appear in my cvs updates for the MAIN
branch.

Pavel, could you redo the commit without the CVS tag?

Leonard.

-- 
mount -t life -o ro /dev/dna /genetic/research


___
Mc-devel mailing list
http://mail.gnome.org/mailman/listinfo/mc-devel


Re: syntax switching

2006-02-01 Thread Leonard den Ottolander
Hi Andy,

On Mon, 2006-01-30 at 13:55 +0200, Andy Shevchenko wrote:
 Arny (one of developers of MPlayer) made patch for mc old version. I 
 catch the syntax highlighting toggle feature from it and adopt to a last 
 FC package. I hope, the switcher of syntax highlightind is a usefull 
 feature and should like to be added to mainstream.

Patch has been committed. We might use a different hotkey than Ctrl-S in
the future.

Leonard.

-- 
mount -t life -o ro /dev/dna /genetic/research


___
Mc-devel mailing list
http://mail.gnome.org/mailman/listinfo/mc-devel


Crash on hexediting empty file

2006-02-01 Thread Leonard den Ottolander
Hi,

Try F3 - F4 - F2 on an empty file. Boom, ouch. (Might be that if you
still are in edit mode you need to try after getting back in view mode.)

Happens with an (apart from acinclude.m4) unpatched version from a
couple of days ago (20060129), but also with a patched (but not with
acinclude.m4) version a couple of weeks old (20051207).

(gdb) bt
#0  0x in ?? ()
#1  0x08092edd in buttonbar_call (bb=Variable bb is not available.
) at widget.c:2285
#2  0x080930b9 in buttonbar_callback (w=0x93b1290, msg=WIDGET_HOTKEY,
parm=1002) at widget.c:2304
#3  0x08061c2b in dlg_process_event (h=0x93b0e90, key=1002,
event=0xbf923854)
at dialog.c:614
#4  0x08061fe8 in run_dlg (h=0x93b0e90) at dialog.c:785
#5  0x08090d69 in mc_internal_viewer (command=0x0, file=0x93aa310
exit,
move_dir_p=0xbf923918, start_line=0) at view.c:3304
#6  0x0805be11 in view_file_at_line (filename=0x93aa310 exit,
plain_view=0,
internal=1, start_line=0) at cmd.c:125
#7  0x0805bf32 in view_file (filename=0x93aa310 exit, plain_view=0,
internal=1) at cmd.c:150
#8  0x0805bfb3 in do_view_cmd (normal=0) at cmd.c:208
#9  0x08092ecb in buttonbar_call (bb=Variable bb is not available.
) at widget.c:2282
#10 0x080930b9 in buttonbar_callback (w=0x93b0cd8, msg=WIDGET_HOTKEY,
parm=1003) at widget.c:2304
#11 0x08061c2b in dlg_process_event (h=0x939ad58, key=1003,
event=0xbf923a14)
at dialog.c:614
#12 0x08061fe8 in run_dlg (h=0x939ad58) at dialog.c:785
#13 0x080768e3 in main (argc=1, argv=0xbf924bd4) at main.c:1674

Leonard.

-- 
mount -t life -o ro /dev/dna /genetic/research


___
Mc-devel mailing list
http://mail.gnome.org/mailman/listinfo/mc-devel


[patch?] recent ftpfs ERRNOR fix broke uploading

2006-02-01 Thread Jindrich Makovicka
Hi,

after a fix of wrong ERRNOR usage in ftpfs.c (2006-01-24 ftpfs.c
(ftpfs_dir_load): Fix a bad ERRNOR call), mc segfaults when I try
uploading directories recursively. Changing the return value from -1 to
0 seems to fix the problem.

Regards,
-- 
Jindrich Makovicka
Index: ftpfs.c
===
RCS file: /sources/mc/mc/vfs/ftpfs.c,v
retrieving revision 1.186
diff -u -r1.186 ftpfs.c
--- ftpfs.c 25 Jan 2006 14:04:27 -  1.186
+++ ftpfs.c 1 Feb 2006 22:50:23 -
@@ -1317,7 +1317,7 @@
goto again;
 }
 print_vfs_message (_(ftpfs: failed; nowhere to fallback to));
-ERRNOR (EACCES, -1);
+ERRNOR (EACCES, 0);
 }
 
 static int
___
Mc-devel mailing list
http://mail.gnome.org/mailman/listinfo/mc-devel