[PATCH]: Locale's abbreviated month vfs

2003-01-31 Thread Andrew V. Samoilov
Hello!

There are some localised ftp-servers in the wild, and their output with 
locale's abbreviated months confuses mc's parser.

Below is a small patch to treat such dates as Jan 1 1970.

--
Regards,
Andrew V. Samoilov
ChangeLog:

* vfs.c (is_localized_month): New function for locale's
abbreviated month name as any 3 bytes long string without digits
and control characters.
(vfs_parse_filedate): Fallback to is_localized_month() if
is_month() and is_dos_date() fail and set date to Jan 1 1970.
(vfs_parse_ls_lga): Use is_localized_month().

--- vfs/vfs.c   Sun Dec 29 09:30:35 2002
+++ vfs/vfs.c   Fri Jan 31 11:33:39 2003
@@ -1392,8 +1392,26 @@ is_month (char *str, struct tm *tim)
 return 0;
 }
 
+/*
+ * Locale's abbreviated month name (Jan..Dec).
+ * Any 3 bytes long string without digits and control characters.
+ * isalpha() is locale specific, so it cannot be used if current
+ * locale is C and ftp server use Cyrrilic.
+ * TODO: Punctuation characters also cannot be part of month name.
+ */
 static int
-is_time (char *str, struct tm *tim)
+is_localized_month (const unsigned char *month)
+{
+int i = 0;
+while ((i  3)  *month  !isdigit (*month)  !iscntrl (*month)) {
+   i++;
+   month++;
+}
+return ((i == 3)  (*month == 0));
+}
+
+static int
+is_time (const char *str, struct tm *tim)
 {
 char *p, *p2;
 
@@ -1540,6 +1558,7 @@ vfs_parse_filedate (int idx, time_t *t)
 struct tm tim;
 int d[3];
 int got_year = 0;
+int l10n = 0;  /* Locale's abbreviated month name */
 
 /* Let's setup default time values */
 tim.tm_year = current_year;
@@ -1599,8 +1618,13 @@ vfs_parse_filedate (int idx, time_t *t)
got_year = 1;
} else
return 0;   /* sscanf failed */
-   } else
-   return 0;   /* unsupported format */
+   } else {
+   /* Locale's abbreviated month name followed by day number */
+   if (is_localized_month (p)  (is_num (idx++)))
+   l10n = 1;
+   else
+   return 0;   /* unsupported format */
+   }
 }
 
 /* Here we expect to find time and/or year */
@@ -1635,7 +1659,7 @@ vfs_parse_filedate (int idx, time_t *t)
 
tim.tm_year--;
 
-if ((*t = mktime (tim))  0)
+if (l10n || (*t = mktime (tim))  0)
*t = 0;
 return idx;
 }
