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
de239dc8
Commit
de239dc8
authored
Aug 16, 2010
by
Andrew Nguyen
Committed by
Alexandre Julliard
Aug 17, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ipconfig: Implement basic command-line parsing.
parent
6919c8df
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
133 additions
and
1 deletion
+133
-1
En.rc
programs/ipconfig/En.rc
+30
-0
Makefile.in
programs/ipconfig/Makefile.in
+3
-0
ipconfig.c
programs/ipconfig/ipconfig.c
+75
-1
ipconfig.h
programs/ipconfig/ipconfig.h
+25
-0
No files found.
programs/ipconfig/En.rc
0 → 100644
View file @
de239dc8
/*
* IP configuration utility
* English language support
*
* Copyright 2010 Andrew Nguyen
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "ipconfig.h"
LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT
STRINGTABLE
{
STRING_USAGE, "Usage: ipconfig [ /? | /all ]\n"
STRING_INVALID_CMDLINE, "Error: Unknown or invalid command line parameters specified\n"
}
programs/ipconfig/Makefile.in
View file @
de239dc8
...
...
@@ -5,7 +5,10 @@ SRCDIR = @srcdir@
VPATH
=
@srcdir@
MODULE
=
ipconfig.exe
APPMODE
=
-mconsole
-municode
IMPORTS
=
user32
C_SRCS
=
ipconfig.c
RC_SRCS
=
En.rc
@MAKE_PROG_RULES@
programs/ipconfig/ipconfig.c
View file @
de239dc8
/*
* IP configuration utility
*
* Copyright 2008 Andrew Riedi
* Copyright 2010 Andrew Nguyen
*
* This library is free software; you can redistribute it and/or
...
...
@@ -22,10 +23,83 @@
#include <wine/debug.h>
#include <wine/unicode.h>
#include "ipconfig.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
ipconfig
);
static
int
ipconfig_printfW
(
const
WCHAR
*
msg
,
...)
{
va_list
va_args
;
int
wlen
;
DWORD
count
,
ret
;
WCHAR
msg_buffer
[
8192
];
va_start
(
va_args
,
msg
);
wlen
=
vsprintfW
(
msg_buffer
,
msg
,
va_args
);
va_end
(
va_args
);
ret
=
WriteConsoleW
(
GetStdHandle
(
STD_OUTPUT_HANDLE
),
msg_buffer
,
wlen
,
&
count
,
NULL
);
if
(
!
ret
)
{
DWORD
len
;
char
*
msgA
;
len
=
WideCharToMultiByte
(
GetConsoleOutputCP
(),
0
,
msg_buffer
,
wlen
,
NULL
,
0
,
NULL
,
NULL
);
msgA
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
);
if
(
!
msgA
)
return
0
;
WideCharToMultiByte
(
GetConsoleOutputCP
(),
0
,
msg_buffer
,
wlen
,
msgA
,
len
,
NULL
,
NULL
);
WriteFile
(
GetStdHandle
(
STD_OUTPUT_HANDLE
),
msgA
,
len
,
&
count
,
FALSE
);
HeapFree
(
GetProcessHeap
(),
0
,
msgA
);
}
return
count
;
}
static
int
ipconfig_message
(
int
msg
)
{
static
const
WCHAR
formatW
[]
=
{
'%'
,
's'
,
0
};
WCHAR
msg_buffer
[
8192
];
LoadStringW
(
GetModuleHandleW
(
NULL
),
msg
,
msg_buffer
,
sizeof
(
msg_buffer
)
/
sizeof
(
WCHAR
));
return
ipconfig_printfW
(
formatW
,
msg_buffer
);
}
int
wmain
(
int
argc
,
WCHAR
*
argv
[])
{
WINE_FIXME
(
"ipconfig.exe is not implemented
\n
"
);
static
const
WCHAR
slashHelp
[]
=
{
'/'
,
'?'
,
0
};
static
const
WCHAR
slashAll
[]
=
{
'/'
,
'a'
,
'l'
,
'l'
,
0
};
if
(
argc
>
1
)
{
if
(
!
strcmpW
(
slashHelp
,
argv
[
1
]))
{
ipconfig_message
(
STRING_USAGE
);
return
1
;
}
else
if
(
!
strcmpiW
(
slashAll
,
argv
[
1
]))
{
if
(
argv
[
2
])
{
ipconfig_message
(
STRING_INVALID_CMDLINE
);
ipconfig_message
(
STRING_USAGE
);
return
1
;
}
WINE_FIXME
(
"/all option is not currently handled
\n
"
);
}
else
{
ipconfig_message
(
STRING_INVALID_CMDLINE
);
ipconfig_message
(
STRING_USAGE
);
return
1
;
}
}
WINE_FIXME
(
"Network interface output is not currently implemented
\n
"
);
return
0
;
}
programs/ipconfig/ipconfig.h
0 → 100644
View file @
de239dc8
/*
* IP configuration utility private definitions
*
* Copyright 2010 Andrew Nguyen
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <windef.h>
/* Translation IDs. */
#define STRING_USAGE 101
#define STRING_INVALID_CMDLINE 102
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