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
81e5c76a
Commit
81e5c76a
authored
Sep 24, 2009
by
Dan Kegel
Committed by
Alexandre Julliard
Sep 25, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cmd: Improve 'attrib' builtin to handle at least setting/clearing single attributes.
parent
46187dd6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
16 deletions
+33
-16
builtins.c
programs/cmd/builtins.c
+33
-16
No files found.
programs/cmd/builtins.c
View file @
81e5c76a
...
...
@@ -1775,12 +1775,6 @@ void WCMD_endlocal (void) {
*
* Display and optionally sets DOS attributes on a file or directory
*
* FIXME: Wine currently uses the Unix stat() function to get file attributes.
* As a result only the Readonly flag is correctly reported, the Archive bit
* is always set and the rest are not implemented. We do the Right Thing anyway.
*
* FIXME: No SET functionality.
*
*/
void
WCMD_setshow_attrib
(
void
)
{
...
...
@@ -1789,26 +1783,49 @@ void WCMD_setshow_attrib (void) {
HANDLE
hff
;
WIN32_FIND_DATA
fd
;
WCHAR
flags
[
9
]
=
{
' '
,
' '
,
' '
,
' '
,
' '
,
' '
,
' '
,
' '
,
'\0'
};
if
(
param1
[
0
]
==
'-'
)
{
WCMD_output
(
WCMD_LoadMessage
(
WCMD_NYI
));
return
;
WCHAR
*
name
=
param1
;
DWORD
attrib_set
=
0
;
DWORD
attrib_clear
=
0
;
if
(
param1
[
0
]
==
'+'
||
param1
[
0
]
==
'-'
)
{
DWORD
attrib
=
0
;
/* FIXME: the real cmd can handle many more than two args; this should be in a loop */
switch
(
param1
[
1
])
{
case
'H'
:
case
'h'
:
attrib
|=
FILE_ATTRIBUTE_HIDDEN
;
break
;
case
'S'
:
case
's'
:
attrib
|=
FILE_ATTRIBUTE_SYSTEM
;
break
;
case
'R'
:
case
'r'
:
attrib
|=
FILE_ATTRIBUTE_READONLY
;
break
;
case
'A'
:
case
'a'
:
attrib
|=
FILE_ATTRIBUTE_ARCHIVE
;
break
;
default:
WCMD_output
(
WCMD_LoadMessage
(
WCMD_NYI
));
return
;
}
switch
(
param1
[
0
])
{
case
'+'
:
attrib_set
=
attrib
;
break
;
case
'-'
:
attrib_clear
=
attrib
;
break
;
}
name
=
param2
;
}
if
(
strlenW
(
param1
)
==
0
)
{
if
(
strlenW
(
name
)
==
0
)
{
static
const
WCHAR
slashStarW
[]
=
{
'\\'
,
'*'
,
'\0'
};
GetCurrentDirectory
(
sizeof
(
param
1
)
/
sizeof
(
WCHAR
),
param1
);
strcatW
(
param1
,
slashStarW
);
GetCurrentDirectory
(
sizeof
(
param
2
)
/
sizeof
(
WCHAR
),
name
);
strcatW
(
name
,
slashStarW
);
}
hff
=
FindFirstFile
(
param1
,
&
fd
);
hff
=
FindFirstFile
(
name
,
&
fd
);
if
(
hff
==
INVALID_HANDLE_VALUE
)
{
WCMD_output
(
WCMD_LoadMessage
(
WCMD_FILENOTFOUND
),
param1
);
WCMD_output
(
WCMD_LoadMessage
(
WCMD_FILENOTFOUND
),
name
);
}
else
{
do
{
if
(
!
(
fd
.
dwFileAttributes
&
FILE_ATTRIBUTE_DIRECTORY
))
{
if
(
attrib_set
||
attrib_clear
)
{
fd
.
dwFileAttributes
&=
~
attrib_clear
;
fd
.
dwFileAttributes
|=
attrib_set
;
if
(
!
fd
.
dwFileAttributes
)
fd
.
dwFileAttributes
|=
FILE_ATTRIBUTE_NORMAL
;
SetFileAttributesW
(
name
,
fd
.
dwFileAttributes
);
}
else
{
static
const
WCHAR
fmt
[]
=
{
'%'
,
's'
,
' '
,
' '
,
' '
,
'%'
,
's'
,
'\n'
,
'\0'
};
if
(
fd
.
dwFileAttributes
&
FILE_ATTRIBUTE_HIDDEN
)
{
flags
[
0
]
=
'H'
;
...
...
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