|
|
| version 1.3, 2001/05/17 19:33:33 | version 1.14.2.3, 2003/02/04 12:08:56 |
|---|---|
| Line 1 | Line 1 |
| /** @file | /** @file |
| Parser: directory scanning for different OS-es. | Parser: directory scanning for different OS-es. |
| Copyright (c) 2000,2001 ArtLebedev Group (http://www.artlebedev.com) | Copyright (c) 2000,2001-2003 ArtLebedev Group (http://www.artlebedev.com) |
| Author: Alexandr Petrosian <paf@design.ru> (http://paf.design.ru) | |
| Author: Alexander Petrosyan <paf@design.ru> (http://design.ru/paf) | |
| $Id$ | |
| */ | */ |
| #include "pa_dir.h" | static const char* IDENT_DIR_C="$Date$"; |
| #include "pa_common.h" | #include "pa_common.h" |
| #include "pa_dir.h" | |
| #ifdef WIN32 | #ifdef WIN32 |
| bool findfirst(const char *_pathname, struct ffblk *_ffblk, int _attrib) { | bool findfirst(const char* _pathname, struct ffblk *_ffblk, int _attrib) { |
| char mask[MAXPATH]; | char mask[MAXPATH]; |
| snprintf(mask, MAXPATH, "%s/*.*", _pathname); | snprintf(mask, MAXPATH, "%s/*.*", _pathname); |
| Line 30 void findclose(struct ffblk *_ffblk) { | Line 29 void findclose(struct ffblk *_ffblk) { |
| #else | #else |
| bool findfirst(const char *_pathname, struct ffblk *_ffblk, int _attrib) { | bool findfirst(const char* _pathname, struct ffblk *_ffblk, int _attrib) { |
| strncpy(_ffblk->filePath, _pathname, MAXPATH); | strncpy(_ffblk->filePath, _pathname, MAXPATH-1); _ffblk->filePath[MAXPATH-1]=0; |
| if(!(_ffblk->dir=opendir(_ffblk->filePath))) | if(!(_ffblk->dir=opendir(_ffblk->filePath))) |
| return true; | return true; |
| Line 45 bool findnext(struct ffblk *_ffblk) { | Line 44 bool findnext(struct ffblk *_ffblk) { |
| return true; | return true; |
| int maxsize=sizeof(_ffblk->ff_name)-1; | int maxsize=sizeof(_ffblk->ff_name)-1; |
| strncpy(_ffblk->ff_name, entry->d_name, maxsize); | strncpy(_ffblk->ff_name, entry->d_name, maxsize-1); _ffblk->ff_name[maxsize]=0; |
| _ffblk->ff_name[maxsize]=0; | |
| char fileSpec[MAXPATH]; | char fileSpec[MAXPATH]; |
| snprintf(fileSpec, MAXPATH, "%s/%s", | snprintf(fileSpec, MAXPATH, "%s/%s", |