diff options
author | Valaris <Valaris@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-01-29 16:00:45 +0000 |
---|---|---|
committer | Valaris <Valaris@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-01-29 16:00:45 +0000 |
commit | a2675f07d7da22a7c6ae11f545bf8f671e785a82 (patch) | |
tree | 4b825dc642cb6eb9a060e54bf8d69288fbee4904 /src/common/lock.c | |
parent | b8801ae9585201eaaf9fdf80d9c7117ee18f52e2 (diff) | |
download | hercules-a2675f07d7da22a7c6ae11f545bf8f671e785a82.tar.gz hercules-a2675f07d7da22a7c6ae11f545bf8f671e785a82.tar.bz2 hercules-a2675f07d7da22a7c6ae11f545bf8f671e785a82.tar.xz hercules-a2675f07d7da22a7c6ae11f545bf8f671e785a82.zip |
Clearing trunk.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@5091 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/common/lock.c')
-rw-r--r-- | src/common/lock.c | 55 |
1 files changed, 0 insertions, 55 deletions
diff --git a/src/common/lock.c b/src/common/lock.c deleted file mode 100644 index 0258cbd2c..000000000 --- a/src/common/lock.c +++ /dev/null @@ -1,55 +0,0 @@ - -#include <stdio.h> -#include <errno.h> -#include <string.h> -#ifndef WIN32 -#include <unistd.h> -#else -#include <windows.h> -#define F_OK 0x0 -#define R_OK 0x4 -#endif -#include "lock.h" -#include "showmsg.h" -#define exists(filename) (!access(filename, F_OK)) - -// �������݃t�@�C���̕ی쏈�� -// �i�������݂��I���܂ŁA���t�@�C����ۊǂ��Ă����j - -// �V�����t�@�C���̏������݊J�n -FILE* lock_fopen (const char* filename, int *info) { - char newfile[512]; - FILE *fp; - int no = 0; - - // ���S�ȃt�@�C������i�蔲���j - do { - sprintf(newfile, "%s_%04d.tmp", filename, ++no); - } while((fp = fopen(newfile,"r")) && (fclose(fp), no < 9999)); - *info = no; - return fopen(newfile,"w"); -} - -// ���t�@�C�����폜���V�t�@�C�������l�[�� -int lock_fclose (FILE *fp, const char* filename, int *info) { - int ret = 1; - char newfile[512]; - char oldfile[512]; - if (fp != NULL) { - ret = fclose(fp); - sprintf(newfile, "%s_%04d.tmp", filename, *info); - sprintf(oldfile, "%s.bak", filename); // old backup file - - if (exists(oldfile)) remove(oldfile); // remove backup file if it already exists - rename (filename, oldfile); // backup our older data instead of deleting it - - // ���̃^�C�~���O�ŗ�����ƍň��B - if ((ret = rename(newfile,filename)) != 0) { // rename our temporary file to its correct name - sprintf(tmp_output,"%s - '"CL_WHITE"%s"CL_RESET"'\n", strerror(errno), newfile); - ShowError(tmp_output); - } - } - - return ret; -} - |