Topic "How to get Winscp to work with Android toolbox"

Author Message
NHskier
[View user's profile]

Joined: 2015-10-09
Posts: 2
Location: Massachusetts
The problem is the format of the ls -l command. The problem is the number of fields is not what Winscp is expecting. The 'link' field is missing and the date is in an iso format which has a different number of fields than the GNU/Linux version. The fix is a simple change to the ls command. Here is my commit to my local repo.

Modify ls command format so that Winscp will work.


diff --git a/toolbox/ls.c b/toolbox/ls.c
index e530521..434e8af 100644
--- a/toolbox/ls.c
+++ b/toolbox/ls.c
@@ -168,6 +168,7 @@ static int listfile_long(const char *path, int flags)
char mode[16];
char user[16];
char group[16];
+ char nlink[16];
const char *name;

/* name is anything after the final '/', or the whole path if none*/
@@ -182,6 +183,8 @@ static int listfile_long(const char *path, int flags)
return -1;
}

+ sprintf(nlink, "%d", s.st_nlink);
+
mode2str(s.st_mode, mode);
if (flags & LIST_LONG_NUMERIC) {
sprintf(user, "%ld", s.st_uid);
@@ -191,7 +194,8 @@ static int listfile_long(const char *path, int flags)
group2str(s.st_gid, group);
}

- strftime(date, 32, "%Y-%m-%d %H:%M", localtime((const time_t*)&s.st_mtime));
+// strftime(date, 32, "%Y-%m-%d %H:%M", localtime((const time_t*)&s.st_mtime));
+ strftime(date, 32, "%b %e %H:%M", localtime((const time_t*)&s.st_mtime));
date[31] = 0;

// 12345678901234567890123456789012345678901234567890123456789012345678901234567890
@@ -200,14 +204,14 @@ static int listfile_long(const char *path, int flags)
switch(s.st_mode & S_IFMT) {
case S_IFBLK:
case S_IFCHR:
- printf("%s %-8s %-8s %3d, %3d %s %s\n",
- mode, user, group,
+ printf("%s %s %-8s %-8s %3d, %3d %s %s\n",
+ mode, nlink, user, group,
(int) MAJOR(s.st_rdev), (int) MINOR(s.st_rdev),
date, name);
break;
case S_IFREG:
- printf("%s %-8s %-8s %8lld %s %s\n",
- mode, user, group, s.st_size, date, name);
+ printf("%s %s %-8s %-8s %8lld %s %s\n",
+ mode, nlink, user, group, s.st_size, date, name);
break;
case S_IFLNK: {
char linkto[256];
@@ -225,13 +229,13 @@ static int listfile_long(const char *path, int flags)
linkto[len] = 0;
}

- printf("%s %-8s %-8s %s %s -> %s\n",
- mode, user, group, date, name, linkto);
+ printf("%s %s %-8s %-8s %8lld %s %s -> %s\n",
+ mode, nlink, user, group, s.st_size, date, name, linkto);
break;
}
default:
- printf("%s %-8s %-8s %s %s\n",
- mode, user, group, date, name);
+ printf("%s %s %-8s %-8s %8lld %s %s\n",
+ mode, nlink, user, group, s.st_size, date, name);

}
return 0;
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25015
Location: Prague, Czechia
Do you have this problem with SCP protocol? Or also with SFTP?
NHskier
[View user's profile]

Joined: 2015-10-09
Posts: 2
Location: Massachusetts
I have the problem with scp. I don't have sftp setup on my device.

Regards,
Mike
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License