Re: pscp ls --time-style=long-iso display
From: all mail refused (elvis_at_notatla.org.uk)
Date: 12/24/04
- Next message: Richard E. Silverman: "Re: scp from cron fails"
- Previous message: manu: "pscp ls --time-style=long-iso display"
- In reply to: manu: "pscp ls --time-style=long-iso display"
- Next in thread: manu: "Re: pscp ls --time-style=long-iso display"
- Reply: manu: "Re: pscp ls --time-style=long-iso display"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: 24 Dec 2004 00:30:01 GMT
In article <1103828175.872895.167990@z14g2000cwz.googlegroups.com>, manu wrote:
>This gives the following output.
>-rw-r--r-- 258048 Jul 9 14:15 TTFILE00-3165
>I am trying to modify the code of pscp to manage to send the
>Apparently pscp uses a ssh code (SSH_FXP_OPENDIR 11) to ask the server
>to execute a ls.
Don't know. Code to do "ls" type stuff looks sometjing like this
If you haven't already got this in your server try adding it as
well as or instead of the SSH_FXP_OPENDIR you've noticed.
#include <dirent.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <time.h>
#include <unistd.h>
int longlisting(char *d)
{
DIR *dh;
int ld;
char *dn;
char ldn[2048];
struct dirent *de;
struct stat sb;
time_t t;
struct tm *bt;
if (!d) return (-1);
ld=strlen(d);
dh=opendir(d);
if (!dh) return (-1);
while ( (de=readdir(dh)) ) {
dn= de->d_name;
if ( ((int)ld + (int)strlen(dn) ) > 2000 ) {
/* avoid buffer overflows */
fprintf(stderr, "LONG NAME - QUITTING\n");
break;
}
sprintf(ldn, "%s/%s", d, de->d_name);
if (0 != lstat(ldn, &sb)) {
perror("lstat() failed:");
break;
}
while (1) {
if (S_ISREG(sb.st_mode)) {printf("-"); break;}
if (S_ISDIR(sb.st_mode)) {printf("d"); break;}
if (S_ISLNK(sb.st_mode)) {printf("l"); break;}
printf("?"); break;
}
/* XXX Number wants converting to rwxrwxrwx, style */
printf("%0o ", sb.st_mode & ~S_IFMT);
printf("%12d ", sb.st_size);
t=sb.st_mtime;
bt=localtime(&t);
printf("%04d-%02d-%02d %02d:%02d:%02d ",
1900+bt->tm_year, 1+bt->tm_mon, bt->tm_mday,
bt->tm_hour, bt->tm_min, bt->tm_sec );
printf("%s\n", dn );
}
closedir(dh);
}
int main()
{
longlisting("/etc");
exit(0);
}
-- Elvis Notargiacomo master AT barefaced DOT cheek http://www.notatla.org.uk/goen/ 7.031: OnACPower returned value( 0x1 ) which is Equal To 0x1
- Next message: Richard E. Silverman: "Re: scp from cron fails"
- Previous message: manu: "pscp ls --time-style=long-iso display"
- In reply to: manu: "pscp ls --time-style=long-iso display"
- Next in thread: manu: "Re: pscp ls --time-style=long-iso display"
- Reply: manu: "Re: pscp ls --time-style=long-iso display"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|