From 972271c9e2d16b6cf43263ebe94383c577fa58ea Mon Sep 17 00:00:00 2001 From: Norbert Warmuth Date: Fri, 6 Aug 1999 19:24:04 +0000 Subject: [PATCH] 1999-08-06 Norbert Warmuth * gnome/gconf.h (PORT_STATIC_IN_STRING_FILE_XTIME): new port specific feature. The Gnome edition first calls all string_file functions and then uses the return values of these functions. Therefore additional static buffers in string_file_[acm]time are needed. * src/screen.c (string_file_[amc]time): These three functions use file_date which returns a pointer to a static buffer. In the Gnome edition this buffer has to be coppied to a static buffer which isn't used in the other two functions (Fix Bug #1766). * src/util.c, util.h: Moved some constants to util.h * vfs/tar.c (read_header): Don't segfault when a symlink points to the root directory. 1999-08-04 Norbert Warmuth * src/widget.c (push_history): Add SMB Link to the list of input dialogs where urls are input without vfs prefix. Translate the titles of these input dialogs only once. Removed Gnome specific code because the Gnome edition doesn't use the input history any more. * src/util.c (strip_password): Add /#smb: to the list of urls which might be input with password. --- gnome/ChangeLog | 8 ++++++++ gnome/gconf.h | 1 + src/ChangeLog | 22 ++++++++++++++++++++++ src/screen.c | 18 ++++++++++++++++++ src/util.c | 7 ++----- src/util.h | 5 +++++ src/widget.c | 40 +++++++++++++++++++++++++++++----------- vfs/ChangeLog | 5 +++++ vfs/tar.c | 2 +- 9 files changed, 91 insertions(+), 17 deletions(-) diff --git a/gnome/ChangeLog b/gnome/ChangeLog index 7d2b5b6df..90ffbe93e 100644 --- a/gnome/ChangeLog +++ b/gnome/ChangeLog @@ -1,3 +1,11 @@ +1999-08-06 Norbert Warmuth + + * gconf.h (PORT_STATIC_IN_STRING_FILE_XTIME): new port specific + feature. The Gnome edition first calls all string_file functions + and then uses the return values of these functions. This needs + some static buffers in string_file_[acm]time. Therefore additional + static buffers in string_file_[acm]time are needed. + 1999-08-05 Federico Mena Quintero * gnome-file-property-dialog.c (perm_group_new): Set the correct diff --git a/gnome/gconf.h b/gnome/gconf.h index c25f86057..15e91f036 100644 --- a/gnome/gconf.h +++ b/gnome/gconf.h @@ -36,6 +36,7 @@ #define PORT_WINPUT_DELETES_MARKED 1 #define PORT_LIST_MODE_NAME "gnome_list_mode" #define PORT_LIST_MODE_DEFAULT "icons" +#define PORT_STATIC_IN_STRING_FILE_XTIME 1 #define CLIST_FROM_SW(panel_list) GTK_CLIST (GTK_BIN (panel_list)->child) #define ILIST_FROM_SW(panel_list) GNOME_ICON_LIST (GTK_BIN (panel_list)->child) diff --git a/src/ChangeLog b/src/ChangeLog index 623365acc..7301a7c43 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,25 @@ +1999-08-06 Norbert Warmuth + + * screen.c (string_file_[amc]time): These three functions use + file_date which returns a pointer to a static buffer. In the + Gnome edition this buffer has to be coppied to a static buffer + which isn't used in the other two functions (Fix Bug #1766). + + * util.c, util.h: Moved some constants to util.h + +1999-08-04 Norbert Warmuth + + * widget.c (push_history): Add SMB Link to the list of input dialogs + where urls are input without vfs prefix. + + Translate the titles of these input dialogs only once. + + Removed Gnome specific code because the Gnome edition doesn't use + the input history any more. + + * util.c (strip_password): Add /#smb: to the list of urls which might + be input with password. + 1999-08-03 Norbert Warmuth * poptalloca.h: New file with definitions for alloca. Note: alloca diff --git a/src/screen.c b/src/screen.c index 8355ca71b..c209db131 100644 --- a/src/screen.c +++ b/src/screen.c @@ -267,21 +267,39 @@ string_file_type (file_entry *fe, int len) char * string_file_mtime (file_entry *fe, int len) { +#ifdef PORT_STATIC_IN_STRING_FILE_XTIME + static char timebuf [MAX_I18NTIMELENGTH + 1]; + + return strcpy (timebuf, file_date (fe->buf.st_mtime)); +#else return file_date (fe->buf.st_mtime); +#endif } /* atime */ char * string_file_atime (file_entry *fe, int len) { +#ifdef PORT_STATIC_IN_STRING_FILE_XTIME + static char timebuf [MAX_I18NTIMELENGTH + 1]; + + return strcpy (timebuf, file_date (fe->buf.st_atime)); +#else return file_date (fe->buf.st_atime); +#endif } /* ctime */ char * string_file_ctime (file_entry *fe, int len) { +#ifdef PORT_STATIC_IN_STRING_FILE_XTIME + static char timebuf [MAX_I18NTIMELENGTH + 1]; + + return strcpy (timebuf, file_date (fe->buf.st_ctime)); +#else return file_date (fe->buf.st_ctime); +#endif } /* perm */ diff --git a/src/util.c b/src/util.c index 349113770..0725a9da3 100644 --- a/src/util.c +++ b/src/util.c @@ -350,7 +350,8 @@ strip_password (char *p, int has_prefix) size_t len; } prefixes[] = { {"/#ftp:", 6}, {"/#mc:", 5}, - {"ftp://", 6} + {"ftp://", 6}, + {"/#smb:", 6}, }; char *at, *inner_colon, *dir; int i; @@ -591,10 +592,6 @@ char *load_file (char *filename) short-month-name sizes for different locales */ size_t i18n_checktimelength (void) { -#define MAX_I18NTIMELENGTH 14 -#define MIN_I18NTIMELENGTH 10 -#define STD_I18NTIMELENGTH 12 - size_t length, a, b; char buf [MAX_I18NTIMELENGTH + 1]; time_t testtime = time (NULL); diff --git a/src/util.h b/src/util.h index f3f23627d..d4ce57816 100644 --- a/src/util.h +++ b/src/util.h @@ -84,8 +84,13 @@ void init_uid_gid_cache (void); char *get_group (int); char *get_owner (int); +#define MAX_I18NTIMELENGTH 14 +#define MIN_I18NTIMELENGTH 10 +#define STD_I18NTIMELENGTH 12 + size_t i18n_checktimelength (void); char *file_date (time_t); + char *file_date_pck (time_t); int exist_file (char *name); diff --git a/src/widget.c b/src/widget.c index ea22ff88b..a7020dffa 100644 --- a/src/widget.c +++ b/src/widget.c @@ -1155,11 +1155,28 @@ input_enable_update (WInput *in) update_input (in, 0); } +#define ELEMENTS(a) (sizeof(a)/sizeof(a[0])) + int push_history (WInput *in, char *text) { + static int i18n; + /* input widget where urls with passwords are entered without any + vfs prefix */ + static const char *password_input_fields[] = { + " Link to a remote machine ", + " FTP to machine ", + " SMB link to machine " + }; Hist *new; char *p; + int i; + + if (!i18n) { + i18n = 1; + for (i = 0; i < ELEMENTS(password_input_fields); i++) + password_input_fields[i] = _(password_input_fields[i]); + } for (p = text; *p == ' ' || *p == '\t'; p++); if (!*p) @@ -1177,22 +1194,23 @@ push_history (WInput *in, char *text) new->next = 0; new->prev = in->history; new->text = g_strdup (text); - if (in->history_name){ -#ifdef HAVE_GNOME - if (strcmp (in->history_name + 4, _(" Link to a remote machine ")) == 0 || - strcmp (in->history_name + 4, _(" FTP to machine ")) == 0) -#else - if (strcmp (in->history_name + 3, _(" Link to a remote machine ")) == 0 || - strcmp (in->history_name + 3, _(" FTP to machine ")) == 0) -#endif - strip_password (new->text, 0); - else - strip_password (new->text, 1); + if (in->history_name) { + p = in->history_name + 3; + for (i = 0; i < ELEMENTS(password_input_fields); i++) + if (strcmp (p, password_input_fields[i]) == 0) + break; + if (i < ELEMENTS(password_input_fields)) + strip_password (new->text, 0); + else + strip_password (new->text, 1); } + in->history = new; return 2; } +#undef ELEMENTS + /* Cleans the input line and adds the current text to the history */ void new_input (WInput *in) diff --git a/vfs/ChangeLog b/vfs/ChangeLog index cb20677e0..bb59911be 100644 --- a/vfs/ChangeLog +++ b/vfs/ChangeLog @@ -1,3 +1,8 @@ +1999-08-06 Norbert Warmuth + + * tar.c (read_header): Don't segfault when a symlink points to the + root directory. + 1999-08-01 Norbert Warmuth * vfs.c: Don't close a function definition with "};". SunCC from diff --git a/vfs/tar.c b/vfs/tar.c index a2e6943eb..72b663454 100644 --- a/vfs/tar.c +++ b/vfs/tar.c @@ -318,7 +318,7 @@ read_header (vfs *me, vfs_s_super *archive, int tard) ? next_long_link : g_strdup (header->header.arch_linkname)); len = strlen (current_link_name); - if (len && current_link_name [len - 1] == '/') + if (len > 1 && current_link_name [len - 1] == '/') current_link_name[len - 1] = 0; next_long_link = next_long_name = NULL;