Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

NHskier

I have the problem with scp. I don't have sftp setup on my device.

Regards,
Mike
martin

Re: How to get Winscp to work with Android toolbox

Do you have this problem with SCP protocol? Or also with SFTP?
NHskier

How to get Winscp to work with Android toolbox

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;