Mercurial > gftp.yaz
diff src/gtk/view_dialog.c @ 422:38bfc112ab46
2004-3-14 Brian Masney <masneyb@gftp.org>
* lib/misc.c (expand_path) - skip over paths that are empty
* lib/misc.c (gftp_sort_filelist) - fixed NULL pointer dereference
that would occur when attempting to sort an empty filelist
(from Hans-J?rgen Sch?ler <hjschaeler@t-online.de>)
* src/uicommon/gftpui.c (_gftpui_common_thread_callback) - fix so that
retries would occur properly after a timeout
(from Nam SungHyun <namsh@kldp.org>)
* src/gtk/Makefile.am - removed unneeded localedir defination
(from Nam SungHyun <namsh@kldp.org>)
* lib/gftp.h lib/protocols.c src/gtk/gftp-gtk.c src/text/gftp-text.c -
added gftp_setup_startup_directory(). This function will expand the
startup directory so that ~ directories will work properly
* lib/rfc959.c - removed invalid response error message if the user
enters an invalid password
* src/gtk/bookmarks.c - only allow one bookmark entry to be edited at a
time. This is a design flaw in my code and I'll remove this restriction
until I have time to recode this. Also, fixed segfault that would occur
when renaming a bookmark
* src/gtk/view_dialog.c - when editing a file, make sure the file has
the right suffix so that syntax highlighting works
author | masneyb |
---|---|
date | Mon, 15 Mar 2004 18:07:15 +0000 |
parents | 57087926bf03 |
children | d469882002d9 |
line wrap: on
line diff
--- a/src/gtk/view_dialog.c Wed Mar 10 17:54:33 2004 +0000 +++ b/src/gtk/view_dialog.c Mon Mar 15 18:07:15 2004 +0000 @@ -97,7 +97,7 @@ gftp_window_data * fromwdata, * towdata; GList * templist, * filelist, * newfile; gftp_file * new_fle; - char *edit_program; + char *edit_program, *suffix; int num; fromwdata = data; @@ -135,9 +135,21 @@ new_fle = copy_fdata (curfle); if (new_fle->destfile) g_free (new_fle->destfile); - new_fle->destfile = g_strconcat (g_get_tmp_dir (), "/gftp-view.XXXXXX", - NULL); - if ((new_fle->fd = mkstemp (new_fle->destfile)) < 0) + + if ((suffix = strrchr (curfle->file, '.')) != NULL) + { + new_fle->destfile = g_strconcat (g_get_tmp_dir (), + "/gftp-view.XXXXXX", suffix, NULL); + new_fle->fd = mkstemps (new_fle->destfile, strlen (suffix)); + } + else + { + new_fle->destfile = g_strconcat (g_get_tmp_dir (), + "/gftp-view.XXXXXX", NULL); + new_fle->fd = mkstemps (new_fle->destfile, 0); + } + + if (new_fle->fd < 0) { ftp_log (gftp_logging_misc, NULL, _("Error: Cannot open %s for writing: %s\n"),