3 * Copyleft (C) 2002 Zachary Bedell <aramis@adirondack.net>
4 * Based on ftpsys_unix.cpp which is:
5 * Copyright (C) 2002 Florin Malita <mali@go.ro>
7 * This file is part of LUFS, a free userspace filesystem implementation.
8 * See http://lufs.sourceforge.net/ for updates.
10 * LUFS is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * LUFS is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
32 #include <sys/types.h>
41 #include <lufs/proto.h>
45 #include "ftpsys_windows.h"
49 while( (*c != ' ') && (*c != 0))
59 ftpsys_windows::ftpsys_windows(){
60 CMD_LIST = "LIST -al";
63 ftpsys_windows::~ftpsys_windows(){
68 ftpsys_windows::parse_line(char *buf, char *file, struct lufs_fattr *fattr, char *link, struct credentials *cred){
69 unsigned long size = 0;
73 char sDate[20], sTime[20], datetime[40];
75 *file = *link = sDate[0] = sTime[0] = datetime[0] = 0;
77 if(tolower(buf[25]) == 'd') {
78 res = sscanf(buf, "%8s %7s %*5s %1024s", sDate, sTime, file);
80 res = sscanf(buf, "%8s %7s %lu %1024s", sDate, sTime, &size, file);
84 TRACE("could only match "<<res<<" attributes");
88 sprintf(datetime, "%s %s", sDate, sTime);
94 strptime(datetime, "%m-%e-%y %I:%M%p", &tm);
96 memset(fattr, 0, sizeof(struct lufs_fattr));
102 fattr->f_size = size;
103 fattr->f_ctime = fattr->f_mtime = fattr->f_atime = mktime(&tm);
105 if(tolower(buf[25]) == 'd') fattr->f_mode = S_IFDIR;
106 else fattr->f_mode = S_IFREG;
108 fattr->f_mode |= S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IWGRP | S_IXGRP | S_IROTH | S_IWOTH | S_IXOTH;
110 TRACE("file: " << file<<", link: " << link);