/* Tux Commander VFS: VFS utilities * Copyright (C) 2007-2009 Tomas Bzatek * Check for updates on tuxcmd.sourceforge.net * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #include #include "strutils.h" #include "logutils.h" #include "tuxcmd-vfs.h" void copy_vfs_item (struct TVFSItem *src, struct TVFSItem *dst) { memcpy (dst, src, sizeof (struct TVFSItem)); dst->FName = g_strdup (src->FName); dst->FDisplayName = g_strdup (src->FDisplayName); dst->sLinkTo = g_strdup (src->sLinkTo); } void free_vfs_item (struct TVFSItem *item) { if (item) { g_free (item->FName); g_free (item->FDisplayName); g_free (item->sLinkTo); g_free (item); } } /* -------------------------------------------------------------------------------------- */ struct TVFSItem * create_placeholder_item (const char *name, enum TVFSItemType item_type) { struct TVFSItem *data; data = g_malloc0 (sizeof (struct TVFSItem)); data->FName = g_strdup (name); data->FDisplayName = g_strdup (name); data->ItemType = item_type; data->iMode = S_IRWXO + S_IRWXG + S_IRWXU; data->IsLink = FALSE; data->iUID = geteuid (); data->iGID = getegid (); data->m_time = time (NULL); data->c_time = data->m_time; data->a_time = data->m_time; data->iSize = 0; data->iPackedSize = -1; return data; } /* -------------------------------------------------------------------------------------- */ gboolean compare_two_same_files (const char *path1, const char *path2) { char *f1, *f2; gboolean b; f1 = exclude_trailing_path_sep (path1); f2 = exclude_trailing_path_sep (path2); b = (g_strcmp0 (f1, f2) == 0); g_free (f1); g_free (f2); return b; }