@@ -1691,17 +1715,18 @@ vfs_parse_ls_lga (const char *p, struct 
 s-st_uid = (uid_t) atol (columns [1]);
 
 /* Mhm, the ls -lg did not produce a group field */
-for (idx = 3; idx = 5; idx++) 
-if (is_month(columns [idx], NULL) || is_week(columns [idx], NULL) || 
is_dos_date(columns[idx]))
-break;
+for (idx = 3; idx = 5; idx++)
+   if (is_month (columns[idx], NULL) || is_week (columns[idx], NULL)
+   || is_dos_date (columns[idx]) || is_localized_month (columns[idx]))
+   break;
 
 if (idx == 6 || (idx == 5  !S_ISCHR (s-st_mode)  !S_ISBLK (s-st_mode)))
goto error;
 
-/* We don't have gid */
+/* We don't have gid */
 if (idx == 3 || (idx == 4  (S_ISCHR(s-st_mode) || S_ISBLK (s-st_mode
 idx2 = 2;
-else { 
+else {
/* We have gid field */
if (is_num (2))
s-st_gid = (gid_t) atol (columns [2]);



Highlighting trailing spaces

2003-01-31 Thread Pavel Roskin
Hello, Andrew!

I have noticed that you added highlighting for trailing spaces in C.  I
believe that your patch should be reverted, at least for the 4.6.0
release.  I don't want to see it reported like a bug.

Some people (myself included) use the internal editor to read other
people's code.  I don't want to fix minor sloppiness in the code I didn't
write.  Highlighting for trailing spaces reduces readability of the code.
If my job is to fix a bug and submit a minimal patch to the author, the
red tails will distract me from my job.

From the mcedit manual:

   Also remember that the aim of syntax highlighting is to make
   programming less prone to error, not to make code look pretty.

I would also add not to enforce formatting rules.  It's annoying and
should be applied only to the person who is fully in control of the code.
mcedit just cannot do it.

That's my opinion, but I'd like to hear from other developers.  I'm
leaving the patch in CVS for now, but I'll remove it before the release
unless somebody comes with serious arguments in favor of keeping it.

-- 
Regards,
Pavel Roskin
___
Mc-devel mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/mc-devel



Re: [PATCH] aclocal.m4: Enable configure to detect the presence ofterminfo database on OpenBSD

2003-01-31 Thread Pavel Roskin
Hello!

  I don't understand what exactly your patch supposed to fix.  What is the
  problem?  Have you tested your patch?  Does the problem go away?

 Yes, the problem goes away. If it's not clear the problem is that
 configure doesn't detect the presence of terminfo database on OpenBSD thus
 thinking that terminfo is not available at all and this is not true.

OK, then it's not a problem, because configure does the right thing.

 I admit that I didn't knew how S-Lang interfaces with the terminfo database
 before I browsed through the code today. However, IMHO, what is
 incompatible here is the S-Lang library itself - there are a couple of
 routines which deal with the terminfo database and if S-Lang used them
 instead of emulating them everything would be fine.

Are those functions in the curses library?  You can ask in the S-Lang
mailing list, but I think it will be easier to reimplement those functions
rather than link to -lcurses.  S-Lang used to depend on -lcurses in the
past on some UNIX systems, but this dependency was later eliminated.

-- 
Regards,
Pavel Roskin
___
Mc-devel mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/mc-devel



Re: rpm --nosignature

2003-01-31 Thread Pavel Roskin
Hello!

  I think that mc.ext should become a script some day.  It would either
  run something itself or it would return a command (like %view) back to
  mc. It would be easier to write such rules without having to put them
  on one line.

 May be it worth the efforts to implement multiline support there with \
   as last character at end of line, just like bash and C.

Yes.  I think we can simply rewrite consecutive backslash and newline with
two spaces in regex_command() without moving data.  It can even be done
immediately after loading the data, before the huge loop.

 I don't like idea with script.  As for me it will be difficult to
 implement this in shell, and I will complain about perl.

You don't like Perl?  OK, we'll see how far we can go before some radical
changes become necessary.

 BTW, mc.ext's Include feature is not documented in manual, as far as
 Charset Conversion. Walery Studennikov will be in army soon, so he has
 more vital tasks now ;-(

I've added Include.

I think the charset support will become default soon, maybe even in 4.6.1.
The dialog needs to be redesigned.  Ctrl-T should be in the menu.  The
documentation will be added.

Best luck to Walery.

-- 
Regards,
Pavel Roskin
___
Mc-devel mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/mc-devel



Re: [PATCH] dotdot in the root directory

2003-01-31 Thread Jaroslaw Swierczynski
Whatever you decide, I've fixed the patches so they work very well, and
they are available under the following links for those who are interested.

http://www.intersec.pl/~swiergot/mc-4.6.0-pre3-dotdot-in-rootdir.pw.patch.gz
http://www.intersec.pl/~swiergot/mc-4.6.0-pre3-dotdot-in-rootdir-mc-pot.pw.patch.gz
http://www.intersec.pl/~swiergot/mc-4.6.0-pre3-dotdot-in-rootdir-pl-po.pw.patch.gz

-- 

   [ -- Live Long And Prosper !!! -- ]
   [   Jaroslaw Swierczynski  [EMAIL PROTECTED]   ]
   [ RLU: 207395 GG: 1834439 JID: [EMAIL PROTECTED] ]
   [  Slackware Linux. Join the revolution.  ]
___
Mc-devel mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/mc-devel



hotkeys in hotlist patch submitted

2003-01-31 Thread bulia byak
I just submitted a big patch for hotlist.c to savannah.gnu.org:

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

It's against pre3 but not for inclusion in 4.6.0 release, maybe a next version.

Please test it and report your experience. It works for me but I'm not sure I did 
not mess something up. 
-- 
__
Sign-up for your own FREE Personalized E-mail at Mail.com
http://www.mail.com/?sr=signup

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