Re: BUG: viewing compressed files

2003-07-03 Thread Adam Byrtek / alpha
On Wed, Jul 02, 2003 at 12:49:38PM -0400, Pavel Roskin wrote:
 matched correctly.  The problem was introduced by a recent patch from
 Andrew Samoilov.  I'm sorry that I didn't test that patch sufficiently.

I've just noticed (with help from some Debian user) that the similiar
bug exists in 4.6.0, but it happens only when you view .gz files in
VFS (bug reproduced inside .tgz and .deb VFSses)

To reproduce:
echo test test test  aaa
gzip aaa
tar -czf bbb.tgz aaa.gz

Try to view aaa.gz - it looks fine. Now try to enter bbb.tgz and view
aaa.gz inside - the same (or similiar) bug happens.

Regards
Adam

-- 

  _.|._ |_  _.   :  Adam Byrtek /alpha   [EMAIL PROTECTED]
 (_|||_)| |(_|   :  http://krakow.linux.org.pl/pgp 0xB25952C0
 |   
___
Mc-devel mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/mc-devel


Re: BUG: viewing compressed files

2003-06-30 Thread Adam Byrtek / alpha
On Sun, Jun 29, 2003 at 07:08:15PM -0400, Pavel Roskin wrote:
 On Sun, 29 Jun 2003, Dmitry Semyonov wrote:
 
  I can add, that F4 on gzipped file opens it correctly, but leaves broken
  symlink after closing the editor. This happens in mc-4.6.0-2003-06-25-17
  but not in 4.6.0 version.
 
 It's a write lock.  It needs to be fixed.  Adam, it's your code.

Ok, I'll examine this, but this is definitely not connected with the
bug in the viewer.

-- 

  _.|._ |_  _.   :  Adam Byrtek /alpha   [EMAIL PROTECTED]
 (_|||_)| |(_|   :  http://krakow.linux.org.pl/pgp 0xB25952C0
 |   


pgp0.pgp
Description: PGP signature


BUG: viewing compressed files

2003-06-29 Thread Adam Byrtek / alpha
Something has been broken in recent code in CVS (the following bug
doesn't happen with 4.6.0).

Then bugs happen with:
- gz (only in this case I've tested this bug throughly)
- zip compressed files
- jpeg, png, gif

It does NOT happen with:
- .tgz
- html

Other file types not tested. Current code from CVS, no patches, fresh
configuration files (from 4.6.0 release!).

When I press F3 on files mentioned above I get the RAW output (of
course I'm NOT in the raw mode).

The top status line shows:
version 4.6.0: 8192 bytes   [grow]
version from CVS: 7684662 bytes

In the GZ case only: when I press F8 twice, the output is correct!

I could examine this problem when I find some time, but maybe somebody
(Pavel?) knows which commit could cause such a mess?

Regards
Adam

-- 

  _.|._ |_  _.   :  Adam Byrtek /alpha   [EMAIL PROTECTED]
 (_|||_)| |(_|   :  http://krakow.linux.org.pl/pgp 0xB25952C0
 |   


pgp0.pgp
Description: PGP signature


Re: mcedit (allmost)dead-loop and memory leak

2003-06-27 Thread Adam Byrtek / alpha
On Tue, Jun 24, 2003 at 08:21:09PM -0400, Pavel Roskin wrote:
 Can anybody with good understanding of the editor and the regular
 expressions comment on this?
 
 The code in question is prehistoric, i.e. it appears in the first revision
 on CVS.

And unfortunately it is very dirty. When I tried to trace and fix one
simple error in the search engine it took me two nights to do this...

-- 

  _.|._ |_  _.   :  Adam Byrtek /alpha   [EMAIL PROTECTED]
 (_|||_)| |(_|   :  http://krakow.linux.org.pl/pgp 0xB25952C0
 |   
___
Mc-devel mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/mc-devel


Re: Feature Requests

2003-05-27 Thread Adam Byrtek / alpha
On Tue, May 27, 2003 at 07:45:59PM +0200, Heiko Gerdau wrote:
 1) I would like to use a copy (cut) from the buildin editor to paste into 
 other (x-)programs. This seems not to work, at least on my SuSE 8.2 System 
 using console windows. Since I prefer the keyboard, selecting with the

Hold Shift when selecting text with mouse, then paste it with middle
mouse button to other app.

This is because normally mc handles mouse on its own, but when Shift
is pressed mouse is controlled by X terminal, which is responsible for
copy and paste.

Regards
Adam

-- 

  _.|._ |_  _.   :  Adam Byrtek /alpha   [EMAIL PROTECTED]
 (_|||_)| |(_|   :  http://krakow.linux.org.pl/pgp 0xB25952C0
 |   
___
Mc-devel mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/mc-devel


Re: [PATCH] Editor file locking

2003-04-04 Thread Adam Byrtek / alpha
On Wed, Apr 02, 2003 at 02:48:07PM -0500, Pavel Roskin wrote:
 One bug that needs to be fixed - if I use Enter to modify the file and I
 get a file locked message, the old current line is not repainted.  Try
 it to see what I mean.

Looks like it is because the screen gets refreshed after query_dialog,
and edit-force value set in edit_insert is lost...
Patch attached.

-- 

  _.|._ |_  _.   :  Adam Byrtek /alpha   [EMAIL PROTECTED]
 (_|||_)| |(_|   :  http://krakow.linux.org.pl/pgp 0xB25952C0
 |   
Index: edit.c
===
RCS file: /cvs/gnome/mc/edit/edit.c,v
retrieving revision 1.75
diff -u -r1.75 edit.c
--- edit.c  2 Apr 2003 22:25:00 -   1.75
+++ edit.c  4 Apr 2003 13:23:21 -
@@ -838,6 +838,10 @@
if (c == '\n')
edit-start_line++;
 }
+
+/* tell that we've modified the file */
+edit_modification (edit);
+
 /* now we must update some info on the file and check if a redraw is required */
 if (c == '\n') {
if (edit-book_mark)
@@ -846,8 +850,6 @@
edit-total_lines++;
edit-force |= REDRAW_LINE_ABOVE | REDRAW_AFTER_CURSOR;
 }
-/* tell that we've modified the file */
-edit_modification (edit);
 
 /* save the reverse command onto the undo stack */
 edit_push_action (edit, BACKSPACE);
@@ -885,13 +887,13 @@
if (c == '\n')
edit-start_line++;
 }
+edit_modification (edit);
 if (c == '\n') {
if (edit-book_mark)
book_mark_inc (edit, edit-curs_line);
edit-total_lines++;
edit-force |= REDRAW_AFTER_CURSOR;
 }
-edit_modification (edit);
 edit_push_action (edit, DELCHAR);
 
 edit-mark1 += (edit-mark1 = edit-curs1);
@@ -926,6 +928,7 @@
 edit-last_byte--;
 edit-curs2--;
 
+edit_modification (edit);
 if (p == '\n') {
if (edit-book_mark)
book_mark_dec (edit, edit-curs_line);
@@ -938,7 +941,6 @@
if (p == '\n')
edit-start_line--;
 }
-edit_modification (edit);
 
 return p;
 }
@@ -963,6 +965,7 @@
 edit-last_byte--;
 edit-curs1--;
 
+edit_modification (edit);
 if (p == '\n') {
if (edit-book_mark)
book_mark_dec (edit, edit-curs_line);
@@ -977,7 +980,6 @@
if (p == '\n')
edit-start_line--;
 }
-edit_modification (edit);
 
 return p;
 }
Index: editlock.c
===
RCS file: /cvs/gnome/mc/edit/editlock.c,v
retrieving revision 1.2
diff -u -r1.2 editlock.c
--- editlock.c  2 Apr 2003 22:25:00 -   1.2
+++ editlock.c  4 Apr 2003 13:23:22 -
@@ -97,7 +97,8 @@
 
 
 /* Tries to raise file lock
-   Returns 1 on success,  0 on failure, -1 if abort */
+   Returns 1 on success,  0 on failure, -1 if abort 
+   Warning: Might do screen refresh and lose edit-force */
 int
 edit_lock_file (char *fname)
 {


Re: annoyance: undo does not reset modified status

2003-04-04 Thread Adam Byrtek / alpha
On Fri, Apr 04, 2003 at 05:21:35PM +0200, Oswald Buddenhagen wrote:
 you mean, undo means undo last editing action plus all following
 movements? NO WAY! i absolutely HATE this behaviour in vim. while
 merging moves is negotiable, pretending that they don't exist is

And mcedit behaviour is plain stupid for me. I wan't undo to unDO, not
unMOVE. If I change something, browse the file (eg. 100 movement
commands) and decide to undo my last change it will be very difficult
for me to undo the real modification. And if I want to move back - I
can just use arrow keys.

Fortunately I don't use mcedit, but JED, which has undo implemented in
a way I like.

Regards
Adam


-- 

  _.|._ |_  _.   :  Adam Byrtek /alpha   [EMAIL PROTECTED]
 (_|||_)| |(_|   :  http://krakow.linux.org.pl/pgp 0xB25952C0
 |   
___
Mc-devel mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/mc-devel


[PATCH] Editor file locking

2003-04-02 Thread Adam Byrtek / alpha
As discussed earlier, patch to implement file locking in editor. Try
and tell me about any problems. Locking scheme described in
edit/editlock.c

TODO: 'Abort' option would be very useful, but it requires some more
hacking in the undo stack. I'll do this when this patch will be
considered stable.

(Patch also sent to BTS)

Regards
Adam

-- 

  _.|._ |_  _.   :  Adam Byrtek /alpha   [EMAIL PROTECTED]
 (_|||_)| |(_|   :  http://krakow.linux.org.pl/pgp 0xB25952C0
 |   
Index: edit/Makefile.am
===
RCS file: /cvs/gnome/mc/edit/Makefile.am,v
retrieving revision 1.5
diff -u -r1.5 Makefile.am
--- edit/Makefile.am23 Dec 2002 10:13:35 -  1.5
+++ edit/Makefile.am2 Apr 2003 11:17:41 -
@@ -9,6 +9,6 @@
 libedit_a_SOURCES = \
bookmark.c edit.c editcmd.c editwidget.c editdraw.c editkeys.c \
editmenu.c editoptions.c editcmddef.h edit.h edit-widget.h \
-   syntax.c wordproc.c
+   syntax.c wordproc.c editlock.c editlock.h
 
 EXTRA_DIST = ChangeLog
Index: edit/edit-widget.h
===
RCS file: /cvs/gnome/mc/edit/edit-widget.h,v
retrieving revision 1.15
diff -u -r1.15 edit-widget.h
--- edit/edit-widget.h  12 Mar 2003 07:07:28 -  1.15
+++ edit/edit-widget.h  2 Apr 2003 11:17:41 -
@@ -56,6 +56,7 @@
 unsigned char overwrite;
 unsigned char modified;/* has the file been changed?: 1 if char inserted or
   deleted at all since last load or save */
+unsigned char locked;  /* 1 if lock is held on current file */
 unsigned char screen_modified; /* has the file been changed since the last 
screen draw? */
 int delete_file;   /* Has the file been created by the editor?  Delete
   it at end of editing when it hasn't been modified 
Index: edit/edit.c
===
RCS file: /cvs/gnome/mc/edit/edit.c,v
retrieving revision 1.73
diff -u -r1.73 edit.c
--- edit/edit.c 23 Dec 2002 10:13:35 -  1.73
+++ edit/edit.c 2 Apr 2003 11:17:41 -
@@ -22,6 +22,7 @@
 
 #include config.h
 #include edit.h
+#include editlock.h
 #include edit-widget.h
 #include editcmddef.h
 
@@ -554,6 +555,7 @@
return 0;
 }
 edit-modified = 0;
+edit-locked = 0;
 edit_load_syntax (edit, 0, 0);
 {
int color;
@@ -811,8 +813,12 @@
 static inline void edit_modification (WEdit * edit)
 {
 edit-caches_valid = 0;
-edit-modified = 1;
 edit-screen_modified = 1;
+
+/* raise lock when file modified */
+if (!edit-modified  !edit-delete_file)
+   edit-locked = edit_lock_file (edit-filename);
+edit-modified = 1;
 }
 
 /*
Index: edit/editcmd.c
===
RCS file: /cvs/gnome/mc/edit/editcmd.c,v
retrieving revision 1.75
diff -u -r1.75 editcmd.c
--- edit/editcmd.c  19 Dec 2002 13:01:34 -  1.75
+++ edit/editcmd.c  2 Apr 2003 11:17:43 -
@@ -27,6 +27,7 @@
 #include ctype.h
 
 #include edit.h
+#include editlock.h
 #include editcmddef.h
 #include edit-widget.h
 
@@ -184,9 +185,6 @@
 doupdate();
 }
 
-/* Oleg Yu. Repin [EMAIL PROTECTED] added backup filenames
-...thanks -paul */
-
 /*  If 0 (quick save) then  a) create/truncate filename file,
b) save to filename;
 if 1 (safe save) then   a) save to tempnam,
@@ -438,6 +436,7 @@
 {
 /* This heads the 'Save As' dialog box */
 char *exp = 0;
+int save_lock = 0;
 int different_filename = 0;
 
 exp = edit_get_save_file (edit-filename, _( Save As ));
@@ -465,8 +464,25 @@
return 0;
}
}
+   save_lock = edit_lock_file (exp);
+   } else {
+   /* filenames equal, check if already locked */
+   if (!edit-locked  !edit-delete_file)
+   save_lock = edit_lock_file (exp);
}
+   
if (edit_save_file (edit, exp)) {
+   /* Succesful, so unlock both files */
+   if (strcmp (edit-filename, exp)) {
+   if (save_lock)
+   edit_unlock_file (exp);
+   if (edit-locked)
+   edit-locked = edit_unlock_file (edit-filename);
+   } else {
+   if (edit-locked || save_lock)
+   edit-locked = edit_unlock_file (edit-filename);
+   }
+   
edit_set_filename (edit, exp);
g_free (exp);
edit-modified = 0;
@@ -476,6 +492,11 @@
edit-force |= REDRAW_COMPLETELY;
return 1;
} else {
+   /* Failed, so maintain modify (not save) lock */
+   if (strcmp (edit-filename, exp)  save_lock

Re: [PATCH] Editor file locking

2003-04-02 Thread Adam Byrtek / alpha
On Wed, Apr 02, 2003 at 11:37:07AM -0500, Pavel Roskin wrote:
 The patch looks good, but Steal and Continue looks a bit confusing for
 a new user.  Maybe Break lock and Ignore lock would be better?

Yes, they sound better. 'Steal' and 'continue' was based on JED.

 Emacs 21.2.1 understands the locks created by mc, but mc doesn't under
 understand locks created by emacs, which have the timestamp after : at

Didn't test it with Emacs, just with JED. I thought that the format is
the same - my mistake. Fixed.

 the end.  I think the lock should be honored regardless of whether its
 text can be fully parsed.

It is... but this issue was different. Mc treated the whole timestamp
as a pid... and thought that the process with this pid has died.

 Locks can be left by mc in the following scenario.  First mc opens and
 starts editing.  Second mc starts editing, the user chooses Continue.
 Second mc exits without saving.  First mc exits without saving.  The lock
 remains.

Fixed patch attached.

Regards
Adam

-- 

  _.|._ |_  _.   :  Adam Byrtek /alpha   [EMAIL PROTECTED]
 (_|||_)| |(_|   :  http://krakow.linux.org.pl/pgp 0xB25952C0
 |   
Index: edit/ChangeLog
===
RCS file: /cvs/gnome/mc/edit/ChangeLog,v
retrieving revision 1.157
diff -u -r1.157 ChangeLog
--- edit/ChangeLog  12 Mar 2003 07:07:27 -  1.157
+++ edit/ChangeLog  2 Apr 2003 17:35:23 -
@@ -1,0 +1,14 @@
+2003-04-01  Adam Byrtek  [EMAIL PROTECTED]
+
+   * 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.
+   
Index: edit/Makefile.am
===
RCS file: /cvs/gnome/mc/edit/Makefile.am,v
retrieving revision 1.5
diff -u -r1.5 Makefile.am
--- edit/Makefile.am23 Dec 2002 10:13:35 -  1.5
+++ edit/Makefile.am2 Apr 2003 17:35:23 -
@@ -9,6 +9,6 @@
 libedit_a_SOURCES = \
bookmark.c edit.c editcmd.c editwidget.c editdraw.c editkeys.c \
editmenu.c editoptions.c editcmddef.h edit.h edit-widget.h \
-   syntax.c wordproc.c
+   syntax.c wordproc.c editlock.c editlock.h
 
 EXTRA_DIST = ChangeLog
Index: edit/edit-widget.h
===
RCS file: /cvs/gnome/mc/edit/edit-widget.h,v
retrieving revision 1.15
diff -u -r1.15 edit-widget.h
--- edit/edit-widget.h  12 Mar 2003 07:07:28 -  1.15
+++ edit/edit-widget.h  2 Apr 2003 17:35:23 -
@@ -56,6 +56,7 @@
 unsigned char overwrite;
 unsigned char modified;/* has the file been changed?: 1 if char inserted or
   deleted at all since last load or save */
+unsigned char locked;  /* 1 if lock is held on current file */
 unsigned char screen_modified; /* has the file been changed since the last 
screen draw? */
 int delete_file;   /* Has the file been created by the editor?  Delete
   it at end of editing when it hasn't been modified 
Index: edit/edit.c
===
RCS file: /cvs/gnome/mc/edit/edit.c,v
retrieving revision 1.73
diff -u -r1.73 edit.c
--- edit/edit.c 23 Dec 2002 10:13:35 -  1.73
+++ edit/edit.c 2 Apr 2003 17:35:24 -
@@ -22,6 +22,7 @@
 
 #include config.h
 #include edit.h
+#include editlock.h
 #include edit-widget.h
 #include editcmddef.h
 
@@ -554,6 +555,7 @@
return 0;
 }
 edit-modified = 0;
+edit-locked = 0;
 edit_load_syntax (edit, 0, 0);
 {
int color;
@@ -811,8 +813,12 @@
 static inline void edit_modification (WEdit * edit)
 {
 edit-caches_valid = 0;
-edit-modified = 1;
 edit-screen_modified = 1;
+
+/* raise lock when file modified */
+if (!edit-modified  !edit-delete_file)
+   edit-locked = edit_lock_file (edit-filename);
+edit-modified = 1;
 }
 
 /*
Index: edit/editcmd.c
===
RCS file: /cvs/gnome/mc/edit/editcmd.c,v
retrieving revision 1.75
diff -u -r1.75 editcmd.c
--- edit/editcmd.c  19 Dec 2002 13:01:34 -  1.75
+++ edit/editcmd.c  2 Apr 2003 17:35:25 -
@@ -27,6 +27,7 @@
 #include ctype.h
 
 #include edit.h
+#include editlock.h
 #include editcmddef.h
 #include edit-widget.h
 
@@ -184,9 +185,6 @@
 doupdate();
 }
 
-/* Oleg Yu. Repin [EMAIL PROTECTED] added backup filenames
-...thanks -paul */
-
 /*  If 0 (quick save

Re: mcedit file locking

2003-03-24 Thread Adam Byrtek / alpha
On Mon, Mar 24, 2003 at 06:02:16PM -0500, Pavel Roskin wrote:

 What do you think is the best way to implement file locking in mc
 editor? I want to work on this issue, but first I want to consult you,
 because you know many of the portability secrets :)
 Why do you think we need file locking in the editor?  It's not an often
 requested feature.  What kind of scenarios do you want to prevent?  Do we
 need write locks or read locks?

I just wanted to start work on the following TODO item:

Lock files in the editor to prevent opening them more than once.
Warn user when opening locked file.

Did I misunderstand something?

Regards
Adam

-- 

  _.|._ |_  _.   :  Adam Byrtek /alpha/
 (_|||_)| |(_|   :  email  alpha@(irc.pl|debian.org)
 |   :  jabber alpha.pl(at)jabber.org, pgp 0xB25952C0
___
Mc-devel mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/mc-devel


Re: Config file handling

2003-03-21 Thread Adam Byrtek / alpha
On Fri, Mar 21, 2003 at 02:15:52AM -0500, Pavel Roskin wrote:
 Not sure if it's the right fix.  Sometimes there is more that one way to
 write home directory.  For example. /home is a link to /usr/home by
 default on some versions of FreeBSD.

I don't see the problem. There are only 2 possibilities.
The profile in mc code is always descibed as

concat_dir_and_file (home_dir, PROFILE_NAME)

or

concat_dir_and_file (mc_home, mc.ini)

it the first one doesn't exist.
We have to block saving the latter, so we can filter it out, or accept
only the first one, which is more safe (my patch implements it this
way).

I can't see in which place (sym)links are a problem...

 More importantly, mc shouldn't even attempt to save anything to mc.ini.
 dump_profile() shouldn't be called for global files.  I think the fix
 should be in some other place.

Maybe. But AFAIK mc code doesn't know how to distinct global files
from personal ones besides path checking.

Regards
Adam

-- 

  _.|._ |_  _.   :  Adam Byrtek /alpha/
 (_|||_)| |(_|   :  email  alpha@(irc.pl|debian.org)
 |   :  jabber alpha.pl(at)jabber.org, pgp 0xB25952C0
___
Mc-devel mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/mc-devel


Re: [PATCH]: Locale's abbreviated month vfs

2003-03-19 Thread Adam Byrtek / alpha
On Wed, Mar 19, 2003 at 05:48:51PM +0200, Andrew V. Samoilov wrote:
 Patch commited.  I will have moved in 2 weeks, so I want to
 see this patch commited.  I am not sure I will be able to continue 

Please, could you examine
https://savannah.gnu.org/patch/?func=detailpatchpatch_id=1254group_id=3521

The problem is connected with the viewer, and my patch fixes the
critical bug (core dump or infinite loop).

Regards
alpha

-- 

  _.|._ |_  _.   :  Adam Byrtek /alpha/
 (_|||_)| |(_|   :  email  alpha@(irc.pl|debian.org)
 |   :  jabber alpha.pl(at)jabber.org, pgp 0xB25952C0
___
Mc-devel mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/mc-devel


Re: [PATCH]: Locale's abbreviated month vfs

2003-03-19 Thread Adam Byrtek / alpha
On Wed, Mar 19, 2003 at 11:25:46AM -0500, Pavel Roskin wrote:
 If I apply your patch to the CVS version (this requires some manual
 intervention), 

That's because of Andrew's patch which was later.

 following bug appears.  If the viewer is positioned at the
 beginning of file, regex search cannot find anything, even strings
 without characters with special meaning.  In particular, try opening
 ChangeLog and look for 200 using F6.

0) I really love those disappearing revisions in anon cvs...

1) Silly little typo:

-for (i = 0; (ch != -1)  (pos  0); ch = get_byte (view, pos)) {
+for (i = 0; (ch != -1)  (pos = 0); ch = get_byte (view, pos)) {

But looks like Andrew has taken this issue into account in his patch
(the 'break' inside the 'for'), so it no longer applies. But the
proper '^' and '$' and 'prev' handling in reverse regexp search still
applies, see my patch.

2) Andrew's patch has broken regexp reverse search... see the usage of
strreverse() - Andrew, please could you fix this and examine/apply
(parts) of my patch? If something is unclear - tell me.

3) Try to create file:
--cut--
000
aaa
--cut--
WITHOUT final newline. Now try to search 'aaa' - not found. 
Fixed in my patch (attached).

Regards
Adam

-- 

  _.|._ |_  _.   :  Adam Byrtek /alpha/
 (_|||_)| |(_|   :  email  alpha@(irc.pl|debian.org)
 |   :  jabber alpha.pl(at)jabber.org, pgp 0xB25952C0
Index: view.c
===
RCS file: /cvs/gnome/mc/src/view.c,v
retrieving revision 1.117
diff -u -r1.117 view.c
--- view.c  19 Mar 2003 13:39:48 -  1.117
+++ view.c  19 Mar 2003 19:13:16 -
@@ -1521,46 +1521,40 @@
 get_line_at (WView *view, unsigned long *p, unsigned long *skipped)
 {
 char *buffer = 0;
-int buffer_size = 0;
-int usable_size = 0;
-int ch;
-int direction = view-direction;
+int buffer_size = 0, usable_size = 0;
+int ch, i = 0, prev = 0;
 unsigned long pos = *p;
-long i = 0;
-int prev = 0;
-
-if (!pos  direction == -1)
-   return 0;
 
 /* skip over all the possible zeros in the file */
 while ((ch = get_byte (view, pos)) == 0) {
-   if (!pos  direction == -1)
+   if (pos == 0  view-direction == -1)
return 0;
-   pos += direction;
+   pos += view-direction;
i++;
 }
 *skipped = i;
 
-if (pos) {
-   prev = get_byte (view, pos - 1);
+if (pos  0 || view-direction == -1) {
+   prev = get_byte (view, pos - view-direction);
if ((prev == -1) || (prev == '\n'))
prev = 0;
+} else {
+   prev=0;
 }
 
-for (i = 0; ch != -1; ch = get_byte (view, pos)) {
+for (i = 1; ch != -1; ch = get_byte (view, pos)) {
 
-   if (i == usable_size) {
+   if (i = usable_size) {
buffer = grow_string_buffer (buffer, buffer_size);
usable_size = buffer_size - 2;
}
 
-   i++;
-   buffer[i] = ch;
+   buffer[i++] = ch;
 
-   if (!pos  direction == -1)
+   if (pos == 0  view-direction == -1)
break;
 
-   pos += direction;
+   pos += view-direction;
 
if (ch == '\n' || !ch)
break;
@@ -1666,15 +1660,13 @@
 
/* We found the string */
 
-   if (*s  !view-search_start  (search == regexp_view_search)
-(*text == '^')) {
-
-   /* We do not want to match a
-* ^ regexp when not at the real
-* beginning of some line
-*/
-   continue;
-   }
+   /* Handle ^ and $ in reexp searches when starting at
+* the middle of the line */
+   if (s[0]  (search == regexp_view_search))
+   if (((text[0] == '^')  (view-direction  0)) ||
+   ((text[strlen(text)-1] == '$')  (view-direction  0)))
+   continue;
+   
/* Record the position used to continue the search */
if (view-direction == 1)
t += forward_line_start;


Re: [PATCH]: Locale's abbreviated month vfs

2003-03-19 Thread Adam Byrtek / alpha
On Wed, Mar 19, 2003 at 02:47:30PM -0500, Pavel Roskin wrote:
 There is no support for regexp reverse search, so it's quite hard to
 break it :-)

Sure, and I've spend whole night to fix something which non-existing.

$grep -C5 Reverse doc/mc.1
.PP
.B F6, /.
Regular expression search.
.PP
.B ?,
Reverse regular expression search.
^^
.PP
.B F7
Normal search / hex mode search.
.PP
.B C-s, F17, n.

No wonder it is broken...

 Still not good.  Try searching backwards for a non-existent word.  mc
 hangs with 100% CPU utilization.

I know it is broken. This is not the final patch - it is a patch for
Andrew to merge with his modifications which I didn't know about.

Regards

-- 

  _.|._ |_  _.   :  Adam Byrtek /alpha/
 (_|||_)| |(_|   :  email  alpha@(irc.pl|debian.org)
 |   :  jabber alpha.pl(at)jabber.org, pgp 0xB25952C0
___
Mc-devel mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/mc-devel


Re: ShiftF6 rename files on 4.6.x versions

2003-03-19 Thread Adam Byrtek / alpha
On Wed, Mar 19, 2003 at 05:22:57PM -0500, Pavel Roskin wrote:
 Any objections if we change the behavior of Shift-F5 and Shift-F6?

I think it is no problem, not many people know about Shift-F[56] and
not many use this feature unknowingly. Moreover now it causes error on
multiple tagged files, so nobody uses it this way...

Regards
Adam

-- 

  _.|._ |_  _.   :  Adam Byrtek /alpha/
 (_|||_)| |(_|   :  email  alpha@(irc.pl|debian.org)
 |   :  jabber alpha.pl(at)jabber.org, pgp 0xB25952C0
___
Mc-devel mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/mc-devel


Re: Account in FTP

2003-03-12 Thread Adam Byrtek / alpha
On Wed, Mar 12, 2003 at 09:14:54AM +0100, Lorinczy Zsigmond wrote:
 My BS2000 mainframe wants account when connecting via FTP,
 (332 Account required.) but mc do not prompts the user for it.

Try
cd /#ftp:[EMAIL PROTECTED]

Regards

-- 

  _.|._ |_  _.   :  Adam Byrtek /alpha/
 (_|||_)| |(_|   :  email  alpha@(irc.pl|debian.org)
 |   :  jabber alpha.pl(at)jabber.org, pgp 0xB25952C0
___
Mc-devel mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/mc-devel


Re: Retain orig. filename as suffix for tmp. filename

2003-03-10 Thread Adam Byrtek / alpha
On Mon, Mar 10, 2003 at 07:43:02PM -0500, Pavel Roskin wrote:
 Actually, your patch has created a security hole, but not where I
 expected.  extfs_cmd() doesn't quote the local filename.  It was OK
 before.  But since the local name is now based on the entry name, it must
 be quoted.

Please note that is not the case with plain VFS. Unfortunately I've
just tested it with VFSes. A lesson for me I should not make any
assumptions... and that mc design is still a bit mysterious for me.

Regards
Adam

-- 

  _.|._ |_  _.   :  Adam Byrtek /alpha/
 (_|||_)| |(_|   :  email  alpha@(irc.pl|debian.org)
 |   :  jabber alpha.pl(at)jabber.org, pgp 0xB25952C0
___
Mc-devel mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/mc-devel


[OT] Re: rename improvement

2003-03-07 Thread Adam Byrtek / alpha
---cut---
Developer of MPlayer, the Movie Player for Linux -
http://www.MPlayerHQ.hu
However, many people beg for its inclusion in Debian. Why? - Gabucino
  Because having new software in Debian is good. - Josselin Mouette
  Because having good software in Debian is new. - Gabucino 
---cut---
MPlayer Core Team
 - Debian? - This is our project and we can do whatever we want with it.
 Michael Stone mstone#debian.org
---cut---

You MPlayer people are SO ridiculous. Yes, I use MPlayer and I think
its a great piece of software, but your overall attitude is quite
amusing... Wage your silly war if you really need it.

Sorry for OT.

Regards

-- 

  _.|._ |_  _.   :  Adam Byrtek /alpha/
 (_|||_)| |(_|   :  email  alpha@(irc.pl|debian.org)
 |   :  jabber alpha.pl(at)jabber.org, pgp 0xB25952C0


pgp0.pgp
Description: PGP signature


Re: [OT] Re: rename improvement

2003-03-07 Thread Adam Byrtek / alpha
On Fri, Mar 07, 2003 at 12:35:45PM +0100, Ali Akcaagac wrote:
 But I have high respect and I'm thankful to Gabucino and all the one
 who contributed for MPlayer.

Yes, I'm also thankful to all MPlayer developers - you have made a lot
of good work. I'm also thankful to all those people who created and
develop Debian. Thats why I fell obligated to act when someone is
trying to discredit Debian on a public forum, as I would act if
somebody was trying to dicredit MPlayer or MC.

If you want to speak with me about this subject, please mail me
privately.

 I still like to see that feature in Midnight Commander and this is a
 serious request.

So go and patch it. It should be very simple to patch.

Regards
Adam

-- 

  _.|._ |_  _.   :  Adam Byrtek /alpha/
 (_|||_)| |(_|   :  email  alpha@(irc.pl|debian.org)
 |   :  jabber alpha.pl(at)jabber.org, pgp 0xB25952C0
___
Mc-devel mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/mc-devel


Re: Xterm title format string

2003-03-02 Thread Adam Byrtek / alpha
On Sun, Mar 02, 2003 at 03:42:39PM +0100, Adam Byrtek / alpha wrote:
 I just like to ask you, what other format variables might be useful
 for users (pid, edited/viewed file name...)? I will appreciate any
 suggestions.

Nevermind. I decided to support standard bash PS1 substitutions (but
begginning with '%', not '\', because it is more mc-ish) to make
configuration easier for those familiar with bash PS1.

If you want to test it, try the patch. This command gives you
everything you could have in the title:

MC_XTITLE=%%%$ [EMAIL PROTECTED](%H) %w(%W) %p mc %V [%t] mc

Documentation:
%% - percent '%' character
%$ - '#' for root, '$' for normal user
%w - working directory
%W - working directory (last component only)
%p - process id (pid)
%u - username
%h - hostname
%H - hostname.domainname
%t - tty connected to stdin
%V - mc version

The default is %w - mc

Regards

-- 

  _.|._ |_  _.   :  Adam Byrtek /alpha/
 (_|||_)| |(_|   :  email  alpha@(irc.pl|debian.org)
 |   :  jabber alpha.pl(at)jabber.org, pgp 0xB25952C0
Index: main.c
===
RCS file: /cvs/gnome/mc/src/main.c,v
retrieving revision 1.281
diff -u -r1.281 main.c
--- main.c  27 Feb 2003 05:09:35 -  1.281
+++ main.c  2 Mar 2003 19:07:53 -
@@ -1839,17 +1839,95 @@
 void
 update_xterm_title_path (void)
 {
+int i = 0;
 unsigned char *p, *s;
+unsigned char title [BUF_MEDIUM+1];
 
 if (xterm_flag  xterm_title) {
-   p = s = g_strdup (strip_home_and_password (cpanel-cwd));
+   /* Use special environment variable to format title */
+   if ((p = getenv (MC_XTITLE)) == NULL) {
+   p = %w - mc;
+   }
+   
do {
+   if (*p != '%') {
+   title [i++] = *p;
+   continue;
+   }
+   if (!*++p)
+   break;
+   
+   /* Substitute '%' special characters
+* (meaning the same as for bash, but preceded by '%', not '\')
+*/
+   s = NULL;
+   switch (*p) {
+   case '%' : /* %% - percent '%' character */
+   title [i++] = '%';
+   break;
+   case '$' : /* %$ - '#' for root, '$' for normal user */
+   title [i++] = (geteuid()==0 ? '#' : '$');
+   break;
+   case 'w' : /* %w - working directory */
+   s = g_strdup (strip_home_and_password (cpanel-cwd)); 
+   break;
+   case 'W' : /* %W - working directory (last component only) */
+   s = g_strdup (x_basename (strip_home_and_password (cpanel-cwd)));
+   break;
+   case 'p' : /* %p - process id (pid) */
+   s = g_strdup_printf (%d, getpid ()); 
+   break;
+   case 'u' : /* %u - username */
+   s = g_strdup (getpwuid (getuid ()) - pw_name); 
+   break;
+   case 'h' : /* %h - hostname */
+   if (gethostname (title+i, BUF_MEDIUM-i) == 0) {
+   title [BUF_MEDIUM] = '\0';
+   i = strlen (title);
+   }
+   break;
+   case 'H' : /* %H - hostname.domainname */
+   if (gethostname (title+i, BUF_MEDIUM-i) == 0) {
+   title [BUF_MEDIUM] = '\0';
+   i = strlen (title);
+   }
+   if (i  BUF_MEDIUM-1) {
+   title[i++]='.';
+   if (getdomainname (title+i, BUF_MEDIUM-i) == 0) {
+   title [BUF_MEDIUM] = '\0';
+   i = strlen (title);
+   }
+   }
+   break;
+   case 't' : /* %t - tty connected to stdin */
+   s = g_strdup (ttyname (0));
+   break;
+   case 'V' : /* %V - mc version */
+   s = g_strdup (VERSION);
+   break;
+   }
+
+   /* Append substituted string */
+   if (s) {
+   strncpy (title+i, s, BUF_MEDIUM-i);
+   title [BUF_MEDIUM] = '\0';
+   i = strlen (title);
+   g_free (s);
+   }
+   } while (*++p  iBUF_MEDIUM);
+title [i] = '\0';
+   
+   /* Replace non-printable characters with '?' */
+   s = title;
+   while (*s) {
if (!is_printable (*s))
*s = '?';
-   } while (*++s);
-   fprintf (stdout, \33]0;mc - %s\7, p);
+   s++;
+   } 
+   
+   /* Use xterm escape sequence to set window title */
+   fprintf (stdout, \33]0;%s\7, title);
fflush (stdout);
-   g_free (p);
 }
 }
 
Index: ChangeLog
===
RCS file: /cvs/gnome/mc/src/ChangeLog,v
retrieving revision 1.1133
diff -u -u -0 -r1.1133 ChangeLog
--- ChangeLog   27 Feb 2003 04:57:58 -  1.1133
+++ ChangeLog   2 Mar 2003 19:08:07 -
@@ -0,0 +1,5 @@
+2003-03-02  Adam Byrtek

Re: patchfs update

2003-02-26 Thread Adam Byrtek / alpha
On Wed, Feb 26, 2003 at 05:12:59PM +0200, Andrew V. Samoilov wrote:
 +2003-02-24  Adam Byrtek  [EMAIL PROTECTED]
 +
 +* extfs/patchfs.in: rm and proper copyin support, more
 +functions to make code more clear
 +
 
 Good job! Applied, thanks.

I've sent this patch to Andrew privately for review, it is the feature
Arpi asked for. As is has been accepted I'm sending the patch to the
list - could you please test it?

Regards

-- 

  _.|._ |_  _.   :  Adam Byrtek /alpha/
 (_|||_)| |(_|   :  email  alpha@(irc.pl|debian.org)
 |   :  jabber alpha.pl(at)jabber.org, pgp 0xB25952C0
___
Mc-devel mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/mc-devel


Re: patchfs update

2003-02-26 Thread Adam Byrtek / alpha
On Wed, Feb 26, 2003 at 04:21:21PM +0100, Adam Byrtek / alpha wrote:
 I've sent this patch to Andrew privately for review, it is the feature
 Arpi asked for. As is has been accepted I'm sending the patch to the
 list - could you please test it?

Forgotten to attach the patch...

-- 

  _.|._ |_  _.   :  Adam Byrtek /alpha/
 (_|||_)| |(_|   :  email  alpha@(irc.pl|debian.org)
 |   :  jabber alpha.pl(at)jabber.org, pgp 0xB25952C0
Index: patchfs.in
===
RCS file: /cvs/gnome/mc/vfs/extfs/patchfs.in,v
retrieving revision 1.12
diff -u -r1.12 patchfs.in
--- extfs/patchfs.in13 Jan 2003 12:07:46 -  1.12
+++ extfs/patchfs.in23 Feb 2003 22:57:26 -
@@ -7,11 +7,12 @@
 use bytes;
 use strict;
 use POSIX;
+use File::Temp tempfile;
 
 # standard binaries
-my $bzip = 'bzip2';
-my $gzip = 'gzip';
-my $file = 'file';
+my $bzip = bzip2;
+my $gzip = gzip;
+my $file = file;
 
 # date parsing requires Date::Parse from TimeDate module
 my $parsedates = eval require Date::Parse;
@@ -55,6 +56,96 @@
 exit 1;
 }
 
+# (compressed) input
+sub myin
+{
+my ($qfname)=(quotemeta $_[0]);
+
+$_=`$file $qfname`;
+if (/bzip/) {
+   return $bzip -dc $qfname;
+} elsif (/gzip/) {
+   return $gzip -dc $qfname;
+} else {
+   return cat $qfname;
+}
+}
+
+# (compressed) output
+sub myout
+{
+my ($qfname,$append)=(quotemeta $_[0],$_[1]);
+my ($sep);
+
+if ($append) {
+  $sep=;
+} else {
+  $sep=;
+}
+
+$_=`$file $qfname`;
+if (/bzip/) {
+   return $bzip -c $sep $qfname;
+} elsif (/gzip/) {
+   return $gzip -c $sep $qfname;
+} else {
+   return cat $sep $qfname;
+}
+}
+
+# select diff filename conforming with rules found in diff.info
+sub diff_filename
+{
+my ($fsrc,$fdst)[EMAIL PROTECTED];
+
+if (!$fdst  !$fsrc) {
+   error 'Index: not yet implemented';
+} elsif (!$fsrc || $fsrc eq '/dev/null') {
+   return ($fdst,PATCH-CREATE/);
+} elsif (!$fdst || $fdst eq '/dev/null') {
+   return ($fsrc,PATCH-REMOVE/);
+} elsif (($fdst eq /dev/null)  ($fsrc eq /dev/null)) {
+   error Malformed diff;
+} else {
+   # fewest path name components
+   if ($fdst=~s|/|/|g  $fsrc=~s|/|/|g) {
+   return ($fdst,);
+   } elsif ($fdst=~s|/|/|g  $fsrc=~s|/|/|g) {
+   return ($fsrc,);
+   } else {
+   # shorter base name
+   if (($fdst=~/$basename/,length $2)  ($fsrc=~/$basename/,length $2)) {
+   return ($fdst,);
+   } elsif (($fdst=~/$basename/,length $2)  ($fsrc=~/$basename/,length $2)) {
+   return ($fsrc,);
+   } else {
+   # shortest names
+   if (length $fdst  length $fsrc) {
+   return ($fdst,);
+   } else {
+   return ($fsrc,);
+   }
+   }
+   }
+}
+}
+
+# parse unified or context header
+sub parse_header
+{
+my ($unified,$context,$buf)[EMAIL PROTECTED];
+
+if ($unified) {
+   error Can't parse unified diff header
+ unless ((($$buf.=I).=I)=~/$unified_header/);
+   return $$buf=~/$unified_extract/;
+} elsif ($context) {
+   error Can't parse context diff header
+ unless ((($$buf.=I).=I)=~/$context_header/);
+   return $$buf=~/$context_extract/;
+}
+}
+
 # list files affected by patch
 sub list
 {
@@ -69,7 +160,7 @@
 import Date::Parse if ($parsedates);
 
 # state==1 means diff contents, state==0 means comments
-$state=0; $len=0; $f='';
+$state=0; $len=0; $f=;
 while (I) {
 
# recognize diff type
@@ -91,49 +182,8 @@
}
$state=1;
 
-   # parse diff header
-   if ($unified) {
-   error Can't parse unified diff header
- unless ((($_.=I).=I)=~/$unified_header/);
-   ($fsrc,$fdst,$time)=/$unified_extract/;
-   } elsif ($context) {
-   error Can't parse context diff header
- unless ((($_.=I).=I)=~/$context_header/);
-   ($fsrc,$fdst,$time)=/$context_extract/;
-   }
-
-   # select filename, conform with (diff.info)Multiple patches
-   $prefix=;
-   if (!$fdst  !$fsrc) {
-   error 'Index: not yet implemented';
-   } elsif (!$fsrc || $fsrc eq '/dev/null') {
-   $f=$fdst; $prefix=PATCH-CREATE/;
-   } elsif (!$fdst || $fdst eq '/dev/null') {
-   $f=$fsrc; $prefix=PATCH-REMOVE/;
-   } elsif (($fdst eq /dev/null)  ($fsrc eq /dev/null)) {
-   error Malformed diff;
-   } else {
-   # fewest path name components
-   if ($fdst=~s|/|/|g  $fsrc=~s|/|/|g) {
-   $f=$fdst;
-   } elsif ($fdst=~s|/|/|g  $fsrc=~s|/|/|g) {
-   $f=$fsrc;
-   } else

Re: Retain orig. filename as suffix for tmp. filename

2003-02-24 Thread Adam Byrtek / alpha
On Mon, Feb 24, 2003 at 02:22:16AM -0500, Pavel Roskin wrote:
 If you preserve the whole filename, you are more likely to have spaces for
 some other special characters in the filename.  Some programs have
 problems with spaces in the filename (e.g. rpm 4.1).
 
 Even worse, some programs could be exploited by giving them bogus
 filenames as arguments.  I like your idea, but the security issue should
 be addressed (actually, it exists already because the extension can have
 bad stuff too).

Is filtering it with is_printable() and substituting spaces with '_'
enough?

Regards

-- 

  _.|._ |_  _.   :  Adam Byrtek /alpha/
 (_|||_)| |(_|   :  email  alpha@(irc.pl|debian.org)
 |   :  jabber alpha.pl(at)jabber.org, pgp 0xB25952C0
___
Mc-devel mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/mc-devel


Re: Retain orig. filename as suffix for tmp. filename

2003-02-24 Thread Adam Byrtek / alpha
On Mon, Feb 24, 2003 at 03:35:32PM +0100, Oswald Buddenhagen wrote:
 then add an assert(basename); and increment right away. 

Sounds wise, thats what 'assert' is for... Thanks.

-- 

  _.|._ |_  _.   :  Adam Byrtek /alpha/
 (_|||_)| |(_|   :  email  alpha@(irc.pl|debian.org)
 |   :  jabber alpha.pl(at)jabber.org, pgp 0xB25952C0
___
Mc-devel mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/mc-devel


Retain orig. filename as suffix for tmp. filename

2003-02-23 Thread Adam Byrtek / alpha
It is useful to have an original filename as a part of temporary
filename when editing files from extfs or vfs:

 * editors can use it's features connected to file name/extension
   (syntax highlihting etc.)

 * user can see the real name of the file he is editing in external
   editor

I've created simple patch to extract 'foofile.tgz' as

 * for the default getlocalcopy (used by most vfses):
   vfsX-foofile.tgz, or vfsX when the earlier fails
   (not mclocalcopy which is longer and not more informative)

 * for the extfs_open: 
   extfsX-foofile.tgz, or extfsX when the earlier fails

It is worth noting, that the getlocalcopy has already supported file
'extension' as a suffix (mclocalcopyX.tgz in our case, btw it was
implemented in a quite ugly way: 6 lines of code could be easily
substituted with simple strrchr), but it is not enough IMO:

 * Something we call 'extension' is not native to the *nix
   nomenclature, in unix filename is atomic (of course we treat part
   after the last dot as the 'extension', but it is mostly
   conventional) - AFAIK, correct me if I'm wrong...

 * The complete filename is more informative (see the second point at
   the beginning).

Patch in the BTS (also attached):

https://savannah.gnu.org/patch/index.php?func=detailpatchpatch_id=1167group_id=3521
   
-- 

  _.|._ |_  _.   :  Adam Byrtek /alpha/
 (_|||_)| |(_|   :  email  alpha@(irc.pl|debian.org)
 |   :  jabber alpha.pl(at)jabber.org, pgp 0xB25952C0
Index: ChangeLog
===
RCS file: /cvs/gnome/mc/vfs/ChangeLog,v
retrieving revision 1.583
diff -u -r1.583 ChangeLog
--- ChangeLog   19 Feb 2003 14:04:35 -  1.583
+++ ChangeLog   24 Feb 2003 00:20:34 -
@@ -1,0 +1,6 @@
+2003-02-24  Adam Byrtek  [EMAIL PROTECTED]
+
+   * extfs.c (extfs_open): Retain original filename as a suffix
+   for the temporary filename.
+   * vfs.c (mc_def_getlocalcopy): Likewise.
+
Index: extfs.c
===
RCS file: /cvs/gnome/mc/vfs/extfs.c,v
retrieving revision 1.66
diff -u -r1.66 extfs.c
--- extfs.c 25 Dec 2002 21:42:59 -  1.66
+++ extfs.c 24 Feb 2003 00:20:34 -
@@ -659,9 +659,15 @@
ERRNOR (EISDIR, NULL);
 
 if (entry-inode-local_filename == NULL) {
-   char *local_filename;
+   char *local_filename, *suffix;
 
-   local_handle = mc_mkstemps (local_filename, extfs, NULL);
+   /* retain original filename as a suffix for a temporary filename */
+   suffix = g_strconcat(-, entry-name, NULL);
+   
+   if ((local_handle = mc_mkstemps (local_filename, extfs, suffix)) == -1)
+   /* fallback just in case */
+   local_handle = mc_mkstemps (local_filename, extfs, NULL);
+   g_free (suffix);
 
if (local_handle == -1)
return NULL;
Index: vfs.c
===
RCS file: /cvs/gnome/mc/vfs/vfs.c,v
retrieving revision 1.108
diff -u -r1.108 vfs.c
--- vfs.c   19 Feb 2003 08:38:49 -  1.108
+++ vfs.c   24 Feb 2003 00:20:34 -
@@ -1052,29 +1052,26 @@
 char *
 mc_def_getlocalcopy (vfs *vfs, char *filename)
 {
-char *tmp;
+char *tmp, *suffix, *basename;
 int fdin, fdout, i;
 char buffer[8192];
 struct stat mystat;
-char *ext = NULL;
-char *ptr;
 
 fdin = mc_open (filename, O_RDONLY);
 if (fdin == -1)
 return NULL;
 
-/* Try to preserve existing extension */
-for (ptr = filename + strlen(filename) - 1; ptr = filename; ptr--) {
-   if (*ptr == '.') {
-   ext = ptr;
-   break;
-   }
+/* retain original filename as a suffix for a temporary filename */
+basename = strrchr (filename, PATH_SEP);
+if (basename  *basename==PATH_SEP)
+   basename++;
+suffix = g_strconcat(-, basename, NULL);
 
-   if (!isalnum((unsigned char) *ptr))
-   break;
-}
+if ((fdout = mc_mkstemps (tmp, vfs, suffix)) == -1)
+   fdout = mc_mkstemps (tmp, vfs, NULL); /* fallback just in case */
+g_free (suffix);
 
-fdout = mc_mkstemps (tmp, mclocalcopy, ext);
+
 if (fdout == -1)
goto fail;
 while ((i = mc_read (fdin, buffer, sizeof (buffer)))  0){


Re: MC bug

2003-02-18 Thread Adam Byrtek / alpha
On Tue, Feb 18, 2003 at 12:14:07AM +0100, Martin Tomsik wrote:
 Output is following:
 ---
 mac:~# mc -V
 subshell.c: couldn't get terminal settings: Inappropriate ioctl for device
 ---
 
 - Linux Debian Woody (unstable); Kernel 2.4.20-k7 (from .deb package)
 - GNU Midnight Commander 4.6.0

Another Debian user reported this 'bug' recently, but it is caused by
changed -P behaviour (mentioned in /usr/share/doc/REDAME.Debian). You
should remove/update any mc shell alises/functions. Look in your shell
startup files and read man page about the modified -P option.

See also:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=181302

 S pozdravem

Pozdrawiam,
Adam

-- 

  _.|._ |_  _.: Adam Byrtek, alpha@(irc.pl|debian.org)
 (_|||_)| |(_|: gg 1802819, pgp 0xB25952C0
 |: jid alpha.pl(at)jabber.org
___
Mc-devel mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/mc-devel



Re: Patch to avoid history duplicates applied

2003-02-18 Thread Adam Byrtek / alpha
On Tue, Feb 18, 2003 at 03:29:04AM -0500, Pavel Roskin wrote:
 As a side effect, the lists used for history were converted to GList
 (double linked list from glib).
 
 Also, Alt-O writes the directory history now.

And Alt-P in the command line doesn't work now :) It shows not the
last command, but the previous one. Alt-H works fine. It has to be
some simple mistake.

-- 

  _.|._ |_  _.: Adam Byrtek, alpha@(irc.pl|debian.org)
 (_|||_)| |(_|: gg 1802819, pgp 0xB25952C0
 |: jid alpha.pl(at)jabber.org
___
Mc-devel mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/mc-devel



Tilde expansion fix

2003-02-18 Thread Adam Byrtek / alpha
Original Debian bug report:

---cut---
Package: mc
Version: 4.5.42-11.potato.4
Severity: normal

MC believes that regular files with leading tilde and user names
are directories. ~root is one such file. Create one
(touch ~root) and run mc to demonstrate the bug.

Oskar Liljeblad ([EMAIL PROTECTED])
---cut--

I've spend a few hours examining mc code and tracing more and more
levels of recursion. I've decided to apply a very clean fix which:

 - makes mc treat '~name' paths as regular files ('~' is an exception)
 - makes mc treat '~name/...' paths as user directories (with PATH_SEP
   inside)

It makes 'cd' behaviour change a little, but a simple fix in one place
is IMO better than multiple fixes in different pieces of code
(separately for cd, viewer, panel, etc.) And we can't have regular
files shown as directories...

Patch in BTS:
https://savannah.gnu.org/patch/index.php?func=detailpatchpatch_id=1129group_id=3521

Regards

-- 

  _.|._ |_  _.: Adam Byrtek, alpha@(irc.pl|debian.org)
 (_|||_)| |(_|: gg 1802819, pgp 0xB25952C0
 |: jid alpha.pl(at)jabber.org
___
Mc-devel mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/mc-devel



Usability issue - error dialog

2003-02-11 Thread Adam Byrtek / alpha
Error dialogs (for example 'File exists' dialog) are displayed in red,
and the hotkeys are NOT highlighted, so the user don't know which key
to use. One could easily confuse 'Append' (P hotkey) with 'Abort' (A
hotkey).

Maybe we should display corresponging hotkeys in yellow?

Regards

-- 

  _.|._ |_  _.: Adam Byrtek, alpha@(irc.pl|debian.org)
 (_|||_)| |(_|: gg 1802819, pgp 0xB25952C0
 |: jid alpha.pl(at)jabber.org
___
Mc-devel mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/mc-devel



[patch] avoid invoking commands with empty argument

2003-02-11 Thread Adam Byrtek / alpha
mc passes an empty argument () to the EDITOR when creating new file
(with F14). It makes vim to list the current dircetory. The nvi
doesn't create temporary file, so write command won't work, however if
you call nvi without any argument it creates a temp file to save the
data in. The same problem occur with some other editors (jed to name
one) 

Patch submitted:
https://savannah.gnu.org/patch/index.php?func=detailpatchpatch_id=1092group_id=3521

-- 

  _.|._ |_  _.: Adam Byrtek, alpha@(irc.pl|debian.org)
 (_|||_)| |(_|: gg 1802819, pgp 0xB25952C0
 |: jid alpha.pl(at)jabber.org
___
Mc-devel mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/mc-devel



Re: [patch] avoid invoking commands with empty argument

2003-02-11 Thread Adam Byrtek / alpha
On Tue, Feb 11, 2003 at 12:07:50PM -0500, Pavel Roskin wrote:
 P.S. Empty string comes from edit_cmd_new().  It should be fine to use
 NULL if we take care not to run vfs_file_is_local() on NULL in
 execute_with_vfs_arg().

Your patch is better, it sorts things on higher level. I wanted to be
sure any other empty string will be converted to NULL in my_system(),
but I guess this is not necessary, and could even break things.

 What happens if EXECUTE_AS_SHELL is set, but command is NULL?  I
 understand that the shell won't be executed at all.  This is how it's
 called from view_other_cmd() if output_starts_shell is set.

Strange, this should never happen! 
This line:

if (flags  EXECUTE_AS_SHELL)
execl (shell, shell, -c, command, NULL);

Invokes just a 'shell -c' when no command is given. I've just tested.
I've set show_output_starts_shell=1 and started cvs mc with 'mc -u',
and after Ctrl-O I saw only this before mc returned to panels:

 Type exit' to return to the Midnight Commander
   
 zsh: string expected after -c

Regards 

-- 

  _.|._ |_  _.: Adam Byrtek, alpha@(irc.pl|debian.org)
 (_|||_)| |(_|: gg 1802819, pgp 0xB25952C0
 |: jid alpha.pl(at)jabber.org
___
Mc-devel mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/mc-devel



Re: AMC merge patch #2

2003-02-11 Thread Adam Byrtek / alpha
On Tue, Feb 11, 2003 at 03:00:14PM -0500, bulia byak wrote:
 Why not apply the same approach here? Especially given that such 
 additions are very unlikely to break anything else in mc. 

On the other side nearly every programmer has written some tools for
his own use, to learn something new, just for fun or to fix some
problems with widely available tools. Often only the creator and some
friends use it.

Do you really think we should put extfs for JSR ('John Smith's
Archiver'), JSOPL ('John Smith's Own Programming Language') syntax
file, vfs for 'John Smith's Personal Filesystem' (JSPF), etc. into
official mc archive??? 

There must be some selection - and it would fit well into 'contrib'
cvs directory. Arpi, this mail is not to offend you, I also have some
toys created by me I enjoy. I just think there is no point including
things in mc that 99,9% users wouldn't use.

Regards
alpha

ps. When 'contrib' will be created, could sb move 'hp48' and 'bpp'
extfses there? Its an example of (nearly) useless extfs.

-- 

  _.|._ |_  _.: Adam Byrtek, alpha@(irc.pl|debian.org)
 (_|||_)| |(_|: gg 1802819, pgp 0xB25952C0
 |: jid alpha.pl(at)jabber.org
___
Mc-devel mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/mc-devel



Re: contrib directory badly needed

2003-02-06 Thread Adam Byrtek / alpha
On Thu, Feb 06, 2003 at 07:52:49AM -0500, Pavel Roskin wrote:
 Both sites don't resolve, so I cannot see your work.

Sorry, some network problems. I'll kill the server admin when I catch
him.

 Please avoid Javascript and frames and make sure that the site
 remains useful with lynx.

Don't worry, I prefer simple and useful design.

-- 

  _.|._ |_  _.: Adam Byrtek, alpha@(irc.pl|debian.org)
 (_|||_)| |(_|: gg 1802819, pgp 0xB25952C0
 |: jid alpha.pl(at)jabber.org
___
Mc-devel mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/mc-devel



Re: hotlist: now with edit

2003-02-05 Thread Adam Byrtek / alpha

There is one thing I just hate about hotlist. Let me explain on a
example. I run and close and run mc again quite often in many xterms,
and I don't remember whether I used hotlist in current session before.
I have my favourite ftp-sites in 'ftp' group in hotlist.

I run mc.
I press Ctrl-\, Enter to go to my 'ftp' hotlist
Then I chose site I want to connect with Enter
Then I do some work, forget that I used hotlist before
I press Ctrl-\, Enter and... MC CONNECTS to the first site when I just
   wanted to see sites list as before, Ctrl-C, Ctrl-C, Ctrl-C

This is totally non-intuitive and drives me mad. The fix is simple:

--- hotlist.c   21 Dec 2002 08:43:15 -  1.44
+++ hotlist.c   5 Feb 2003 15:38:44 -
@@ -1079,6 +1079,7 @@
 }

 hotlist_done ();
+current_group = hotlist;
 return target;
 }
 

It would be great if it could be applied to 4.6.0 
Regards


-- 

  _.|._ |_  _.: Adam Byrtek, alpha@(irc.pl|debian.org)
 (_|||_)| |(_|: gg 1802819, pgp 0xB25952C0
 |: jid alpha.pl(at)jabber.org
___
Mc-devel mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/mc-devel



Re: hotlist: now with edit

2003-02-05 Thread Adam Byrtek / alpha
On Wed, Feb 05, 2003 at 01:17:53PM -0500, bulia byak wrote:
 so I cannot implement your suggestion now. Also, I think it's much 
 easier to use when all hotkeys are in a column.

Now I could test your patch (after you have fixed errors I reported),
and I understand you use hotkeys like User menu (hotkey before the
label), not like mc Menu (hotkey highlighted inside the label). I
have to admit this approach is a lot more usable.

Few suggestions:

- F7 hotkey for new group?

- items alligned in a mc-way:

   ..
   - ftp
   samba

not
   ..
   - ftp
  samba   

- only 2 chars left on the left side for hotkey (like in mc user
menu), not nearly 10, like it is in your patch

- one more silly thing, now new entry dialog looks like:

l New hotlist entry qk
xEntry label
x /home/alpha

a space before Entry label, Directory path and Hotkey would make
it more pretty imo.

-- 

  _.|._ |_  _.: Adam Byrtek, alpha@(irc.pl|debian.org)
 (_|||_)| |(_|: gg 1802819, pgp 0xB25952C0
 |: jid alpha.pl(at)jabber.org
___
Mc-devel mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/mc-devel



Re: contrib directory badly needed

2003-02-05 Thread Adam Byrtek / alpha
On Wed, Feb 05, 2003 at 02:13:40PM -0500, bulia byak wrote:
 This must be changed. Is it too difficult to provide a section on the 
 web page for storing patches and other useful things, with short 
 author-supplied descriptions?

Now there is a Patches section on the mc BTS, so the situation is a
lot better. Supplying patches with official source is not a good thing
- it would look like we support them, but when unmaintained they will
be useless or broken within one release. IMO BTS is a good place for
patches (we could put a link to it somewhere in documentation).
Moreover when somebody wants to publish his patch - he could do this
on his homepage. 

However 'contrib' dir would be a great thing for add-ons like
mc-burner or some special vfses.

Regards

-- 

  _.|._ |_  _.: Adam Byrtek, alpha@(irc.pl|debian.org)
 (_|||_)| |(_|: gg 1802819, pgp 0xB25952C0
 |: jid alpha.pl(at)jabber.org
___
Mc-devel mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/mc-devel



Re: hotlist: now with edit

2003-02-05 Thread Adam Byrtek / alpha
On Wed, Feb 05, 2003 at 02:58:17PM -0500, bulia byak wrote:
 ..
 - ftp
samba   
 
 I think it's easier to spot subgroups as you quickly scan through 
 the empty column and see - there. Labels should be aligned with 
 labels; when some other mark intrudes into labels I think it 

Ok, but imo you should treat '..' like a label and align it with other
labels (to conform with the filesystem metaphor).

-- 

  _.|._ |_  _.: Adam Byrtek, alpha@(irc.pl|debian.org)
 (_|||_)| |(_|: gg 1802819, pgp 0xB25952C0
 |: jid alpha.pl(at)jabber.org
___
Mc-devel mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/mc-devel



Re: GNU Midnight Commander 4.6.0 released

2003-02-05 Thread Adam Byrtek / alpha
On Wed, Feb 05, 2003 at 02:17:23PM -0500, Pavel Roskin wrote:
 GNU Midnight Commander 4.6.0 has been released.  The difference from the
 last prerelease 4.6.0-pre3 is not very significant, but it's still

Hello,

I would like to inform that Debian packages of mc 4.6.0 are 
available, and can be apt-ed from:

deb http://people.debian.org/~alpha/mc/ ./

Since now I maintain the Debian mc package, as the previous maintainer
lost interest in it.  The package will be included in the official
Debian distribution soon.

Regards

-- 

  _.|._ |_  _.: Adam Byrtek, alpha@(irc.pl|debian.org)
 (_|||_)| |(_|: gg 1802819, pgp 0xB25952C0
 |: jid alpha.pl(at)jabber.org
___
Mc-devel mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/mc-devel



Re: Connection status on menu bar

2003-01-30 Thread Adam Byrtek / alpha
On Thu, Jan 30, 2003 at 03:40:22AM -0500, David Martin wrote:
 For the rest check in:
 http://savannah.gnu.org/bugs/?func=detailbugbug_id=2373group_id=3521

---cut---
Hints line is now empty. When re-running mc it's back there.Hints
line is now empty. When re-running mc it's back there.
---cut---

Now I know what might have confused you. Before pre2 I've reported a
bug which occured when one turned the hintbar on, then off and on
again in one minute time (before the message was refreshed) and made
hintbar look dirty (one could seen panels through it). I don't
remember exactly what happened, but I sent Pavel a patch, he decided
it makes too much mess in the code and applied his own which just
clears the hintbar completly (see also layout.c cvs log entry and diff
for 1.55).

So tou don't have to re-run mc - just wait a minute for hintbar
message refresh.

-- 

  _.|._ |_  _.: Adam Byrtek, alpha@(irc.pl|debian.org)
 (_|||_)| |(_|: gg 1802819, pgp 0xB25952C0
 |: jid alpha.pl(at)jabber.org
___
Mc-devel mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/mc-devel



Re: Connection status on menu bar

2003-01-29 Thread Adam Byrtek / alpha
On Wed, Jan 29, 2003 at 03:13:46PM -0500, David Martin wrote:
 Something similar happened to me, but I usually have hints enabled. I
 think that these used to work perfectly but something changed when
 changing the xterm title (which should have changed nothing for

Could you describe your problem with more details, please? I don't
fully understand what is wrong. Vfs message has been always shown at
(0,0) position unless hintbar was available - and it works this way
now. Or maybe I just can't reproduce your bug.

Maybe this is what you want:

--- layout.c27 Dec 2002 17:52:25 -  1.56
+++ layout.c29 Jan 2003 20:53:57 -
@@ -828,7 +828,7 @@
/* Preserve current cursor position */
getyx (stdscr, row, col);

-   move (0, 0);
+   move (menubar_visible ? 1 : 0, 0);
attrset (NORMAL_COLOR);
printw (%-*s, COLS-1, str);


-- 

  _.|._ |_  _.: Adam Byrtek, alpha@(irc.pl|debian.org)
 (_|||_)| |(_|: gg 1802819, pgp 0xB25952C0
 |: jid alpha.pl(at)jabber.org
___
Mc-devel mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/mc-devel



Re: [PATCH] dotdot in the root directory

2003-01-29 Thread Adam Byrtek / alpha
On Wed, Jan 29, 2003 at 10:26:27PM +0100, Jaroslaw Swierczynski wrote:
 In my opinion .. in the root directory may be very useful. Perhaps MC
 should let users choose. I've been trying to code it but I run into
 problems.

Please don't implement such a useless option in mc! If people really
want this (I still don't know what for), we should leave .. in the
root dir. I don't mind, I actually do nothing in a root dir.

-- 

  _.|._ |_  _.: Adam Byrtek, alpha@(irc.pl|debian.org)
 (_|||_)| |(_|: gg 1802819, pgp 0xB25952C0
 |: jid alpha.pl(at)jabber.org
___
Mc-devel mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/mc-devel



Re: Connection status on menu bar

2003-01-29 Thread Adam Byrtek / alpha
On Wed, Jan 29, 2003 at 10:33:57PM +0100, Filip Kalinski wrote:
 Not really... The problem is that after finishing ftp command the
 black line with ftpfs: done string stays on menubar. Menubar should
 be refreshed after it, I think.

I agree, the ftpfs: done message is left on a menubar, but it was
this way before (I've just tested this on 4.55, 4.6.0-pre[23]). And
Dave pointed in his mail that something which was good before is now
broken...

-- 

  _.|._ |_  _.: Adam Byrtek, alpha@(irc.pl|debian.org)
 (_|||_)| |(_|: gg 1802819, pgp 0xB25952C0
 |: jid alpha.pl(at)jabber.org
___
Mc-devel mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/mc-devel



Re: .syntax file syntax changed since 4.5.4x?

2003-01-26 Thread Adam Byrtek / alpha
On Sun, Jan 26, 2003 at 01:47:09PM +0100, Arpi wrote:
 Imho this thing should be cleaned up for 4.6.0, either remove numbers or
 color names or at least fix the manpage to explain what are them, instead
 of having examples using numbers and description using color names.

Don't get me wrong, I'm not against fixing all you have mentioned (in
this mail and others) - but we REALLY HAVE to release 4.6.0 as fast as
we can - many people (like you before) still belive that 4.55 is the
last oficial release, that the whole gmc-thing is still there and that
mc is unmaintained and sucks.

So we should have stable 4.6.0, and then merge your patches from amc
(some of them are quite useful) or fix color handling.

Pavel, now that you resolved the Italian .po problem, are there any
problems that could slow down the 4.6.0 release?

Regards

-- 

  _.|._ |_  _.: Adam Byrtek, alpha@(irc.pl|debian.org)
 (_|||_)| |(_|: gg 1802819, pgp 0xB25952C0
 |: jid alpha.pl(at)jabber.org
___
Mc-devel mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/mc-devel



Re: title refreshing (xtt) and the 4.6.0 release

2003-01-24 Thread Adam Byrtek / alpha
On Fri, Jan 24, 2003 at 02:39:10AM -0500, Pavel Roskin wrote:
 I'm really surprised by the amount of interest to this topic and by the
 amount of time spent on it.  I even start thinking that maybe I shouldn't
 have applied the patch for changing the title, because the time spent on
 this issue could have been better spent on something else.

You are right, this issue takes too much time. But I fell obligated to
resolve this properly, as I was the one who made the mess by improving
the xterm-title :) Moreover it would be easier if you give us a clear
statement what you will accept and what you won't accept, and when.

My opinion is that xterm restoring is not critical, and if it will be
included in mc it can't give user any discomfort (timeouts) or force
him to change anything (conffiles). It also has to be clean and simple
coded (no offense Tribhuvan, but we should keep the simple thing
simple - that's the Unix way) and has to have some fallback when sth
goes wrong (depending on console i/o is not reliable imo).

Xlib approach satisfies this conditions. It fails in some cases, but
qis is so important? vim people use this, so maybe there isn't any
better way?

(If somebody knows how to obtain X windowid without WINDOWID env
variable, tell me)

Regards
alpha

-- 

  _.|._ |_  _.: Adam Byrtek, alpha@(irc.pl|debian.org)
 (_|||_)| |(_|: gg 1802819, pgp 0xB25952C0
 |: jid alpha.pl(at)jabber.org
___
Mc-devel mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/mc-devel



Re: xterm_title Test Fix (delay removed)

2003-01-19 Thread Adam Byrtek 'alpha'
On Sun, Jan 19, 2003 at 06:11:09AM -0500, Pavel Roskin wrote:
 I'm afraid that there is no good solution for this problem.  Anyway, using
 the titlebar is optional, so whoever is confused by the title can turn
 this feature off.

Agree, but I guess the idea Thomas found in vim might be quite
reliable and unbloated:

  [quote]
  It looks at environment variables WINDOWID and DISPLAY and
  connects to the X server using xlib. Then it gets and sets the
  title using the xlib functions XGetWMName and XSetWMName.
  [/quote]

Of course we can only use it when we ./configure --with-x, but I think
it's not a big problem. I could implement this if you think it's good.

 Yes, I'm finally home and online.

Welcome back. BTW could you close applied or rejected patches in BTS,
please?

Regards

-- 

  _.|._ |_  _.: Adam Byrtek, alpha@(irc.pl|debian.org)
 (_|||_)| |(_|: gg 1802819, pgp 0xB25952C0
 |: jid alpha.pl(at)jabber.org
___
Mc-devel mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/mc-devel



4.6.0 final?

2003-01-19 Thread Adam Byrtek 'alpha'
Pavel, could you tell us what is the timeline for 4.6.0 final release?
Do you plan to release rc3? What still needs to be done in order to
release (TODO shows only documentation/testing) and how can we help?

Regards

-- 

  _.|._ |_  _.: Adam Byrtek, alpha@(irc.pl|debian.org)
 (_|||_)| |(_|: gg 1802819, pgp 0xB25952C0
 |: jid alpha.pl(at)jabber.org
___
Mc-devel mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/mc-devel



[PATCH] Clean xterm title restore (was: xterm_title Test Fix (delay removed))

2003-01-19 Thread Adam Byrtek 'alpha'
On Sun, Jan 19, 2003 at 09:42:52AM -0500, Pavel Roskin wrote:
  I could implement this if you think it's good.
 
 Yes.

I looked into vim code as Thomas suggested, but the whole xterm title
thing was really huge and messy, about few hundreds of code. I've
decided to do it the simple way. Used XFetchName instead of XGetWMName
(the later returns property, requires additional decoding) and dropped
some other hacks - they could be necessary in (imho) 0.01% of systems,
and xterm title in fact is not so critical, so it is not worth
bloating the code (imo).

Patch attached and sent to the BTS (update for #898). Feel free to
send any comments, I don't have any experience with xlib programming.

Regards

PS. Pavel, could you also apply #954, it is simple yet important.

-- 

  _.|._ |_  _.: Adam Byrtek, alpha@(irc.pl|debian.org)
 (_|||_)| |(_|: gg 1802819, pgp 0xB25952C0
 |: jid alpha.pl(at)jabber.org

Index: main.c
===
RCS file: /cvs/gnome/mc/src/main.c,v
retrieving revision 1.272
diff -u -p -r1.272 main.c
--- main.c  27 Dec 2002 23:23:34 -  1.272
+++ main.c  19 Jan 2003 21:50:28 -
@@ -41,6 +41,10 @@
 #include ctype.h
 #include signal.h
 
+#ifdef HAVE_TEXTMODE_X11_SUPPORT
+#   include X11/Xlib.h
+#endif
+
 /* Program include files */
 #include global.h
 #include tty.h
@@ -1544,7 +1549,72 @@ setup_pre (void)
 #endif
 }
 
+/* Connect to X11 display, fetch and return current window title */
+static char *
+fetch_xterm_title()
+{
+#ifndef HAVE_TEXTMODE_X11_SUPPORT
+return NULL;
+#else
+Window x11_window = 0;
+Display *x11_display = NULL;
+static char title[256];
+char *buf, *winid;
+int status;
+
+if ((winid = getenv(WINDOWID)) == NULL)
+   return NULL;
+if ((x11_window = (Window)atol(winid)) == 0)
+   return NULL;
+/* TODO: should we set an alarm for tcp timeouts? */
+if ((x11_display = XOpenDisplay(NULL)) == NULL)
+   return NULL;
+
+status = XFetchName(x11_display, x11_window, buf);
+XCloseDisplay(x11_display);
+
+if (status  buf != NULL) {
+   strncpy(title, buf, 256);
+   title[255] = '\0';
+   XFree((void *) buf);
+} else {
+   return NULL;
+}
+
+return title;
+#endif
+}
+
+/* Use xterm escape sequence to set xterm window title */
 static void
+set_xterm_title (char *title)
+{
+if (title != NULL) {
+   printf(\e]0;%s\a, title);
+   fflush(stdout);
+}
+}
+
+/* Update current directory in the xterm title
+ * (invoked on cd, execute, panel refresh...) */
+void
+update_xterm_title_path (void)
+{
+char *p, *s;
+
+if (xterm_flag  xterm_title) {
+   p = s = g_strdup_printf (mc - %s, strip_home_and_password (cpanel-cwd));
+   do {
+   if (*s  32)
+   *s = '?';
+   } while (*++s);
+
+   set_xterm_title (p);
+   g_free (p);
+}
+}
+
+static char *
 init_xterm_support (void)
 {
 char *termvalue;
@@ -1591,6 +1661,18 @@ init_xterm_support (void)
use_mouse_p = MOUSE_XTERM;
}
 }
+
+/* remember current window title */
+if (xterm_flag)
+return fetch_xterm_title();
+else 
+   return NULL;
+}
+
+static void
+shutdown_xterm_support (char *old_title)
+{
+set_xterm_title(old_title);
 }
 
 static void
@@ -1832,24 +1914,6 @@ midnight_callback (struct Dlg_head *h, i
 
 #define xtoolkit_panel_setup()
 
-/* Show current directory in the xterm title */
-void
-update_xterm_title_path (void)
-{
-unsigned char *p, *s;
-
-if (xterm_flag  xterm_title) {
-   p = s = g_strdup (strip_home_and_password (cpanel-cwd));
-   do {
-   if (*s = 32)
-   *s = '?';
-   } while (*++s);
-   fprintf (stdout, \33]0;mc - %s\7, p);
-   fflush (stdout);
-   g_free (p);
-}
-}
-
 /* Load new hint and display it. */
 void
 load_hint (void)
@@ -2408,6 +2472,7 @@ main (int argc, char *argv[])
 {
 /* if on, it displays the information that files have been moved to ~/.mc */
 int show_change_notice = 0;
+char *old_xterm_title = NULL;
 
 /* We had LC_CTYPE before, LC_ALL includs LC_TYPE as well */
 setlocale (LC_ALL, );
@@ -2474,7 +2539,7 @@ main (int argc, char *argv[])
 
 init_curses ();
 
-init_xterm_support ();
+old_xterm_title = init_xterm_support ();
 
 #ifdef HAVE_SUBSHELL_SUPPORT
 
@@ -2534,6 +2599,9 @@ main (int argc, char *argv[])
 if (alternate_plus_minus)
numeric_keypad_mode ();
 
+if (xterm_flag)
+   shutdown_xterm_support (old_xterm_title);
+
 #ifndef NATIVE_WIN32
 signal (SIGCHLD, SIG_DFL); /* Disable the SIGCHLD handler */
 #endif
--- src/ChangeLog   27 Dec 2002 17:52:24 -  1.1088
+++ src/ChangeLog   29 Dec 2002 13:03:09 -
@@ -0,0 +1,7 @@
+2003-01-19  Adam Byrtek  [EMAIL PROTECTED]
+
+   * main.c (set_xterm_title, fetch_xterm_title): New
+   functions. (init_xterm_support): Old

Re: [PATCH] Clean xterm title restore

2003-01-19 Thread Adam Byrtek 'alpha'
On Mon, Jan 20, 2003 at 01:05:51AM +0100, Thomas Zajic wrote:
 Works fine here (finally no delays on startup :-), except one thing:
 it fails to (save and?) restore the original xterm title on remote
 connections when quitting mc.

I don't have access to a remote xserver, so could you try to debug it?
First of all you should check:

- is the WINDOWID env variable set, try xprop -id $WINDOWID and check
if it gives you info about your xterm (the title is in WM_NAME)

- what does OpenDisplay return, use gdb to step fetch_xterm_title
function in main.c

Regards

-- 

  _.|._ |_  _.: Adam Byrtek, alpha@(irc.pl|debian.org)
 (_|||_)| |(_|: gg 1802819, pgp 0xB25952C0
 |: jid alpha.pl(at)jabber.org
___
Mc-devel mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/mc-devel



Re: [PATCH] Clean xterm title restore (was: xterm_title Test Fix (delay removed))

2003-01-19 Thread Adam Byrtek 'alpha'
On Sun, Jan 19, 2003 at 10:59:18PM +0100, Adam Byrtek 'alpha' wrote:
 I looked into vim code as Thomas suggested, but the whole xterm title
 thing was really huge and messy, about few hundreds of code. I've

  ^^
d  I mean 'hundred lines' of course :) Sorry

-- 

  _.|._ |_  _.: Adam Byrtek, alpha@(irc.pl|debian.org)
 (_|||_)| |(_|: gg 1802819, pgp 0xB25952C0
 |: jid alpha.pl(at)jabber.org
___
Mc-devel mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/mc-devel



Re: README.extfs

2003-01-17 Thread Adam Byrtek 'alpha'
On Thu, Jan 16, 2003 at 05:41:40AM -0500, David Martin wrote:
 Done. English (non-Australian :) native people may check it.

Thanks, you have made my original document a lot more user-friendly
and grammaticaly correct :)

One note. I think the node name should be changed to:
EXTernal File Systems (with 's' on the end)
so users could realize by just viewing 'Contents' that in fact there
are many of them.

Regards

-- 

  _.|._ |_  _.: Adam Byrtek, alpha@(irc.pl|debian.org)
 (_|||_)| |(_|: gg 1802819, pgp 0xB25952C0
 |: jid alpha.pl(at)jabber.org
___
Mc-devel mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/mc-devel



Re: probably bug in FTP

2003-01-16 Thread Adam Byrtek 'alpha'
On Thu, Jan 16, 2003 at 03:40:30PM +0100, Jan Brezina wrote:
 in my account, MC start FTP sesion in root directory which can produce an
 error because of permissions. In addition it isn't quite comfortable.
 Is it possible start in directory obtained by first PWD?

I fully agree, this is a known bug, already on the TODO list. It was
under the 4.6.0 heading, but looks like Pavel moved this to 4.6.1 -
maybe he didn't have enough time to handle this.

Before 4.6.1


[...]

ftp and fish with home != '/' - readjust directory to the home.


-- 

  _.|._ |_  _.: Adam Byrtek, alpha@(irc.pl|debian.org)
 (_|||_)| |(_|: gg 1802819, pgp 0xB25952C0
 |: jid alpha.pl(at)jabber.org
___
Mc-devel mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/mc-devel



Re: README.extfs

2003-01-15 Thread Adam Byrtek 'alpha'
On Wed, Jan 15, 2003 at 03:40:39AM -0500, David Martin wrote:
 Could this piece be made a help node? I'm sure little people know how
 to access tracks in their CDs even though it's been there for a
 while. (and many other things, of course :)

Good idea - would you do this?

-- 

  _.|._ |_  _.: Adam Byrtek, alpha@(irc.pl|debian.org)
 (_|||_)| |(_|: gg 1802819, pgp 0xB25952C0
 |: jid alpha.pl(at)jabber.org
___
Mc-devel mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/mc-devel



Re: xterm_title Test Fix (delay removed)

2003-01-15 Thread Adam Byrtek 'alpha'
On Wed, Jan 15, 2003 at 01:45:06AM -0500, Tribhuvan wrote:
 Proposal for Tomas's xterm_title_restore patch
 (possible solution for eliminating ~5-second delay)

Feel free to overwrite my original 'dirty hack' in BTS:
https://savannah.gnu.org/patch/?func=detailpatchpatch_id=898group_id=3521

However I would be happy if there was some simpler and more 'clean'
approach. Linking against additional lib for so small feature only is
no good in my opinion. Moreover I wouldn't be surprised if it caused
some portability issues... 

Pavel, are you online? Could you give us your opinion on this?

-- 

  _.|._ |_  _.: Adam Byrtek, alpha@(irc.pl|debian.org)
 (_|||_)| |(_|: gg 1802819, pgp 0xB25952C0
 |: jid alpha.pl(at)jabber.org
___
Mc-devel mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/mc-devel



Re: xterm_title patch 898

2003-01-14 Thread Adam Byrtek 'alpha'
On Tue, Jan 14, 2003 at 01:09:52PM +0100, Tomas Styblo wrote:
 It looks at environment variables WINDOWID and DISPLAY and 
 connects to the X server using xlib. Then it gets and sets the 
 title using the xlib functions XGetWMName and XSetWMName.
[...]
 Maybe we should consider using this approach to restore the title ?

I think we should wait for Pavel's opinion, afair he returns soon. It
would be good to know his point of view on this issue.

-- 

  _.|._ |_  _.: Adam Byrtek, alpha@(irc.pl|debian.org)
 (_|||_)| |(_|: gg 1802819, pgp 0xB25952C0
 |: jid alpha.pl(at)jabber.org
___
Mc-devel mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/mc-devel



Feature suggestion - syntax highlighting in the viewer

2003-01-14 Thread Adam Byrtek 'alpha'
I would love to have syntax highlighting in the viewer (maybe switched
on/off, like raw mode). We already have syntax files, would it be
extremely hard to integrate editor's syntax highlighting code into
the viewer?

I think I'm not skillful enough to implement this, but maybe somebody
will get inspied bt this idea - or just give me some clues how to start?

Regards

-- 

  _.|._ |_  _.: Adam Byrtek, alpha@(irc.pl|debian.org)
 (_|||_)| |(_|: gg 1802819, pgp 0xB25952C0
 |: jid alpha.pl(at)jabber.org
___
Mc-devel mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/mc-devel



mcview man page

2003-01-14 Thread Adam Byrtek 'alpha'
mcview man page attached (mostly for Debian package of mc I'm
polishing up - Debian policy strongly recommends manpage for every
binary). It is based mainly on mcedit(1). 

Andrew could you check it and put this into cvs if it's good?

-- 

  _.|._ |_  _.: Adam Byrtek, alpha@(irc.pl|debian.org)
 (_|||_)| |(_|: gg 1802819, pgp 0xB25952C0
 |: jid alpha.pl(at)jabber.org

.TH mcedit 1 14 January 2003
.\SKIP_SECTION
.SH NAME
mcedit \- Midnight Commander's internal file viewer.
.\SKIP_SECTION
.SH USAGE
.B mcview
file [-bcCdfhstVx?]
.SH DESCRIPTION
.LP
Mcedit is a link to 
.B mc,
the Midnight Commander, forcing it
to immediately start its internal viewer and open
.I file
.\.\DONT_SPLIT
.SH OPTIONS
.TP
.I \-b
Forces black and white display.
.TP
.I \-c
Force color mode on terminals where 
.B mcview
defaults to black and white.
.TP
.I \-C keyword=FGcolor,BGcolor:keyword= ...
Used to specify a different color set, where 
.I keyword 
is one of normal, selected, marked, markselect, errors,
reverse menu, menusel, menuhot, menuhotsel and gauge. The colors
are optional and are one of black, gray, red, brightred, green,
brightgreen, brown, yellow, blue, brightblue, magenta,
brightmagenta, cyan, brightcyan, lightgray and white.
See the 
.B Colors 
section in 
.B mc.1
for more information.
.TP
.I \-d
Disables mouse support.
.TP
.I \-f
Displays the compiled-in search paths for Midnight Commander files.
.TP
.I \-t
Used only if the code was compiled with Slang and terminfo: it makes
the Midnight Commander use the value of the 
.B TERMCAP
variable for the terminal information instead of the information on
the system wide terminal database
.TP
.I \-V
Displays the version of the program.
.TP
.I \-x
Forces xterm mode.  Used when running on xterm-capable terminals (two
screen modes, and able to send mouse escape sequences).
.PP
.SH COLORS
The default colors may be changed by appending to the
\fBMC_COLOR_TABLE\fP environment variable. Foreground and
background colors pairs may be specified for example with:
.PP
.nf
MC_COLOR_TABLE=$MC_COLOR_TABLE:\\
editnormal=lightgray,black:\\
editbold=yellow,black:\\
editmarked=black,cyan
.fi

.PP
.SH FILES
@prefix@/share/mc/mc.hlp
.IP
The help file for the program.
.PP
@prefix@/share/mc/mc.ini
.IP
The default system-wide setup for the Midnight Commander, used only if
the user lacks his own ~/.mc/ini file.
.PP
@prefix@/share/mc/mc.lib
.IP
Global settings for the Midnight Commander.  Settings in this file are
global to any Midnight Commander, it is useful to define site-global
.\LINK2
terminal settings.
.\Terminal databases
.PP
$HOME/.mc/ini
.IP
User's own setup. If this file is present then the setup is loaded
from here instead of the system-wide startup file.
.PP
.\SKIP_SECTION
.SH LICENSE
This program is distributed under the terms of the GNU General Public
License as published by the Free Software Foundation. See the built-in
help of the Midnight Commander for details on the License and the lack
of warranty.
.SH AVAILABILITY
The latest version of this program can be found at 
ftp://ftp.gnome.org/mirror/gnome.org/stable/sources/mc/ and on the
mirrors listed on the GNOME site http://www.gnome.org/.
.SH SEE ALSO
mc(1), mcedit(1)
.PP
.SH BUGS
Bugs should be reported to [EMAIL PROTECTED]



Re: Cancel key learning with ESC

2003-01-13 Thread Adam Byrtek 'alpha'
On Mon, Jan 13, 2003 at 06:06:36AM -0500, David Martin wrote:
 The Learning keys dialog says that you can press ESC and wait
 to cancel. But you can wait forever...

I guess you have to press it twice fast, one ESC is treated as Meta
AFAIK.

-- 

  _.|._ |_  _.: Adam Byrtek, alpha@(irc.pl|debian.org)
 (_|||_)| |(_|: gg 1802819, pgp 0xB25952C0
 |: jid alpha.pl(at)jabber.org
___
Mc-devel mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/mc-devel



Re: xterm_title patch 898

2003-01-12 Thread Adam Byrtek 'alpha'
On Sun, Jan 05, 2003 at 05:39:54AM +0100, Tomas Styblo wrote:
 In my humble opinion the restore does not work over network
 because the implementation is fundamentally broken.

Sorry I didn't answer earlier, but I haven't had access to computer
for nearly two weeks. 

Yes, I fully agree. It was just a dirty hack to start with. I was
thinking about this issue during Christmas vacation and I see no easy
way to implement this in a clean and compatibile way.

First of all we have to choose between blocking and non-blocking
behaviour to read old xterm title. Blocking is bad - if one's xterm is
broken and didn't respond, user can wait forever, which is
unacceptable. Non-blocking is also bad - we have to set some arbitrary
timeout to wait for response on slow links, but it is unacceptable to
force user with broken xterm wait 5 seconds. And if the response
arrives after the timeout, it clutters the screen.

And no, TERM env variable IMO is not a reliable way to detect xterm
capabilities.

I see no good approach. I guess we could implement Tomas' patch as a
additional option 'store/restore xterm title', which will be *turned
off* by default. But I'm not sure if this feature is really so
important. I personaly use shell to refresh title to cwd on every cd
or execution.

To Tomas: 

Yes, I think your plan (XTERM_TITLE variable) is good. It would be
very hard to convince people, but I think you should try.

Regards


-- 

  _.|._ |_  _.: Adam Byrtek, alpha@(irc.pl|debian.org)
 (_|||_)| |(_|: gg 1802819, pgp 0xB25952C0
 |: jid alpha.pl(at)jabber.org
___
Mc-devel mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/mc-devel



Re: File 'cd0' exists but cannot be stated fix for QNX 6.x

2003-01-12 Thread Adam Byrtek 'alpha'
On Sat, Jan 04, 2003 at 05:58:21PM -0500, Pavel Roskin wrote:
 There is no such word stat()ed.  Whoever wrote that code didn't care about
 users who don't know C programming.  Perhaps that author of that code didn't
 expect that to happen.

I would like to add that this message often shows when dealing with
samba shares mounted with smbmount but currently unavailable.

Regards

-- 

  _.|._ |_  _.: Adam Byrtek, alpha@(irc.pl|debian.org)
 (_|||_)| |(_|: gg 1802819, pgp 0xB25952C0
 |: jid alpha.pl(at)jabber.org
___
Mc-devel mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/mc-devel



Re: File 'cd0' exists but cannot be stated fix for QNX 6.x

2003-01-12 Thread Adam Byrtek 'alpha'
On Sun, Jan 12, 2003 at 03:43:07PM -0500, Pavel Roskin wrote:
  I would like to add that this message often shows when dealing with
  samba shares mounted with smbmount but currently unavailable.
 
 Again, it should be safe to treat such entries as directories.

They already *are* directories:

~% ls -l /tmp 
ls: /tmp/FILMY: Input/output error
total 19
drwxrwxr-x1 alphaalpha4096 2002-10-09 23:03 maciek

'FILMY' is unavailable share, 'maciek' is available share.

-- 

  _.|._ |_  _.: Adam Byrtek, alpha@(irc.pl|debian.org)
 (_|||_)| |(_|: gg 1802819, pgp 0xB25952C0
 |: jid alpha.pl(at)jabber.org
___
Mc-devel mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/mc-devel



Re: a solution for high and dry xterm_title

2003-01-01 Thread Adam Byrtek 'alpha'
On Wed, Jan 01, 2003 at 03:29:32AM -0500, Tribhuvan wrote:
 While happily running mc-4.6.0pre2 on solaris-9-x86 - appreciating
 the new xterm_title function, I couldnt help but notice that after I
 exit from mc the xterm title was left high  dry where mc was last

It was recently discussed on this list, and I've made a patch to store
and restore old title:

https://savannah.gnu.org/patch/?func=detailpatchpatch_id=898group_id=3521

Regards

-- 

  _.|._ |_  _.: Adam Byrtek, alpha@(irc.pl|debian.org)
 (_|||_)| |(_|: gg 1802819, pgp 0xB25952C0
 |: jid alpha.pl(at)jabber.org
___
Mc-devel mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/mc-devel



Re: Xterm title [PATCH included]

2002-12-29 Thread Adam Byrtek 'alpha'
On Sun, Dec 29, 2002 at 02:12:06PM +0100, Adam Byrtek 'alpha' wrote:
 I guess attached patch could be helpful for you. 

Small fix attached.

-- 

  _.|._ |_  _.: Adam Byrtek, alpha@(irc.pl|debian.org)
 (_|||_)| |(_|: gg 1802819, pgp 0xB25952C0
 |: jid alpha.pl(at)jabber.org

--- main.c.old  2002-12-29 15:05:34.0 +0100
+++ main.c  2002-12-29 15:06:07.0 +0100
@@ -2415,6 +2415,7 @@
 fflush (stdout);
 
 nodelay (stdscr, TRUE);
+usleep(100);
 while (i  255  (c=getch()) != -1) {
title[i++] = c;
 }



Re: [PATCH] xterm titlebar

2002-12-22 Thread Adam Byrtek 'alpha'
On Sun, Dec 22, 2002 at 03:54:59PM -0500, Pavel Roskin wrote:
 I think it simplifies the configuration.  For now, we can simple replace
 Xterm hintbar with Use title bar or something like that, and leave

I've made patch which implement this. It can be found there:
https://savannah.gnu.org/patch/index.php?func=detailpatchpatch_id=879group_id=3521

Changelog is quite self-explanatory. I've removed xterm_hintbar (btw
it was coded quite sloppy) Layout option and replaced it with
xterm_title.

Added update_xterm_title_path wchich shows cpanel-cwd in xterm window
title. It changes home dir into ~, strips password and replaces
control codes (ascii =32) with '?'. I guess it is enough, high ascii
codes (128) seems to cause no trouble to xterms (tested), and they
are often used for national characters - it would be no good to filter
them out.

This function is invoked on panel focus and panel cd, so it works well
even when prompt shows wrong path.


 Just that you understand, I'm going to Russia for vacation from December
 28 to January 19.  I'll not be able to apply anything, so either I leave

Have a good time on your vacation!


Regards

ps. I've found small bug in the hintbar code, I'll submit patch for
this separately.

-- 

  _.|._ |_  _.: Adam Byrtek, alpha@(irc.pl|debian.org)
 (_|||_)| |(_|: gg 1802819, pgp 0xB25952C0
 |: jid alpha.pl(at)jabber.org
___
Mc-devel mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/mc-devel



Re: [PATCH] lynx-like jumpkeys

2002-12-21 Thread Adam Byrtek 'alpha'
On Sun, Dec 22, 2002 at 03:02:57AM +0100, Tomas Styblo wrote:
 t's nice in combination with the CTRL+s feature (I remapped it to F12
 because I use it so often).

I also use it often, but in fact I find Ctrl-S easier to type than
F12. By the way jumpkeys in panel are not too useful, I think it is
easier to type part of a real filename than a random number. But I
guess it depends on habits.

 I am now working on incremental vim-like or less-like searching in
 the listbox widgets using the '/' key, 

It would be useful, and conistent with other unix apps.

Regards

-- 

  _.|._ |_  _.: Adam Byrtek, alpha@(irc.pl|debian.org)
 (_|||_)| |(_|: gg 1802819, pgp 0xB25952C0
 |: jid alpha.pl(at)jabber.org
___
Mc-devel mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/mc-devel



Re: patchfs, audio update

2002-12-19 Thread Adam Byrtek 'alpha'
On Thu, Dec 19, 2002 at 05:40:08PM +0200, Andrew V. Samoilov wrote:
 We trust you, but sometimes you misunderstand us.

Sorry, maybe I used the wrong word once more. I apologize if it
sounded that way.

But the main problem was that everything works fine for me, so I was
confused and did not know what Andrew wanted to fix. I thought maybe
it was the 'empty line problem' (which in fact exists) and I've send a
patch for this.

Regards



-- 

  _.|._ |_  _.: Adam Byrtek, alpha@(irc.pl|debian.org)
 (_|||_)| |(_|: gg 1802819, pgp 0xB25952C0
 |: jid alpha.pl(at)jabber.org
___
Mc-devel mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/mc-devel



Re: patchfs, audio update

2002-12-18 Thread Adam Byrtek 'alpha'
On Wed, Dec 18, 2002 at 07:45:29PM +0200, Andrew V. Samoilov wrote:
 Well, but some quoting (and security) issues fixed in the CVS just now.
 Patch attached.

Looks good, thanks.
I need to be more careful when it comes to quoting... looks like I
forget about this too often.

 BTW, new incarnation reports wrong patch sizes for gzipped patches.

I'll examine this when I have more time.
Regards

-- 

  _.|._ |_  _.: Adam Byrtek, alpha@(irc.pl|debian.org)
 (_|||_)| |(_|: gg 1802819, pgp 0xB25952C0
 |: jid alpha.pl(at)jabber.org
___
Mc-devel mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/mc-devel



Re: patchfs, audio update

2002-12-18 Thread Adam Byrtek 'alpha'
On Wed, Dec 18, 2002 at 09:26:05PM +0200, Andrew V. Samoilov wrote:
 You can use ideas from attached file.  I eliminated all tell() call and 
  calculate position itself by adding current line length to some 

This wasn't necessary at all.

The problem was somewhere else: patchfs treated empty line as the diff
boundary, so the size was broken. The fix was really simple. 

Pavel, could you apply the attached patch please, not Andrew's one.

Andrew you could see how it looks for me here:
http://www.rpg-portal.pl/alpha/mc-patchfs.png
If the size is still wrong on your system - let me know, maybe your
system has broken pipes... And thanks for your interest in patchfs.

Regards
alpha

-- 

  _.|._ |_  _.: Adam Byrtek, alpha@(irc.pl|debian.org)
 (_|||_)| |(_|: gg 1802819, pgp 0xB25952C0
 |: jid alpha.pl(at)jabber.org

Index: patchfs.in
===
RCS file: /cvs/gnome/mc/vfs/extfs/patchfs.in,v
retrieving revision 1.7
diff -u -r1.7 patchfs.in
--- patchfs.in  13 Dec 2002 05:22:09 -  1.7
+++ patchfs.in  18 Dec 2002 22:40:51 -
@@ -108,7 +108,7 @@
}
$f=$f..diff;
 
-   } elsif ($state==1  !/^([+\- ]|@@)/) {
+   } elsif ($state==1  !/^([+\- \n]|@@)/) {
# start of comments, end of diff contents
$npos=tell(I)-length;
printf -rw-r--r-- 1 %s %s %d %s %s%s\n, $uid, $gid, $npos-$pos, 
datetime($time), $prefix, $f
@@ -143,7 +143,7 @@
($fdst)=/^.*\n\+{3} ([^\s]+).*\n.*\n$/;
$found=1 if (($fsrc eq $file) || ($fdst eq $file));
 
-   } elsif ($state==1  !/^([+\- ]|@@)/) {
+   } elsif ($state==1  !/^([+\- \n]|@@)/) {
# start of comments, end of diff contents
last if ($found);
$state=0;



Re: patchfs, audio update

2002-12-18 Thread Adam Byrtek 'alpha'
On Wed, Dec 18, 2002 at 06:45:42PM -0500, Pavel Roskin wrote:
 Sorry, I don't understand why an empty line is not a diff boundary.  It's
 not valid in diff, as far as I know.

Yes, it is not a valid diff.
Valid diff puts:
' \n' (space and a newline)
But Andrew gave me a link to a www mailing list archive, with a patch
inside pre tags. When one saves such webpage (or pastecopy it) the
space is stripped and it looks like this:
'\n' (only newline)

I think we should treat this as a diff contents even if it isn't
formaly valid.

 Besides, Andrew has CVS access and uses it very responsibly.

Maybe, but his fix isn't necessary - at least for my system. See:
http://www.rpg-portal.pl/alpha/mc-patchfs.png

Lets wait for Andrew's reaction if you don't trust me.

 I think that @@\n$ should be replaced with @@ in both places.
 Tested, works for me.  I'm not applying it to avoid conflicts, but keep it
 in mind.

The patch for this issue is already in BTS!

-- 

  _.|._ |_  _.: Adam Byrtek, alpha@(irc.pl|debian.org)
 (_|||_)| |(_|: gg 1802819, pgp 0xB25952C0
 |: jid alpha.pl(at)jabber.org
___
Mc-devel mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/mc-devel



Re: [PATCH] xterm titlebar

2002-12-17 Thread Adam Byrtek 'alpha'
On Mon, Dec 16, 2002 at 07:42:12PM +0100, Tomas Styblo wrote:
 The xterm_hintbar option is not configurable in any menu and also
 is not documented at all. I did not even know it existed. I tried

It is. See Options-Layout, but I also didn't noticed it until I
grepped sources for 'xterm' :)

 That comment is probably outdated. Both the xterm_hintbar and
 xterm_titlebar features work in my rxvt 2.7.8. That's a

It works in 2.6.4.

Maybe we should add another option: Xterm title to Options-Layout,
on even replace Xterm hintbar with it...

This options SHOULD be set ON by default, because probably there aren't
to many people with broken xterms.

 mc running in the linux console and it does nothing at all. Which
 I suppose is good. :) But maybe a check for getenv(DISPLAY)

Se source:

if (xterm_flag  !xterm_hintbar) {

xterm_flag takes care of this.


-- 

  _.|._ |_  _.: Adam Byrtek, alpha@(irc.pl|debian.org)
 (_|||_)| |(_|: gg 1802819, pgp 0xB25952C0
 |: jid alpha.jabberpl.org
___
Mc-devel mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/mc-devel



MC icons available

2002-12-17 Thread Adam Byrtek 'alpha'
You might be interested in this:
http://www.kde-look.org/content/show.php?content=4379

-- 

  _.|._ |_  _.: Adam Byrtek, alpha@(irc.pl|debian.org)
 (_|||_)| |(_|: gg 1802819, pgp 0xB25952C0
 |: jid alpha.pl(at)jabber.org
___
Mc-devel mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/mc-devel



Re: F1 Help: Bad window resizing

2002-12-16 Thread Adam Byrtek 'alpha'
On Mon, Dec 16, 2002 at 08:08:58AM -0500, David Martin wrote:
 That's it. I'm using the KDE terminal and resizing works fine
 except when Help is displayed. I didn't have time to check
 the code, but I think it was changed recently.

Could you put this on the BTS, please?
https://savannah.gnu.org/bugs/?func=addbuggroup=mc


Regards


-- 

  _.|._ |_  _.: Adam Byrtek, alpha@(irc.pl|debian.org)
 (_|||_)| |(_|: gg 1802819, pgp 0xB25952C0
 |: jid alpha.jabberpl.org
___
Mc-devel mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/mc-devel



Re: patchfs, audio update

2002-12-13 Thread Adam Byrtek 'alpha'
On Fri, Dec 13, 2002 at 12:21:57AM -0500, Pavel Roskin wrote:
 My fault for not reading your patch :-(

My fault for not reading MY patch carefuly :)

 I suggest that you use cvs diff to generate diffs.

I used cvs, but I didn't notice this small change.

Regards

-- 

  _.|._ |_  _.: Adam Byrtek, alpha@(irc.pl|debian.org)
 (_|||_)| |(_|: gg 1802819, pgp 0xB25952C0
 |: jid alpha.jabberpl.org
___
Mc-devel mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/mc-devel



Re: [PATCH] xterm titlebar

2002-12-12 Thread Adam Byrtek 'alpha'
On Thu, Dec 12, 2002 at 05:06:05PM +0100, David Sterba wrote:
  +fprintf (stdout, \33]0;mc - %s\7, d);
 How about writing into /dev/tty ?

'Xterm hintbar' feature in layout.c does it using stdout, so I decided
to be consistent.

Don't know if writing /dev/tty could break sth.

 Anyway, good feature :-)

Nice to hear you like it.

-- 

  _.|._ |_  _.: Adam Byrtek, alpha@(irc.pl|debian.org)
 (_|||_)| |(_|: gg 1802819, pgp 0xB25952C0
 |: jid alpha.jabberpl.org
___
Mc-devel mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/mc-devel



Re: README.extfs

2002-12-12 Thread Adam Byrtek 'alpha'
On Thu, Dec 12, 2002 at 08:16:15PM -0500, Pavel Roskin wrote:
 I think you are getting too technical if your goal is to write
 documentation for the end users.  There should not be such words as
 copyout in this document.  Please remember that the users are not
 interested in integrating numerous features, they want to use them.

Anyone on this list want to take over this document? Maybe person
responsible for mc documentation? I just wanted to drop an idea,
create a first draft, but I'm not a good writer, especialy in English,
which is my foreign language.

-- 

  _.|._ |_  _.: Adam Byrtek, alpha@(irc.pl|debian.org)
 (_|||_)| |(_|: gg 1802819, pgp 0xB25952C0
 |: jid alpha.jabberpl.org
___
Mc-devel mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/mc-devel



Re: patchfs, audio update

2002-12-12 Thread Adam Byrtek 'alpha'
Forgotten about perl year issue.
Sorry, sorry. Attached.

-- 

  _.|._ |_  _.: Adam Byrtek, alpha@(irc.pl|debian.org)
 (_|||_)| |(_|: gg 1802819, pgp 0xB25952C0
 |: jid alpha.jabberpl.org

--- extfs.orig/patchfs.in   2002-12-13 03:13:30.0 +0100
+++ extfs/patchfs.in2002-12-13 03:12:07.0 +0100
@@ -21,7 +21,7 @@
 sub timef
 {
 my @time=localtime($_[0]);
-return sprintf %02d-%02d-%02d %02d:%02d, $time[4]+1, $time[3], $time[5]%100, 
$time[2], $time[1];
+return sprintf %02d-%02d-%d %02d:%02d, $time[4]+1, $time[3], $time[5]+1900, 
+$time[2], $time[1];
 }
 
 # parse given string as a date and return unix time



Re: GPL in xnc.hlp

2002-12-11 Thread Adam Byrtek 'alpha'
On Wed, Dec 11, 2002 at 05:42:30AM -0500, David Martin wrote:
 I didn't change the new doc/pl/xnc.hlp as it is
 using a translated GPL.

I've already sent Pavel fixed xnc when I realized that the original
GPL should still be included. I'm attaching it to you directly just to
be sure...

Regards
Adam

-- 

  _.|._ |_  _.: Adam Byrtek, alpha@(irc.pl|debian.org)
 (_|||_)| |(_|: gg 1802819, pgp 0xB25952C0
 |: jid alpha.jabberpl.org



xnc.hlp.gz
Description: Binary data


Re: GPL in xnc.hlp

2002-12-11 Thread Adam Byrtek 'alpha'
On Wed, Dec 11, 2002 at 03:17:05PM +0200, Andrew V. Samoilov wrote:
 It's ok.  Russian translation is unofficial too.  As far as I know there 
 is no legal translation to Russian at all.

Yes, but English original version is still included in Russian
translation. I've forgotten to include the original untranslated GPL -
thats why David complained.

Regards

-- 

  _.|._ |_  _.: Adam Byrtek, alpha@(irc.pl|debian.org)
 (_|||_)| |(_|: gg 1802819, pgp 0xB25952C0
 |: jid alpha.jabberpl.org
___
Mc-devel mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/mc-devel



Re: New patchfs script

2002-12-11 Thread Adam Byrtek 'alpha'
On Wed, Dec 11, 2002 at 04:42:35PM +0200, Andrew V. Samoilov wrote:
 -copyout ($ARGV[2], $ARGV[3]);
 +copyout ($ARGV[2], quotemeta ($ARGV[3]));

The second chunk is invalid.
$ARGV[3] is used only for 'open', and it doesn't need quoting:

bash-2.05b$ perl -we 'open TMP, . quotemeta(Q|Q|\\|Q); print TMP
xxx\n; close TMP'
bash-2.05b$ ls Q*
Q\|Q\|\\\|Q

Fixed in attachment.


-- 

  _.|._ |_  _.: Adam Byrtek, alpha@(irc.pl|debian.org)
 (_|||_)| |(_|: gg 1802819, pgp 0xB25952C0
 |: jid alpha.jabberpl.org

Index: patchfs
===
RCS file: /cvs/gnome/mc/vfs/extfs/patchfs,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- patchfs 9 Dec 2002 20:16:34 -   1.6
+++ patchfs 11 Dec 2002 11:03:26 -  1.7
@@ -124,14 +124,15 @@
 
 
 my $tmp;
-$_=`$file $ARGV[1]`;
+my $quoted_name = quotemeta $ARGV[1];
+$_=`$file $quoted_name`;
 if (/bzip/) {
 $tmp=tmpnam();
-system $bzcat $ARGV[1]  $tmp;
+system $bzcat $quoted_name  $tmp;
 open I,  $tmp;
 } elsif (/gzip/) {
 $tmp=tmpnam();
-system $gzcat $ARGV[1]  $tmp;
+system $gzcat $quoted_name  $tmp;
 open I,  $tmp;
 } else {
 open I,  $ARGV[1];



Re: New patchfs script

2002-12-11 Thread Adam Byrtek 'alpha'
On Wed, Dec 11, 2002 at 03:59:47PM +0100, Adam Byrtek 'alpha' wrote:
  And it is reasonable to search and substitute perl in patchfs, a and 
  uzip scripts, but this is another story.
 
 Could be quite hard... i see no popular alternatives.

Sorry, I didn't understand you right. I was thinking that you want to
substitute perl with some other scripting language :))

Regards.

-- 

  _.|._ |_  _.: Adam Byrtek, alpha@(irc.pl|debian.org)
 (_|||_)| |(_|: gg 1802819, pgp 0xB25952C0
 |: jid alpha.jabberpl.org
___
Mc-devel mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/mc-devel



Re: New patchfs script

2002-12-10 Thread Adam Byrtek 'alpha'
On Mon, Dec 09, 2002 at 03:42:52PM -0500, Pavel Roskin wrote:
 Yes, I think some of the VFSs need to be given more visibility, possibly
 in the menu or maybe in some predefined hotlist.

Menu with 'subcategories' (like hotlist now) would be nice.

 That would be mc-4.6.0-pre2.  I don't have any plans for mc-4.6.0 other
 than updating translations, documentation and accepting simple bugfixes.

I can help updating Polish translations, if there isn't any person
responsible for this.

After the release I'll try to contact once more with Debian mc
maintainers - it looks like there are MIA. If they don't respond
again, I'll upload the new release...

Regards 
alpha

-- 

  _.|._ |_  _.: Adam Byrtek, alpha@(irc.pl|debian.org)
 (_|||_)| |(_|: gg 1802819, pgp 0xB25952C0
 |: jid alpha.jabberpl.org
___
Mc-devel mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/mc-devel



Fw: Re: bugzilla?

2002-12-10 Thread Adam Byrtek 'alpha'
- Forwarded message from Scott Lockwood [EMAIL PROTECTED] -

Date: Mon, 9 Dec 2002 11:49:46 -0600
From: Scott Lockwood [EMAIL PROTECTED]
To: Adam Byrtek 'alpha' [EMAIL PROTECTED]
Subject: Re: bugzilla?

Or, if a seperate resource is desired, I'd be happy to setup bugzilla (or
anything else) for free for the developers.

Scott
http://lrsehosting.com/ :-)

- Original Message -
From: Adam Byrtek 'alpha' [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, December 09, 2002 6:24 AM
Subject: bugzilla?


 I think that some bug tracking system for mc would be very helpful.
 Maybe somebody could ask http://bugzilla.gnome.org people to create
 one? (there is only 'gmc' there)


- End forwarded message -

-- 

  _.|._ |_  _.: Adam Byrtek, alpha@(irc.pl|debian.org)
 (_|||_)| |(_|: gg 1802819, pgp 0xB25952C0
 |: jid alpha.jabberpl.org
___
Mc-devel mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/mc-devel



Re: [PATCH] extfs scripts fixes

2002-12-09 Thread Adam Byrtek 'alpha'
On Mon, Dec 09, 2002 at 12:55:13AM -0500, Pavel Roskin wrote:
 Thank you.  It will take a lot of time to retest, and I'll be busy next
 week, so please be patient.

Ok.

 I'm asking you because you have done some testing of those scripts, so you
 probably have an informed opinion.

In fact I haven't noticed that cpio is commented out :) So the script
is in fact redundant.

Ftplist fs is quite useless when we can have ftp sites in hotlist.
Ftplist just creates symlinks like:

sunsite = ftp://sunsite.unc.edu

To make them useful one has to recompile:

# If you add #define WANT_PARSE to main.c you will be able to hit
return
# on the filenames in order to connect to the ftp servers.


--

  _.|._ |_  _.: Adam Byrtek, alpha@(irc.pl|debian.org)
 (_|||_)| |(_|: gg 1802819, pgp 0xB25952C0
 |: jid alpha.jabberpl.org
___
Mc-devel mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/mc-devel



Re: uzip extfs sanity patch

2002-12-09 Thread Adam Byrtek 'alpha'
On Mon, Dec 09, 2002 at 10:38:27AM +0100, Pavel Machek wrote:
 Well, if fish-like format was used, something like 
 
 Nfile_name
 Dsome_unparsable_junk
 Prwxr--r--
 
 would be passed to midnight. Midnight would refuse to interpret date,

Well, that would be great, but it would implicate updating (and
complicating, or even rewriting in Perl, like Pavel R. said) every
extfs script - so it looks like it's not worth the effort.

Regards

-- 

  _.|._ |_  _.: Adam Byrtek, alpha@(irc.pl|debian.org)
 (_|||_)| |(_|: gg 1802819, pgp 0xB25952C0
 |: jid alpha.jabberpl.org
___
Mc-devel mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/mc-devel



bugzilla?

2002-12-09 Thread Adam Byrtek 'alpha'
I think that some bug tracking system for mc would be very helpful.
Maybe somebody could ask http://bugzilla.gnome.org people to create
one? (there is only 'gmc' there) 

Regards

-- 

  _.|._ |_  _.: Adam Byrtek, alpha@(irc.pl|debian.org)
 (_|||_)| |(_|: gg 1802819, pgp 0xB25952C0
 |: jid alpha.jabberpl.org
___
Mc-devel mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/mc-devel



New patchfs script

2002-12-09 Thread Adam Byrtek 'alpha'
Hi. I've rewiten patchfs in Perl - now it can properly handle all
patches in unified diff format (the most common format for patches).

Methods supported: list, copyout

The algorithm isn't too fast (yet), but I think it's quite usable,
especialy for smaller patches. When I've tested it on 27MB kernel
patch 'list' took 4s and 'copyout' (in the worst case) 6s (duron
900mhz).

I have some issues on my todo list (info about size, date), but I
think this extfs is already ready for inclusion.

Entry to add to mc.ext:

regex/\.(diff|patch)(\.(bz|bz2|gz|z|Z))?$
Open=%cd %p#patchfs


Regards
alpha

PS. The latest mc snapshot segfaults after pressing f4 to edit file.
Don't have time to check if it's fixed in cvs.

-- 

  _.|._ |_  _.: Adam Byrtek, alpha@(irc.pl|debian.org)
 (_|||_)| |(_|: gg 1802819, pgp 0xB25952C0
 |: jid alpha.jabberpl.org

#! /usr/bin/perl
#
# Written by Adam Byrtek [EMAIL PROTECTED], 2002
# 
# extfs to handle patches in unified diff format

my $bzcat = bzip2 -dc;
my $gzcat = zcat;
my $file = file;

sub now
{
my @time = localtime;
return sprintf %02d-%02d-%02d %02d:%02d, $time[4]+1, $time[3], $time[5]%100, 
$time[2], $time[1];
}

sub list
{
my ($archive)=@_;
my ($uid,$gid)=(`id -nu` || 0,`id -ng` || 0);
my ($len,$f);
chomp ($uid, $gid);

while (I) {
if (/^--- /) {
printf -rw-r--r-- 1 %s %s %d %s %s\n, $uid, $gid, $len-1, now, $f
  if $f;
s/^--- ([^\s]+).*$/$1/;
chomp;
$f=$_;
$len=0;
} elsif (/^[+\-]/) {
$len=0;
$len++;
}
}
printf -rw-r--r-- 1 %s %s %d %s %s\n, $uid, $gid, $len-1, now, $f
  if $f;
close I;
}

sub copyout
{
my ($archive,$file,$out)=@_;
my ($f,$state,$notebuf,$diffbuf,$note);

open O,  $out;
while (I) {
if (/^--- /) {
last if ($f eq $file);
# switch to diff mode
$state=1;
$note=$notebuf;
$notebuf=$diffbuf=;
$f=$_;
$f=~s/^--- ([^\s]+).*$/$1/;
chomp $f;
} elsif (!/^([+\- ]|@@)/) {
# switch to normal mode
$state=0;
}

if ($state==0) {
$notebuf.=$_;
} elsif ($state==1) {
$diffbuf.=$_;
}
}
print O ($note, $diffbuf) if ($f eq $file);
close O;
}

$_=`$file $ARGV[1]`;
if (/bzip/) {
open I, $bzcat $ARGV[1] |;
} elsif (/gzip/) {
open I, $gzcat $ARGV[1] |;
} else {
open I,  $ARGV[1];
}

if ($ARGV[0] eq list) {
list $ARGV[1];
exit(0);
} if ($ARGV[0] eq copyout) {
copyout ($ARGV[1], $ARGV[2], $ARGV[3]);
exit(0);
}
exit(1);



Re: [PATCH] extfs scripts fixes

2002-12-09 Thread Adam Byrtek 'alpha'
On Mon, Dec 09, 2002 at 12:55:13AM -0500, Pavel Roskin wrote:
 Thank you.  It will take a lot of time to retest, and I'll be busy next
 week, so please be patient.

A little fix to apply after my earlier extfs-scripts-patch:

- perl's localtime returns month in 0-11 format, not 1-12 as somebody
assumes, so I've added +1 in some scripts to fix this
- perl warning mode disabled for uzip

-- 

  _.|._ |_  _.: Adam Byrtek, alpha@(irc.pl|debian.org)
 (_|||_)| |(_|: gg 1802819, pgp 0xB25952C0
 |: jid alpha.jabberpl.org

diff -u extfs.alpha/apt extfs.alpha2/apt
--- extfs.alpha/apt 2002-12-08 18:07:39.0 +0100
+++ extfs.alpha2/apt2002-12-09 17:01:30.0 +0100
@@ -11,7 +11,7 @@
 my ($dt) = @_;
 my (@time);
 @time = localtime($dt);
-$bt = sprintf %02d-%02d-%02d %02d:%02d, $time[4], $time[3], $time[5]%100, 
$time[2], $time[1];
+$bt = sprintf %02d-%02d-%02d %02d:%02d, $time[4]+1, $time[3], $time[5]%100, 
+$time[2], $time[1];
 return $bt;
 }
 
diff -u extfs.alpha/deba extfs.alpha2/deba
--- extfs.alpha/deba2002-12-08 18:02:02.0 +0100
+++ extfs.alpha2/deba   2002-12-09 17:01:50.0 +0100
@@ -11,7 +11,7 @@
 my ($dt) = @_;
 my (@time);
 @time = localtime($dt);
-$bt = sprintf %02d-%02d-%02d %02d:%02d, $time[4], $time[3], $time[5]%100, 
$time[2], $time[1];
+$bt = sprintf %02d-%02d-%02d %02d:%02d, $time[4]+1, $time[3], $time[5]%100, 
+$time[2], $time[1];
 return $bt;
 }
 
diff -u extfs.alpha/debd extfs.alpha2/debd
--- extfs.alpha/debd2002-12-08 18:10:36.0 +0100
+++ extfs.alpha2/debd   2002-12-09 17:01:57.0 +0100
@@ -11,7 +11,7 @@
 my ($dt) = @_;
 my (@time);
 @time = localtime($dt);
-$bt = sprintf %02d-%02d-%02d %02d:%02d, $time[4], $time[3], $time[5]%100, 
$time[2], $time[1];
+$bt = sprintf %02d-%02d-%02d %02d:%02d, $time[4]+1, $time[3], $time[5]%100, 
+$time[2], $time[1];
 return $bt;
 }
 
diff -u extfs.alpha/dpkg extfs.alpha2/dpkg
--- extfs.alpha/dpkg2002-12-08 18:13:43.0 +0100
+++ extfs.alpha2/dpkg   2002-12-09 17:02:01.0 +0100
@@ -11,7 +11,7 @@
 my ($dt) = @_;
 my (@time);
 @time = localtime($dt);
-$bt = sprintf %02d-%02d-%02d %02d:%02d, $time[4], $time[3], $time[5]%100, 
$time[2], $time[1];
+$bt = sprintf %02d-%02d-%02d %02d:%02d, $time[4]+1, $time[3], $time[5]%100, 
+$time[2], $time[1];
 return $bt;
 }
 
diff -u extfs.alpha/uzip.in extfs.alpha2/uzip.in
--- extfs.alpha/uzip.in 2002-12-08 17:40:40.0 +0100
+++ extfs.alpha2/uzip.in2002-12-09 17:02:37.0 +0100
@@ -1,4 +1,4 @@
-#! /usr/bin/perl -w
+#! /usr/bin/perl
 #
 # zip file archive Virtual File System for Midnight Commander
 # Version 1.4.0 (2001-08-07).



Re: New patchfs script

2002-12-09 Thread Adam Byrtek 'alpha'
On Mon, Dec 09, 2002 at 12:16:42PM -0500, Pavel Roskin wrote:
 Please use -w (see the first line in uzip).  There are some warnings
 with copyout.

Ok. This warning wasn't important at all, but I'll fix it.

 Also, the size of the files is still 0:

Yes, I have to rewrite whole code to make 'size' works proper. Firstly
I only wanted to display number of lines affected as 'file size', but
then the viewer trimmed the output of copyout...

 I don't know if calculating the file sizes in list will slow it down.

I've found an algorithm that would not slow it down, but make it even
faster (using tell). I'm testing it now.

 Maybe we should fix the editor not to trust mc_stat() too much, but it was
 already attempted.

BTW mailfs outputs wrong message size - so the mails are trimmed in
viewer. I'll try to fix this when I have some time.

 but I just want to give you are chance to do it right.

Wait. I'll send you an updated version soon.


Regards

-- 

  _.|._ |_  _.: Adam Byrtek, alpha@(irc.pl|debian.org)
 (_|||_)| |(_|: gg 1802819, pgp 0xB25952C0
 |: jid alpha.jabberpl.org
___
Mc-devel mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/mc-devel



Re: New patchfs script

2002-12-09 Thread Adam Byrtek 'alpha'
On Mon, Dec 09, 2002 at 12:16:42PM -0500, Pavel Roskin wrote:
 I hope to put your script on CVS today and I'm ready to make fixes myself,
 but I just want to give you are chance to do it right.

Updated version attached. It works in reasonable time, even with
kernel patches. It supports file size and date parsing. All warnings
fixed. I considered some 'run' virtual methods, but decided they are
redundant. 'patch -p1' is quite simple to type in fact... and one can
add it to mc menu if he wants.

I will not send anything for a week I think, I have to get some rest
after a few days hacking mc. So you will have some time to deal with
my earlier patches :)

Regards

ps. When do you plan to release stable mc? Yes, I know, probably 'when
it will be ready', but what are the predictions?

-- 

  _.|._ |_  _.: Adam Byrtek, alpha@(irc.pl|debian.org)
 (_|||_)| |(_|: gg 1802819, pgp 0xB25952C0
 |: jid alpha.jabberpl.org

#! /usr/bin/perl -w
#
# Written by Adam Byrtek [EMAIL PROTECTED], 2002
# 
# extfs to handle patches in unified diff format

use bytes;
use strict;
use POSIX;

# standard binaries
my $bzcat = bzip2 -dc;
my $gzcat = zcat;
my $file = file;

# date parsing requires Date::Parse from TimeDate module
my $parsedates = eval require Date::Parse;

sub timef
{
# format unix time
my @time=localtime($_[0]);
return sprintf %02d-%02d-%02d %02d:%02d, $time[4]+1, $time[3], $time[5]%100, 
$time[2], $time[1];
}

sub datetime
{
# in case of problems fall back to 0 in unix time
# note: str2time interprets some wrong values (eg.  ) as 'today'
if ($parsedates  defined (my $t=str2time($_[0]))) {
return timef($t);
}
return timef(0);
}

sub list
{
my ($f,$d,$state,$pos,$npos);
my ($uid,$gid)=(`id -nu` || 0,`id -ng` || 0);
chomp ($uid, $gid);

import Date::Parse if ($parsedates);

# state==1 means diff contents, state==0 mens comments
$state=1;
$f=;
while (I) {
if (/^--- /) {
# start of a new file
if ($state==1) {
$npos=tell(I)-length;
printf -rw-r--r-- 1 %s %s %d %s %s\n, $uid, $gid, $npos-$pos, 
datetime($d), $f
  if $f;
$pos=$npos;
}
$state=1;
s/^--- ([^\s]+).*$/$1/;
chomp;
$f=$_;
$d=;
} elsif (/^\+\+\+ /) {
# take date from the +++ field
s/^\+\+\+ ([^\s]+)\s*//;
s/^([^\t]+).*$/$1/;
chomp;
$d=$_;
} elsif ($state==1  !/^([+\- ]|@@)/) {
# start of comments, end of diff contents
$npos=tell(I)-length;
printf -rw-r--r-- 1 %s %s %d %s %s\n, $uid, $gid, $npos-$pos, 
datetime($d), $f
  if $f;
$pos=$npos;
$state=0;
}
}
$npos=tell(I);
printf -rw-r--r-- 1 %s %s %d %s %s\n, $uid, $gid, $npos-$pos, datetime($d), $f
  if $f  $state!=0;

close I;
}

sub copyout
{
my ($file,$out)=@_;
my ($f,$state,$pos);

open O,  $out;
$state=1;
$f=;
while (I) {
if (/^--- /) {
# start of a new file
if ($state==1) {
if ($f eq $file) {
seek(I,-length,1);
last;
}
$pos=tell(I)-length;
}
$state=1;
s/^--- ([^\s]+).*$/$1/;
chomp;
$f=$_;
} elsif ($state==1  !/^([+\- ]|@@)/) {
# start of comments, end of diff contents
if ($f eq $file) {
seek(I,-length,1);
last;
}
$pos=tell(I)-length;
$state=0;
}
}
if ($f eq $file) {
my $here=tell(I);
seek(I,$pos,0);
read(I,my $buf,$here-$pos);
print O $buf;
}

close O;
}


my $tmp;
$_=`$file $ARGV[1]`;
if (/bzip/) {
$tmp=tmpnam();
system $bzcat $ARGV[1]  $tmp;
open I,  $tmp;
} elsif (/gzip/) {
$tmp=tmpnam();
system $gzcat $ARGV[1]  $tmp;
open I,  $tmp;
} else {
open I,  $ARGV[1];
}

if ($ARGV[0] eq list) {
list;
exit(0);
} if ($ARGV[0] eq copyout) {
copyout ($ARGV[2], $ARGV[3]);
exit(0);
}
exit(1);

END {
system rm $tmp if ($tmp);
}



[PATCH] extfs scripts fixes

2002-12-08 Thread Adam Byrtek 'alpha'

Hi. I've checked any tried to fix all current mc extfs scrips. Results
can be seen in the patch attached.

Every change is explained in the updated extfs-status document (also
attached). There are some clues for repository admin there, labeled
'CVS:'

BTW it would be great if someone with an RPM system could test 'rpms'
and 'trpm' scripts and send any remarks/patches.

Regards
alpha

-- 

  _.|._ |_  _.: Adam Byrtek, alpha@(irc.pl|debian.org)
 (_|||_)| |(_|: gg 1802819, pgp 0xB25952C0
 |: jid alpha.jabberpl.org


MULTIPLE FILES:
fixed error handling: removed 2/dev/null to pass errors to mc
without this if something wrong occurs (for example uzip or awk not exists), 
mc shows only empty archive, there is no error message



a (mtools)
-

DONE: removed error redirection to /dev/null
now you get a message when sth is wrong
works ok

apt
---

DONE: 'millenium bug' parse error fixed
added non-interactive remove using dpkg
tested - works ok


audio
---

DONE: quited mode turned on
track number padded with zeroes (track-1 = track-01)
   (so the tracks are sorted)
tested, works ok

bpp
---
could not test

deb
---

DONE: added note about hard links
install message changed a little
works ok

CVS: somebody should 'mv deb.in deb' - because deb.in
doesn't use any autoconf variables


deba, debd
--

DONE: 'millenium bug' fixed
added note about apt extfs
deba - redirected sterr of command that could fail
debd - LANG=C changed into LC_ALL=C to fix dates
messages changed a little
works ok


dpkg
---

DONE: perl 'millenium bug' fixed


ftplist
---

DONE: date (locale) problem fixed
works ok


hp48
---
could not test


lslR
---

DONE: added export LC_ALL=C


mailfs
---
list: wrong 'file size'
copyout: ok, but with f3 some mails are being trimmed (strange):

From [EMAIL PROTECTED]  Tue Nov 19 09:34:25 2002
Return-Path: [EMAIL PROTECTED]
Delivered-

patchfs
---

works with SIMPLE unified diff right now.

rpm
---
ok

rpms
---
not checked - need somebody with rpm system


trpm
---
not checked - need somebody with rpm system

uar
---
ok

uarj
---
not tested

CVS: mv arj arj.in (uses awk)

ucpio
---
ok

uha
---
not tested

ulha
---
ok

uzip
---
ok

urar
---

DONE: -p arg to 'cp' removed (it breaks permisions)
works ok


uzoo


DONE: 'dirty hack' cleanup (create file in /tmp, not ~/.mc)
works ok



=
TODO LATER:

- audio: add cddb support
- patchfs: rewrite
- fix mailfs


TO TEST:

- rpms
- trpm
- uarj
diff -u extfs/a extfs.alpha/a
--- extfs/a 2002-11-08 19:06:15.0 +0100
+++ extfs.alpha/a   2002-12-08 14:04:24.0 +0100
@@ -29,29 +29,29 @@
   /mkdir/  do {
 shift; shift;
 exit 1 if scalar(@ARGV) != 1;
-system($mmd $disk:/$ARGV[0] /dev/null 21);
+system($mmd $disk:/$ARGV[0] /dev/null);
 exit 0; };
   /rmdir/  do {
 shift; shift;
 exit 1 if scalar(@ARGV) != 1;
-system($mrd $disk:/$ARGV[0] /dev/null 21);
+system($mrd $disk:/$ARGV[0] /dev/null);
 exit 0; };
   /rm/  do {
 shift; shift;
 exit 1 if scalar(@ARGV) != 1;
-system($mdel $disk:/$ARGV[0] /dev/null 21);
+system($mdel $disk:/$ARGV[0] /dev/null);
 exit 0; };
   /copyout/  do {
 shift; shift;
 exit 1 if scalar(@ARGV) != 2;
 ( $src, $dest ) = @ARGV;
-system($mcopy $disk:/$src $dest /dev/null 21);
+system($mcopy $disk:/$src $dest /dev/null);
 exit 0; };
   /copyin/  do {
 shift; shift;
 exit 1 if scalar(@ARGV) != 2;
 ( $dest, $src ) = @ARGV;
-system($mcopy $src $disk:/$dest /dev/null 21);
+system($mcopy $src $disk:/$dest /dev/null);
 exit 0; };
   /.*/  do {   # an unfamiliar command
 exit 1; };
diff -u extfs/apt extfs.alpha/apt
--- extfs/apt   2000-01-03 00:48:55.0 +0100
+++ extfs.alpha/apt 2002-12-08 18:07:39.0 +0100
@@ -11,7 +11,7 @@
 my ($dt) = @_;
 my (@time);
 @time = localtime($dt);
-$bt = sprintf %02d-%02d-%02d %02d:%02d, $time[4], $time[3], $time[5], $time[2], 
$time[1];
+$bt = sprintf %02d-%02d-%02d %02d:%02d, $time[4], $time[3], $time[5]%100, 
+$time[2], $time[1];
 return $bt;
 }
 
@@ -296,13 +296,13 @@
system(rm -f /etc/apt/apt.conf);
 } elsif( $archive eq 'sources.list' ) {
system(rm -f /etc/apt/sources.list);
-# This interact with user - it can't be execute :-(
-#} elsif( $archive =~ /\.deb[ad]?$/ ) {
-#   my $name = $archive;
-#   $name =~ s%.*/%%g;
-#   $name =~ s%_.*%%g;
-#   system(apt-get remove $name);
-#   die(extfs: $archive: Operation not permitted\n) if $? != 0;
+} elsif( $archive =~ /\.debd?$/ ) {
+   # uncommented and changed to use dpkg - alpha
+   my $name = $archive;
+   $name =~ s%.*/%%g;
+   $name =~ s%_.*%%g;
+   system(dpkg --remove $name /dev/null);
+   die(extfs: $archive: Operation not permitted\n) if $? != 0;
 } else {
die extfs: $archive: Operation not permitted\n;
 }
@@ -312,11

Re: extfs cleanup

2002-12-07 Thread Adam Byrtek 'alpha'

Hi. I've spend some more time examining and testing extfs scripts,
because I feel a lot more confortable with simple scripts than with
complicated mc code :)

My results can be found in the attachment. If you have any comments,
feel free to mail me. I'll try to update this list when something gets
fixed.

I think broken scripts could be fixed until next stable release, and
I'm willing to spend my time to work on the issues I've found. Pavel,
could you review my uzoo and urar fixes (earlier in this thread),
please? Tell me which modifications you think are useful, and which
are not, so I won't waste my time on things you don't like.

Regards

-- 

  _.|._ |_  _.: Adam Byrtek, alpha@(irc.pl|debian.org)
 (_|||_)| |(_|: gg 1802819, pgp 0xB25952C0
 |: jid alpha.jabberpl.org

a (mtools)
-
ok

apt
---
list - 'could not parse' error
 (looks like simple to fix)
rest - not tested

audio
---
list - ok
copyout - should set cdparanoia to quiet mode
   (now it prints to stderr even when ripping was ok)
'fixme' by pavel, looks simple to do

bpp
---
could not test

deb
---
works ok
somebody should 'mv deb.in deb' - because deb.in
doesn't use any autoconf variables

deba, debd, dpkg
---
don't work
to be examined deeper

ftplist
---
list: 'could not parse' error

hp48
---
could not test

lslR
---
list: 'could not parse' error

mailfs
---
list: wrong 'file size'
copyout: ok, but with f3 some mails are being trimmed (strange):

From [EMAIL PROTECTED]  Tue Nov 19 09:34:25 2002
Return-Path: [EMAIL PROTECTED]
Delivered-

patchfs
---
useless.
i've modified it to work with unified diffs and it looks good
(there are some problems with context diffs)

rpm
---
ok

rpms
---
'error: cannot open Packages index using db3 - No such file or
directory (2)'
(btw what's the purpose of this extfs?)
 
trpm
---
list: multiple errors
(btw what's the purpose of this extfs?)

uar
---
ok

uarj
---
not tested

ucpio
---
ok

uha
---
not tested

ulha
---
ok

uzip
---
ok

urar, uzoo
---
fixed by me



Re: [PATCH] extfs - do not enter broken archive

2002-12-07 Thread Adam Byrtek 'alpha'
On Sat, Dec 07, 2002 at 05:46:32PM +0100, BARTHAZI Andras wrote:
 really large (100MB) archive, etc. Clearing the cache after recognizing
 the error doesn't works?

It would help indeed. I'll try to do this...

-- 

  _.|._ |_  _.: Adam Byrtek, alpha@(irc.pl|debian.org)
 (_|||_)| |(_|: gg 1802819, pgp 0xB25952C0
 |: jid alpha.jabberpl.org
___
Mc-devel mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/mc-devel



Re: extfs cleanup

2002-12-06 Thread Adam Byrtek 'alpha'

First of all I would like to note, that this is my first contribution
to mc, so I don't know 'how things work' in mc too much.

 release of the next stable version.  I believe the redirection of output
 should be done in the extfs code, not in the scripts.  That's something

Of course - this is simpler and more reliable solution.

 Please make sure to use the CVS version or the current snapshot if you are

I've just downloaded the whole repository.

 Send the patches, not the whole files.  Explain all changes.

Ok. Here it comes (patches attached):

1. I agree with Standa (the next thread) that binary names/paths
shouldn't be set at compile time. Most people use binary packages, and
they may, for example, have mawk, but don't have gawk. I've fixed this
problem by looking in PATH (with type bash builtin) for either awk,
mawk or gawk. 

I think this fixes the problem, and we don't need any additional
variables - if binary isn't in one's PATH - it often simply means
isn't in the system. And no, I didn't have any problems with unzip.

2. Added DEBUG shell var, just for testing purposes.

3. Added die() function, which prints $1 on stderr and exit's with
error code 1.

4. Addedd cmd || die(Error) to any command that could fail.

5. Added binary existence check (with 'type -p binary')

6. Fixed dirty uzoo hack - symlink is no longer created in ~/.mc but
in /tmp which is better place for such file

7. Fixed urar using cp -p which always created files in archive with
perms. 600 (like mc tmp files)


If my fixes are helpful I can work on other extfs'. In fact many on
them are completly broken.


 I believe the reason is because extfs_open() issues copyout even when
 the file is opened with O_TRUNC.  This should be easy to fix.  I'm have 
 added a FIXME to the source.

I'll try to work on this issue - maybe this could teach me a bit of
'mc architecture'.


 You can use stderr for that in the CVS version, just don't write more that
 4 kilobytes.

Ok, I'll try. I was working with 2002-12-04


 I still don't understand why you think list is different from other
 commands when is comes to error reporting.

Sorry, just checked, and it was fixed recently in CVS - now I see nice
error message. That's great.

Regards.


-- 

  _.|._ |_  _.: Adam Byrtek, alpha@(irc.pl|debian.org)
 (_|||_)| |(_|: gg 1802819, pgp 0xB25952C0
 |: jid alpha.jabberpl.org

--- urar.in 2002-08-26 06:44:20.0 +0200
+++ urar2002-12-06 13:49:03.0 +0100
@@ -5,22 +5,24 @@
 # Updated by [EMAIL PROTECTED] 1999
 #Andrew V. Samoilov [EMAIL PROTECTED] 2000
 # beta version 2.0
-#
-DRAR=/usr/bin
-RAR=$DRAR/rar
-UNRAR=$DRAR/unrar # Prefer unrar (freeware)
-#
-# NOTE: rar ver 2.0 by Eugene Roshal
-# ftp.elf.stuba.sk/pub/pc/pack
-#
 
-if [ ! -x $UNRAR -a -x $RAR ]; then
-UNRAR=$RAR
-fi
+# Updated by Adam Byrtek [EMAIL PROTECTED], Dec 2002
+# (error handling, binaries detection, unnecessary output redirected
+# to /dev/null, debug, some cleanups and fixes)
+
+
+#DEBUG=YES
+
+# throw error message to stderr
+die ()
+{
+echo $1 2
+exit 1
+}
 
 mcrarfs_list ()
 {
- $UNRAR v -c- $1 | @AWK@ -v uid=${UID-0} '
+ $UNRAR v -c- $1 | $AWK -v uid=${UID-0} '
 BEGIN { flag=0; date=JanFebMarAprMayJunJulAugSepOctNovDec }
 /^---/ { flag++; if (flag  1) exit 0; next }
 {
@@ -41,62 +43,102 @@
$6=-rw-r--r--
 printf %s   1 %-8d %-8d %8d %3s %2d %4d %s %s\n, $6, uid, 0, $1, substr(date, 
(a[2]-1)*3+1, 3), a[1], a[3], $5, str
 }
-}' 2/dev/null
+}' 2/dev/null || die List: archive error.
 }
 
 mcrarfs_copyin ()
 {
+if [ -z $RAR ]; then
+die Copyin: binary 'rar' not found, sorry.
+fi
+
 # copyin by [EMAIL PROTECTED]
 # preserve pwd. It is clean, but is it necessary?
 pwd=`pwd`
-# Create a directory and copy in it the tmp file with the good name 
-mkdir $3.dir
+# Create a directory and copy in it the tmp file with the good name
+mkdir $3.dir  /dev/null || die Copyin: permision denied.
 cd $3.dir
 di=${2%/*}
 # if file is to be written upper in the archive tree, make fake dir
 if test $di != ${2##*/} ; then
 mkdir -p $di 
 fi
-# (cp -p) to preserve date, but $2 is dated now!
-cp -p $3 $3.dir/$2 
-$RAR a $1 $2 /dev/null
+# (cp -p) to preserve date, but $2 is dated now! [ -p breaks mode - alpha ]
+cp $3 $3.dir/$2 
+$RAR a $1 $2 /dev/null || die Copyin: archive error. Delete $3.dir
 cd $pwd
 rm -rf $3.dir
 }
 
 mcrarfs_copyout ()
 {
-$UNRAR p -c- -inul $1 $2  $3 2/dev/null
+$UNRAR p -c- -inul $1 $2  $3 2/dev/null || die Copyout: archive error.
 }
 
 mcrarfs_mkdir ()
 {
+if [ -z $RAR ]; then
+die Mkdir: binary 'rar' not found, sorry.
+fi
+
 # preserve pwd. It is clean, but is it necessary?
 pwd=`pwd`
 # Create a directory and create in it a tmp directory with the good name 
 dir=tmpdir.${RANDOM}
-mkdir $dir
+mkdir $dir /dev/null || die Mkdir: permision denied.
 cd

[PATCH] Re: extfs cleanup

2002-12-06 Thread Adam Byrtek 'alpha'
On Fri, Dec 06, 2002 at 01:11:40AM -0500, Pavel Roskin wrote:
 I believe the reason is because extfs_open() issues copyout even when
 the file is opened with O_TRUNC.  This should be easy to fix.  I'm have 
 added a FIXME to the source.

Fixed. Patch attached. 

-- 

  _.|._ |_  _.: Adam Byrtek, alpha@(irc.pl|debian.org)
 (_|||_)| |(_|: gg 1802819, pgp 0xB25952C0
 |: jid alpha.jabberpl.org

Index: extfs.c
===
RCS file: /cvs/gnome/mc/vfs/extfs.c,v
retrieving revision 1.62
diff -u -r1.62 extfs.c
--- extfs.c 6 Dec 2002 14:44:51 -   1.62
+++ extfs.c 7 Dec 2002 02:05:54 -
@@ -658,13 +658,14 @@
return NULL;
close (local_handle);
 
-   if (extfs_cmd ( copyout , archive, entry, local_filename)
-!created) {
-   unlink (local_filename);
-   free (local_filename);
-   my_errno = EIO;
-   return NULL;
-   }
+if (!(flags  O_CREAT))
+   if (extfs_cmd ( copyout , archive, entry, local_filename)
+!created) {
+   unlink (local_filename);
+   free (local_filename);
+   my_errno = EIO;
+   return NULL;
+   }
entry-inode-local_filename = local_filename;
 }
 



[BUG] extfs bug

2002-12-06 Thread Adam Byrtek 'alpha'
When I copy file into an archive (tested on urar and uzip extfs) the
file is copied, but when I try to view it, I see:

Cannot view: not a regular file

The problem disappears when I restart mc (I can view the same file
without any problem), so it looks like vfs cache problem.

I tried to examine this issue better, but I lack deeper mc
architecture knowlege.

Regards
alpha

-- 

  _.|._ |_  _.: Adam Byrtek, alpha@(irc.pl|debian.org)
 (_|||_)| |(_|: gg 1802819, pgp 0xB25952C0
 |: jid alpha.jabberpl.org
___
Mc-devel mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/mc-devel



extfs cleanups

2002-12-05 Thread Adam Byrtek 'alpha'
Sorry, I've forgotten to attach the files.

-- 

  _.|._ |_  _.: Adam Byrtek, alpha@(irc.pl|debian.org)
 (_|||_)| |(_|: gg 1802819, pgp 0xB25952C0
 |: jid alpha.jabberpl.org

#! /bin/sh
#
# Written by andrey joukov
# (C) 1996 2:[EMAIL PROTECTED]
# Updated by [EMAIL PROTECTED] 1999
#Andrew V. Samoilov [EMAIL PROTECTED] 2000
# beta version 2.0

# Updated by Adam Byrtek [EMAIL PROTECTED], Dec 2002
# (error handling, binaries detection, unnecessary output redirected
# to /dev/null, debug, some cleanups and fixes)


#DEBUG=YES

# throw error message to stderr
die ()
{
echo $1 2
exit 1
}

mcrarfs_list ()
{
 $UNRAR v -c- $1 | $AWK -v uid=${UID-0} '
BEGIN { flag=0; date=JanFebMarAprMayJunJulAugSepOctNovDec }
/^---/ { flag++; if (flag  1) exit 0; next }
{
if (flag == 0) next
if ( !/ [0-9][0-9]:[0-9][0-9] /) str = $0  # there is no time spec in this line
else {
if (str ~ /^\^/)
str=substr(str, 2)
split($4, a, -)
if (a[3]  50)
a[3] = 2000 + a[3]
else
a[3] = 1900 + a[3]
if (index($6, D) != 0)
$6=drwxr-xr-x
else
if (index($6, .) != 0)
$6=-rw-r--r--
printf %s   1 %-8d %-8d %8d %3s %2d %4d %s %s\n, $6, uid, 0, $1, substr(date, 
(a[2]-1)*3+1, 3), a[1], a[3], $5, str
}
}' 2/dev/null || die List: archive error.
}

mcrarfs_copyin ()
{
if [ -z $RAR ]; then
die Copyin: binary 'rar' not found, sorry.
fi

# copyin by [EMAIL PROTECTED]
# preserve pwd. It is clean, but is it necessary?
pwd=`pwd`
# Create a directory and copy in it the tmp file with the good name
mkdir $3.dir  /dev/null || die Copyin: permision denied.
cd $3.dir
di=${2%/*}
# if file is to be written upper in the archive tree, make fake dir
if test $di != ${2##*/} ; then
mkdir -p $di 
fi
# (cp -p) to preserve date, but $2 is dated now! [ -p breaks mode - alpha ]
cp $3 $3.dir/$2 
$RAR a $1 $2 /dev/null || die Copyin: archive error. Delete $3.dir
cd $pwd
rm -rf $3.dir
}

mcrarfs_copyout ()
{
$UNRAR p -c- -inul $1 $2  $3 2/dev/null || die Copyout: archive error.
}

mcrarfs_mkdir ()
{
if [ -z $RAR ]; then
die Mkdir: binary 'rar' not found, sorry.
fi

# preserve pwd. It is clean, but is it necessary?
pwd=`pwd`
# Create a directory and create in it a tmp directory with the good name 
dir=tmpdir.${RANDOM}
mkdir $dir /dev/null || die Mkdir: permision denied.
cd $dir
mkdir -p $2  
# rar cannot create an empty directory
touch $2/.rarfs
$RAR a -r $1 $2 /dev/null || die Mkdir: archive error. Delete $dir.
$RAR d $1 $2/.rarfs /dev/null || die Mkdir: archive error. Delete $dir.
cd $pwd
rm -rf $dir
}

mcrarfs_rm ()
{
if [ -z $RAR ]; then
die Rm: binary 'rar' not found, sorry.
fi

$RAR d $1 $2 /dev/null || die Rm: archive error
}


# debug
if [ $DEBUG == YES ]; then
echo $0 $1 $2 $3 $4  /tmp/mcdebug
fi

# chceck neccesary binaries
# prefer unrar (freeware)
UNRAR=`type -p unrar`
if [ -z $UNRAR ]; then
UNRAR=`type -p rar`
if [ -z $UNRAR ]; then
die Binary 'rar/unrar' not found, sorry.
fi
fi
RAR=`type -p rar`

AWK=`type -p awk`
if [ -z $AWK ]; then
AWK=`type -p mawk`
if [ -z $AWK ]; then
AWK=`type -p gawk`
if [ -z $AWK ]; then
die Binary 'awk/mawk/gawk' not found, sorry.
fi
fi
fi

umask 077

# uncomment this line for debugging
#echo `date +%T` ${0##*/} $1 $2 to=$3 tmp=$4 /tmp/${0##*/}.log
case $1 in
  list)mcrarfs_list$2; exit 0;;
  rm)  mcrarfs_rm  $2 $3 ; exit 0;;
  rmdir)   mcrarfs_rm  $2 $3 ; exit 0;;
  mkdir)   mcrarfs_mkdir   $2 $3 ; exit 0;;
  copyin)  mcrarfs_copyin  $2 $3 $4; exit 0;;
  copyout) mcrarfs_copyout $2 $3 $4; exit 0;;
esac
exit 1

#! /bin/sh
#
# Zoo file system
# Copyright ? U. N. Known
#
# This filesystem is _dangerous_. It used to create symlinks in filesystem
# with zoo file, it used to happily delete file from your filesystem.
# Now it is 'only' very ugly (it creates temporary files in ~/.mc/

# Updated by Adam Byrtek [EMAIL PROTECTED], Dec 2002
# (error handling, binaries detection, unnecessary output redirected
# to /dev/null, some cleanups and fixes)

#DEBUG=YES

# throw error message to stderr
die ()
{
echo $1 2
exit 1
}

mczoofs_list ()
{
$ZOO l $1 | $AWK -v uid=${UID-0} '
BEGIN { hyphens=0 }
/^---/ { if (hyphens  0) exit 0; hyphens=1; next }
/^[^\ ]/ { next }
{
if (NF  8)
next
if ($8 ~ /^\^/)
$8=substr($8, 2)
if ($6  50)
$6=$6 + 1900
else
$6=$6 + 2000
split($7, a, :)
if ($8 ~ /\/$/)
printf drwxr-xr-x   1 %-8d %-8d %8d %s %2d %4d %02d:%02d %s\n, uid, 0, $1, $5, 
$4, $6, a[1], a[2], $8
else
printf -rw-r--r--   1 %-8d %-8d %8d %s %2d %4d %02d:%02d %s\n, uid, 0, $1, $5, 
$4, $6, a[1], a[2], $8
}' 2/dev/null || die List: archive error.
exit 0
}

mczoofs_copyout ()
{
$ZOO xp $1 $2 | tail +6l  $3  2 /dev/null || die Copyout: archive error