Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
os_rename.c
Package: mysql-4.1.16-win-src.zip [view]
Upload User: romrleung
Upload Date: 2022-05-23
Package Size: 18897k
Code Size: 2k
Category:
MySQL
Development Platform:
Visual C++
- /*-
- * See the file LICENSE for redistribution information.
- *
- * Copyright (c) 1997-2002
- * Sleepycat Software. All rights reserved.
- */
- #include "db_config.h"
- #ifndef lint
- static const char revid[] = "$Id: os_rename.c,v 1.12 2002/07/12 18:56:55 bostic Exp $";
- #endif /* not lint */
- #include "db_int.h"
- /*
- * __os_rename --
- * Rename a file.
- */
- int
- __os_rename(dbenv, oldname, newname, flags)
- DB_ENV *dbenv;
- const char *oldname, *newname;
- u_int32_t flags;
- {
- int ret;
- char oldbuf[MAX_PATH], newbuf[MAX_PATH];
- ret = 0;
- if (DB_GLOBAL(j_rename) != NULL) {
- if (DB_GLOBAL(j_rename)(oldname, newname) == -1)
- ret = __os_get_errno();
- goto done;
- }
- if (!MoveFile(oldname, newname))
- ret = __os_win32_errno();
- if (ret == EEXIST) {
- ret = 0;
- if (__os_is_winnt()) {
- if (!MoveFileEx(
- oldname, newname, MOVEFILE_REPLACE_EXISTING))
- ret = __os_win32_errno();
- } else {
- /*
- * There is no MoveFileEx for Win9x/Me, so we have to
- * do the best we can.
- */
- LPTSTR FilePath;
- if (!GetFullPathName(oldname, sizeof(oldbuf), oldbuf,
- &FilePath) ||
- !GetFullPathName(newname, sizeof(newbuf), newbuf,
- &FilePath)) {
- ret = __os_win32_errno();
- goto done;
- }
- /*
- * If the old and new names differ only in case, we're
- * done.
- */
- if (strcasecmp(oldbuf, newbuf) == 0)
- goto done;
- (void)DeleteFile(newname);
- if (!MoveFile(oldname, newname))
- ret = __os_win32_errno();
- }
- }
- done: if (ret != 0 && flags == 0)
- __db_err(dbenv,
- "Rename %s %s: %s", oldname, newname, strerror(ret));
- return (ret);
- }