Re: More on tilde expansion
- From: Leonard den Ottolander <leonard den ottolander nl>
- To: MC Devel <mc-devel gnome org>
- Subject: Re: More on tilde expansion
- Date: Wed, 15 Sep 2004 15:12:43 +0200
Hello Jakub,
On Wed, 2004-09-15 at 14:44, Jakub Jelinek wrote:
> + g_free (orig_mask);
> + char *tmpdest = dest_dir;
> + dest_dir = tilde_expand(tmpdest);
> + g_free(tmpdest);
>
> Unless ISO C99 compiler is required to build mc, char *tmpdest; either
> needs to go up, or you need to add {} around the 3 lines that reference
> tmpdest.
Ok. Fixed by moving the declaration to the top.
Leonard.
--
mount -t life -o ro /dev/dna /genetic/research
--- src/filegui.c.000 2004-09-03 14:40:08.000000000 +0200
+++ src/filegui.c 2004-09-15 15:11:06.000000000 +0200
@@ -852,7 +852,7 @@ file_mask_dialog (FileOpContext *ctx, Fi
const char *def_text, int only_one, int *do_background)
{
int source_easy_patterns = easy_patterns;
- char *source_mask, *orig_mask, *dest_dir;
+ char *source_mask, *orig_mask, *dest_dir, *tmpdest;
const char *error;
struct stat buf;
int val;
@@ -914,8 +914,7 @@ file_mask_dialog (FileOpContext *ctx, Fi
orig_mask = source_mask;
if (!dest_dir || !*dest_dir) {
- if (source_mask)
- g_free (source_mask);
+ g_free (source_mask);
return dest_dir;
}
if (source_easy_patterns) {
@@ -935,18 +934,18 @@ file_mask_dialog (FileOpContext *ctx, Fi
if (error) {
message (1, MSG_ERROR, _("Invalid source pattern `%s' \n %s "),
orig_mask, error);
- if (orig_mask)
- g_free (orig_mask);
+ g_free (orig_mask);
goto ask_file_mask;
}
- if (orig_mask)
- g_free (orig_mask);
+ g_free (orig_mask);
+ tmpdest = dest_dir;
+ dest_dir = tilde_expand(tmpdest);
+ g_free(tmpdest);
ctx->dest_mask = strrchr (dest_dir, PATH_SEP);
if (ctx->dest_mask == NULL)
ctx->dest_mask = dest_dir;
else
ctx->dest_mask++;
- orig_mask = ctx->dest_mask;
if (!*ctx->dest_mask
|| (!ctx->dive_into_subdirs && !is_wildcarded (ctx->dest_mask)
&& (!only_one
@@ -957,8 +956,9 @@ file_mask_dialog (FileOpContext *ctx, Fi
&& S_ISDIR (buf.st_mode)))))
ctx->dest_mask = g_strdup ("*");
else {
- ctx->dest_mask = g_strdup (ctx->dest_mask);
- *orig_mask = 0;
+ ctx->dest_mask = g_strdup(ctx->dest_mask);
+ g_free(dest_dir);
+ dest_dir = g_strdup ("./");
}
if (!*dest_dir) {
g_free (dest_dir);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]