+/* vim: set noexpandtab tabstop=4 shiftwidth=4:
+ *----------------------------------------------------------------------------
+ * 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: jue abr 8 18:07:57 ART 2004
+ * Autores: Nicolás Dimov <sagardua@uolsinectis.com.ar>
+ * Leandro Lucarella <llucare@fi.uba.ar>
+ *----------------------------------------------------------------------------
+ *
+ * $Id$
+ *
+ */
+
+/** \file
+ *
+ * Manejo de archivos de índices de registros borrados (reutilizables).
+ *
+ * Implementación del manejo de archivos de índices de registros borrados
+ * (reutilizables).
+ *
+ */
+
#include "did.h"
+#include <string.h>
+#include <unistd.h>
+
+int emufs_did_crear(EMUFS* efs)
+{
+ return emufs_crear_archivo_auxiliar(efs->nombre, EMUFS_DID_EXT);
+}
int emufs_did_get_last(EMUFS *emu)
{
char name_f_did[255];
strcpy(name_f_did, emu->nombre);
- strcat(name_f_did, ".did");
+ strcat(name_f_did, EMUFS_DID_EXT);
if ( (f_did = fopen(name_f_did,"r")) == NULL) return -1; /*ERROR*/
fseek(f_did, 0, SEEK_END);
}
return id;
}
+
+/*agrego un elemento al archivo */
+int emufs_did_agregar(EMUFS *emu, int ID)
+{
+ FILE *f_did;
+ char name_f_did[255];
+
+ strcpy(name_f_did, emu->nombre);
+ strcat(name_f_did, EMUFS_DID_EXT);
+
+ if ( (f_did = fopen(name_f_did,"a+")) == NULL) return -1;
+ fwrite(&ID, sizeof(int), 1, f_did);
+ fclose(f_did);
+
+ return 0;
+}