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
9d6761bd
Commit
9d6761bd
authored
Oct 19, 2006
by
Mikołaj Zalewski
Committed by
Alexandre Julliard
Oct 20, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wineconsole: Add usage message and more specific error messages.
parent
18aafc27
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
88 additions
and
9 deletions
+88
-9
wineconsole.c
programs/wineconsole/wineconsole.c
+49
-9
wineconsole_En.rc
programs/wineconsole/wineconsole_En.rc
+14
-0
wineconsole_Pl.rc
programs/wineconsole/wineconsole_Pl.rc
+14
-0
wineconsole_res.h
programs/wineconsole/wineconsole_res.h
+11
-0
No files found.
programs/wineconsole/wineconsole.c
View file @
9d6761bd
...
...
@@ -22,9 +22,11 @@
#include "wine/port.h"
#include <stdio.h>
#include <stdarg.h>
#include "wine/server.h"
#include "winecon_private.h"
#include "winnls.h"
#include "winuser.h"
#include "wine/debug.h"
...
...
@@ -36,6 +38,27 @@ void WINECON_Fatal(const char* msg)
ExitProcess
(
0
);
}
static
void
printf_res
(
UINT
uResId
,
...)
{
WCHAR
buffer
[
1024
];
CHAR
ansi
[
1024
];
va_list
args
;
va_start
(
args
,
uResId
);
LoadStringW
(
GetModuleHandle
(
NULL
),
uResId
,
buffer
,
sizeof
(
buffer
)
/
sizeof
(
WCHAR
));
WideCharToMultiByte
(
CP_UNIXCP
,
0
,
buffer
,
-
1
,
ansi
,
sizeof
(
ansi
),
NULL
,
NULL
);
vprintf
(
ansi
,
args
);
va_end
(
args
);
}
static
void
WINECON_Usage
()
{
printf_res
(
IDS_USAGE_HEADER
);
printf_res
(
IDS_USAGE_BACKEND
);
printf_res
(
IDS_USAGE_COMMAND
);
printf_res
(
IDS_USAGE_FOOTER
);
}
/******************************************************************
* WINECON_FetchCells
*
...
...
@@ -729,12 +752,16 @@ struct wc_init {
HANDLE
event
;
};
#define WINECON_CMD_SHOW_USAGE 0x10000
/******************************************************************
* WINECON_ParseOptions
*
*
* RETURNS
* On success: 0
* On error: error string id optionaly with the CMD_SHOW_USAGE flag
*/
static
BOOL
WINECON_ParseOptions
(
const
char
*
lpCmdLine
,
struct
wc_init
*
wci
)
static
UINT
WINECON_ParseOptions
(
const
char
*
lpCmdLine
,
struct
wc_init
*
wci
)
{
memset
(
wci
,
0
,
sizeof
(
*
wci
));
wci
->
ptr
=
lpCmdLine
;
...
...
@@ -749,7 +776,7 @@ static BOOL WINECON_ParseOptions(const char* lpCmdLine, struct wc_init* wci)
{
char
*
end
;
wci
->
event
=
(
HANDLE
)
strtol
(
wci
->
ptr
+
12
,
&
end
,
10
);
if
(
end
==
wci
->
ptr
+
12
)
return
FALSE
;
if
(
end
==
wci
->
ptr
+
12
)
return
IDS_CMD_INVALID_EVENT_ID
;
wci
->
mode
=
from_event
;
wci
->
ptr
=
end
;
wci
->
backend
=
WCUSER_InitBackend
;
...
...
@@ -766,13 +793,20 @@ static BOOL WINECON_ParseOptions(const char* lpCmdLine, struct wc_init* wci)
wci
->
ptr
+=
16
;
}
else
return
FALSE
;
return
IDS_CMD_INVALID_BACKEND
;
}
else
return
FALS
E
;
return
IDS_CMD_INVALID_OPTION
|
WINECON_CMD_SHOW_USAG
E
;
}
return
TRUE
;
if
(
wci
->
mode
==
from_event
)
return
0
;
while
(
*
wci
->
ptr
==
' '
||
*
wci
->
ptr
==
'\t'
)
wci
->
ptr
++
;
if
(
*
wci
->
ptr
==
0
)
return
IDS_CMD_ABOUT
|
WINECON_CMD_SHOW_USAGE
;
return
0
;
}
/******************************************************************
...
...
@@ -790,9 +824,11 @@ int PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR lpCmdLine, INT nCmdSh
int
ret
=
1
;
struct
wc_init
wci
;
if
(
!
WINECON_ParseOptions
(
lpCmdLine
,
&
wci
)
)
if
(
(
ret
=
WINECON_ParseOptions
(
lpCmdLine
,
&
wci
))
!=
0
)
{
WINE_ERR
(
"Wrong command line options
\n
"
);
printf_res
(
ret
&
0xffff
);
if
(
ret
&
WINECON_CMD_SHOW_USAGE
)
WINECON_Usage
();
return
0
;
}
...
...
@@ -814,7 +850,11 @@ int PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR lpCmdLine, INT nCmdSh
return
0
;
ret
=
WINECON_Spawn
(
data
,
buffer
);
if
(
!
ret
)
WINE_MESSAGE
(
"wineconsole: spawning client program failed (%s), invalid/missing command line arguments ?
\n
"
,
wine_dbgstr_w
(
buffer
));
{
WINECON_Delete
(
data
);
printf_res
(
IDS_CMD_LAUNCH_FAILED
,
wine_dbgstr_a
(
wci
.
ptr
));
return
0
;
}
}
break
;
default:
...
...
programs/wineconsole/wineconsole_En.rc
View file @
9d6761bd
...
...
@@ -36,6 +36,20 @@ IDS_DLG_TIT_DEFAULT, "Setup - Default settings"
IDS_DLG_TIT_CURRENT, "Setup - Current settings"
IDS_DLG_TIT_ERROR, "Configuration error"
IDS_DLG_ERR_SBWINSIZE, "Screen buffer size must be greater or equal to the window's one"
IDS_CMD_INVALID_EVENT_ID "wineconsole: Couldn't parse event id\n"
IDS_CMD_INVALID_BACKEND "wineconsole: Invalid backend\n"
IDS_CMD_INVALID_OPTION "wineconsole: Unrecognized command line option\n"
IDS_CMD_ABOUT "Starts a program in a Wine console\n"
IDS_CMD_LAUNCH_FAILED "wineconsole: Starting program %s failed.\n"\
"The command is invalid.\n"
IDS_USAGE_HEADER "\nUsage:\n wineconsole [options] <command>\n\nOptions:\n"
IDS_USAGE_BACKEND " --backend={user|ncurses} Choosing user will spawn a new window, ncurses will\n"\
" try to setup the current terminal as a Wine console\n"
IDS_USAGE_COMMAND " <command> The Wine program to launch in the console\n"
IDS_USAGE_FOOTER "\nExample:\n wineconsole cmd\nStarts the Wine command prompt in a Wine console\n\n"
END
IDD_OPTION DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 140, 105
...
...
programs/wineconsole/wineconsole_Pl.rc
View file @
9d6761bd
...
...
@@ -37,6 +37,20 @@ IDS_DLG_TIT_DEFAULT, "Setup - Domylne ustawienia"
IDS_DLG_TIT_CURRENT, "Setup - Wybrane ustawienia"
IDS_DLG_TIT_ERROR, "Bd konfiguracji"
IDS_DLG_ERR_SBWINSIZE, "Wielko bufora ekranu musi by wiksza ni wielko bufora okna."
IDS_CMD_INVALID_EVENT_ID "wineconsole: Zy format 'event id'\n"
IDS_CMD_INVALID_BACKEND "wineconsole: Niewaciwa warto opcji 'backend'\n"
IDS_CMD_INVALID_OPTION "wineconsole: Nieznana opcja na linii polece\n"
IDS_CMD_ABOUT "Uruchamia program w konsoli Wine\n"
IDS_CMD_LAUNCH_FAILED "wineconsole: Nie udao si uruchomi programu %s.\n"\
"Polecenie jest niewaciwe.\n"
IDS_USAGE_HEADER "\nUycie:\n wineconsole [opcje] <polecenie>\n\nOpcje:\n"
IDS_USAGE_BACKEND " --backend={user|ncurses} Wybr 'user' spowoduje wywietlenie nowego okna, 'ncurses'\n"\
" sprbuje przerobi aktualnie uywany terminal na konsol Wine\n"
IDS_USAGE_COMMAND " <command> Program Wine ktry naley uruchomi\n"
IDS_USAGE_FOOTER "\nPrzykad:\n wineconsole cmd\nUruchamia wiersz polece Wine w konsoli Wine\n\n"
END
IDD_OPTION DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 140, 105
...
...
programs/wineconsole/wineconsole_res.h
View file @
9d6761bd
...
...
@@ -40,6 +40,17 @@
#define IDS_FNT_PREVIEW_1 0x201
#define IDS_FNT_PREVIEW_2 0x202
#define IDS_CMD_INVALID_EVENT_ID 0x300
#define IDS_CMD_INVALID_BACKEND 0x301
#define IDS_CMD_INVALID_OPTION 0x302
#define IDS_CMD_ABOUT 0x303
#define IDS_CMD_LAUNCH_FAILED 0x304
#define IDS_USAGE_HEADER 0x310
#define IDS_USAGE_BACKEND 0x311
#define IDS_USAGE_COMMAND 0x312
#define IDS_USAGE_FOOTER 0x313
/* dialog boxes */
#define IDD_OPTION 0x0100
#define IDD_FONT 0x0200
...
...
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