#include "mysys_priv.h"#include <my_dir.h>#include <m_string.h>#include "mysys_err.h"Include dependency graph for my_redel.c:

Go to the source code of this file.
Classes | |
| struct | utimbuf |
Defines | |
| #define | REDEL_EXT ".BAK" |
Functions | |
| int | my_redel (const char *org_name, const char *tmp_name, myf MyFlags) |
| int | my_copystat (const char *from, const char *to, int MyFlags) |
| #define REDEL_EXT ".BAK" |
| int my_copystat | ( | const char * | from, | |
| const char * | to, | |||
| int | MyFlags | |||
| ) |
Definition at line 77 of file my_redel.c.
References utimbuf::actime, EE_LINK_WARNING, EE_STAT, errno, ME_BELL, ME_WAITTANG, utimbuf::modtime, MY_COPYTIME, my_errno, my_error(), MY_FAE, MY_LINK_WARNING, MY_WME, MYF, S_IFMT, and VOID.
Referenced by compress(), and my_redel().
00078 { 00079 struct stat statbuf; 00080 00081 if (stat((char*) from, &statbuf)) 00082 { 00083 my_errno=errno; 00084 if (MyFlags & (MY_FAE+MY_WME)) 00085 my_error(EE_STAT, MYF(ME_BELL+ME_WAITTANG),from,errno); 00086 return -1; /* Can't get stat on input file */ 00087 } 00088 if ((statbuf.st_mode & S_IFMT) != S_IFREG) 00089 return 1; 00090 VOID(chmod(to, statbuf.st_mode & 07777)); /* Copy modes */ 00091 00092 #if !defined(__WIN__) && !defined(__NETWARE__) 00093 if (statbuf.st_nlink > 1 && MyFlags & MY_LINK_WARNING) 00094 { 00095 if (MyFlags & MY_LINK_WARNING) 00096 my_error(EE_LINK_WARNING,MYF(ME_BELL+ME_WAITTANG),from,statbuf.st_nlink); 00097 } 00098 VOID(chown(to, statbuf.st_uid, statbuf.st_gid)); /* Copy ownership */ 00099 #endif /* !__WIN__ && !__NETWARE__ */ 00100 00101 #ifndef VMS 00102 #ifndef __ZTC__ 00103 if (MyFlags & MY_COPYTIME) 00104 { 00105 struct utimbuf timep; 00106 timep.actime = statbuf.st_atime; 00107 timep.modtime = statbuf.st_mtime; 00108 VOID(utime((char*) to, &timep));/* Update last accessed and modified times */ 00109 } 00110 #else 00111 if (MyFlags & MY_COPYTIME) 00112 { 00113 time_t time[2]; 00114 time[0]= statbuf.st_atime; 00115 time[1]= statbuf.st_mtime; 00116 VOID(utime((char*) to, time));/* Update last accessed and modified times */ 00117 } 00118 #endif 00119 #endif 00120 return 0; 00121 } /* my_copystat */
Here is the call graph for this function:

Here is the caller graph for this function:

| int my_redel | ( | const char * | org_name, | |
| const char * | tmp_name, | |||
| myf | MyFlags | |||
| ) |
Definition at line 43 of file my_redel.c.
References DBUG_ENTER, DBUG_PRINT, DBUG_RETURN, error, fn_format(), FN_REFLEN, get_date(), my_copystat(), my_delete(), MY_REDEL_MAKE_BACKUP, my_rename(), REDEL_EXT, strend(), and strmov().
Referenced by change_to_newfile(), compress(), and convert_file().
00044 { 00045 int error=1; 00046 DBUG_ENTER("my_redel"); 00047 DBUG_PRINT("my",("org_name: '%s' tmp_name: '%s' MyFlags: %d", 00048 org_name,tmp_name,MyFlags)); 00049 00050 if (my_copystat(org_name,tmp_name,MyFlags) < 0) 00051 goto end; 00052 if (MyFlags & MY_REDEL_MAKE_BACKUP) 00053 { 00054 char name_buff[FN_REFLEN+20]; 00055 char ext[20]; 00056 ext[0]='-'; 00057 get_date(ext+1,2+4,(time_t) 0); 00058 strmov(strend(ext),REDEL_EXT); 00059 if (my_rename(org_name, fn_format(name_buff, org_name, "", ext, 2), 00060 MyFlags)) 00061 goto end; 00062 } 00063 else if (my_delete(org_name,MyFlags)) 00064 goto end; 00065 if (my_rename(tmp_name,org_name,MyFlags)) 00066 goto end; 00067 00068 error=0; 00069 end: 00070 DBUG_RETURN(error); 00071 } /* my_redel */
Here is the call graph for this function:

Here is the caller graph for this function:

1.4.7

