Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
d2244794
Commit
d2244794
authored
17 years ago
by
Jason Edmeades
Committed by
Alexandre Julliard
17 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cmd.exe: Add support for dir /A filtering.
parent
7fba2c0a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
53 additions
and
0 deletions
+53
-0
directory.c
programs/cmd/directory.c
+53
-0
No files found.
programs/cmd/directory.c
View file @
d2244794
...
...
@@ -64,6 +64,7 @@ static DISPLAYTIME dirTime;
static
DISPLAYORDER
dirOrder
;
static
BOOL
orderReverse
,
orderGroupDirs
,
orderGroupDirsReverse
,
orderByCol
;
static
BOOL
seperator
;
static
ULONG
showattrs
,
attrsbits
;
/*****************************************************************************
* WCMD_directory
...
...
@@ -107,6 +108,8 @@ void WCMD_directory (void) {
orderReverse
=
FALSE
;
orderGroupDirs
=
FALSE
;
orderGroupDirsReverse
=
FALSE
;
showattrs
=
0
;
attrsbits
=
0
;
/* Handle args - Loop through so right most is the effective one */
/* Note: /- appears to be a negate rather than an off, eg. dir
...
...
@@ -189,6 +192,45 @@ void WCMD_directory (void) {
}
p
=
p
-
1
;
/* So when step on, move to '/' */
break
;
case
'A'
:
p
=
p
+
1
;
showattrs
=
0
;
attrsbits
=
0
;
if
(
*
p
==
':'
)
p
++
;
/* Skip optional : */
while
(
*
p
&&
*
p
!=
'/'
)
{
BOOL
anegate
=
FALSE
;
ULONG
mask
;
/* Note /A: - options are 'offs' not toggles */
if
(
*
p
==
'-'
)
{
anegate
=
TRUE
;
p
++
;
}
WINE_TRACE
(
"Processing subparm '%c' (in %s)
\n
"
,
*
p
,
quals
);
switch
(
*
p
)
{
case
'D'
:
mask
=
FILE_ATTRIBUTE_DIRECTORY
;
break
;
case
'H'
:
mask
=
FILE_ATTRIBUTE_HIDDEN
;
break
;
case
'S'
:
mask
=
FILE_ATTRIBUTE_SYSTEM
;
break
;
case
'R'
:
mask
=
FILE_ATTRIBUTE_READONLY
;
break
;
case
'A'
:
mask
=
FILE_ATTRIBUTE_ARCHIVE
;
break
;
default:
SetLastError
(
ERROR_INVALID_PARAMETER
);
WCMD_print_error
();
return
;
}
/* Keep running list of bits we care about */
attrsbits
|=
mask
;
/* Mask shows what MUST be in the bits we care about */
if
(
anegate
)
showattrs
=
showattrs
&
~
mask
;
else
showattrs
|=
mask
;
p
++
;
}
p
=
p
-
1
;
/* So when step on, move to '/' */
WINE_TRACE
(
"Result: showattrs %x, bits %x
\n
"
,
showattrs
,
attrsbits
);
break
;
default:
SetLastError
(
ERROR_INVALID_PARAMETER
);
WCMD_print_error
();
...
...
@@ -313,6 +355,9 @@ void WCMD_list_directory (char *search_path, int level) {
return
;
}
do
{
/* Skip any which are filtered out by attribute */
if
(((
fd
+
entry_count
)
->
dwFileAttributes
&
attrsbits
)
!=
showattrs
)
continue
;
entry_count
++
;
/* Keep running track of longest filename for wide output */
...
...
@@ -331,6 +376,14 @@ void WCMD_list_directory (char *search_path, int level) {
}
while
(
FindNextFile
(
hff
,
(
fd
+
entry_count
))
!=
0
);
FindClose
(
hff
);
/* Handle case where everything is filtered out */
if
(
entry_count
==
0
)
{
SetLastError
(
ERROR_FILE_NOT_FOUND
);
WCMD_print_error
();
HeapFree
(
GetProcessHeap
(),
0
,
fd
);
return
;
}
/* Sort the list of files */
qsort
(
fd
,
entry_count
,
sizeof
(
WIN32_FIND_DATA
),
WCMD_dir_sort
);
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment