and README is a file.
-Erik
+0.41
+ * Fixed a bug in both cp and mv preventing 'cp foo/README bar'
+ type commands (file in a directory to another directory)
+ from working.
+
+ -Erik Andersen,
+
0.40
* New Apps: sort, uniq. -beppu
* New Apps: lsmod, rmmod -erik
# Comment out the following to make a debuggable build
# Leave this off for production use.
-DODEBUG=false
+DODEBUG=true
# If you want a static binary, turn this on. I can't think
# of many situations where anybody would ever want it static,
# but...
static int fileAction(const char *fileName, struct stat* statbuf)
{
char newdestName[NAME_MAX];
+ char* newsrcName = NULL;
strcpy(newdestName, destName);
if ( srcDirFlag == TRUE ) {
if (newdestName[strlen(newdestName)-1] != '/' ) {
strcat(newdestName, "/");
}
- strcat(newdestName, srcName);
+ newsrcName = strrchr(srcName, '/');
+ if (newsrcName && *newsrcName != '\0')
+ strcat(newdestName, newsrcName);
+ else
+ strcat(newdestName, srcName);
}
return (copyFile(fileName, newdestName, preserveFlag, followLinks));
static int fileAction(const char *fileName, struct stat* statbuf)
{
char newdestName[NAME_MAX];
+ char* newsrcName = NULL;
strcpy(newdestName, destName);
if ( srcDirFlag == TRUE ) {
if (newdestName[strlen(newdestName)-1] != '/' ) {
strcat(newdestName, "/");
}
- strcat(newdestName, srcName);
+ newsrcName = strrchr(srcName, '/');
+ if (newsrcName && *newsrcName != '\0')
+ strcat(newdestName, newsrcName);
+ else
+ strcat(newdestName, srcName);
}
return (copyFile(fileName, newdestName, TRUE, TRUE));
static int fileAction(const char *fileName, struct stat* statbuf)
{
char newdestName[NAME_MAX];
+ char* newsrcName = NULL;
strcpy(newdestName, destName);
if ( srcDirFlag == TRUE ) {
if (newdestName[strlen(newdestName)-1] != '/' ) {
strcat(newdestName, "/");
}
- strcat(newdestName, srcName);
+ newsrcName = strrchr(srcName, '/');
+ if (newsrcName && *newsrcName != '\0')
+ strcat(newdestName, newsrcName);
+ else
+ strcat(newdestName, srcName);
}
return (copyFile(fileName, newdestName, preserveFlag, followLinks));
static int fileAction(const char *fileName, struct stat* statbuf)
{
char newdestName[NAME_MAX];
+ char* newsrcName = NULL;
strcpy(newdestName, destName);
if ( srcDirFlag == TRUE ) {
if (newdestName[strlen(newdestName)-1] != '/' ) {
strcat(newdestName, "/");
}
- strcat(newdestName, srcName);
+ newsrcName = strrchr(srcName, '/');
+ if (newsrcName && *newsrcName != '\0')
+ strcat(newdestName, newsrcName);
+ else
+ strcat(newdestName, srcName);
}
return (copyFile(fileName, newdestName, TRUE, TRUE));