+/* vim: set noexpandtab tabstop=4 shiftwidth=4 wrap:
+ *----------------------------------------------------------------------------
+ * emufs
+ *----------------------------------------------------------------------------
+ * This file is part of emufs.
+ *
+ * emufs 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.
+ *
+ * emufs 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 emufs; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ *----------------------------------------------------------------------------
+ * Creado: dom abr 18 13:28:44 ART 2004
+ * Autores: Leandro Lucarella <llucare@fi.uba.ar>
+ *----------------------------------------------------------------------------
+ *
+ * $Id$
+ *
+ */
+
+/** \file
+ *
+ * Funciones para uso común de los tipos de archivo de EMUFS.
+ *
+ */
+
+#include "common.h"
+#include "error.h"
+#include <stdio.h>
+
+long emufs_common_get_file_size(const char* filename, int* err)
+{
+ FILE* file;
+ long file_size;
+
+ if (!(file = fopen(filename, "ab"))) {
+ PERR("Error al abrir archivo");
+ *err = EMUFS_ERROR_CANT_OPEN_FILE;
+ return 0;
+ }
+ file_size = ftell(file);
+ fclose(file);
+ if (file_size < 0) {
+ PERR("Error al obtener posición del archivo");
+ *err = EMUFS_ERROR_TELL_FILE;
+ return 0;
+ }
+ return file_size;
+}
+