Remove the last remaining wine options when running programs.
Keep support for --help, and --version when they are the only options on the command line.
This commit is contained in:
parent
329aa748d4
commit
f950d97381
10
README
10
README
|
@ -146,14 +146,6 @@ In case of library loading errors
|
|||
(e.g. "Error while loading shared libraries: libntdll.so"), make sure
|
||||
to add the library path to /etc/ld.so.conf and run ldconfig as root.
|
||||
|
||||
In order to verify the correctness of the environment you need for
|
||||
Wine to run successfully, you may run "./tools/winecheck | less".
|
||||
You'll get a percentage score indicating "Wine configuration correctness".
|
||||
As this program is alpha, it doesn't run a truly thorough test yet, though,
|
||||
so it should be taken as a first verification step only.
|
||||
|
||||
See wine.conf man page on how to switch to text mode only support if desired.
|
||||
|
||||
6. RUNNING PROGRAMS
|
||||
|
||||
When invoking Wine, you may specify the entire path to the executable,
|
||||
|
@ -168,7 +160,7 @@ For example: to run Solitaire:
|
|||
|
||||
wine /usr/windows/sol.exe (using Unix filename syntax)
|
||||
|
||||
wine -- sol.exe /parameter1 -parameter2 parameter3
|
||||
wine sol.exe /parameter1 -parameter2 parameter3
|
||||
(calling program with parameters)
|
||||
|
||||
Note: the path of the file will also be added to the path when
|
||||
|
|
|
@ -20,7 +20,6 @@ SPEC_SRCS16 = \
|
|||
C_SRCS = \
|
||||
$(TOPOBJDIR)/files/directory.c \
|
||||
$(TOPOBJDIR)/files/smb.c \
|
||||
$(TOPOBJDIR)/misc/options.c \
|
||||
$(TOPOBJDIR)/misc/registry.c \
|
||||
actctx.c \
|
||||
atom.c \
|
||||
|
|
|
@ -38,7 +38,6 @@
|
|||
#include "ntstatus.h"
|
||||
#include "thread.h"
|
||||
#include "module.h"
|
||||
#include "options.h"
|
||||
#include "kernel_private.h"
|
||||
#include "wine/exception.h"
|
||||
#include "wine/server.h"
|
||||
|
@ -636,6 +635,21 @@ static inline void fix_unicode_string( UNICODE_STRING *str, char *end_ptr )
|
|||
}
|
||||
}
|
||||
|
||||
static void version(void)
|
||||
{
|
||||
MESSAGE( "%s\n", PACKAGE_STRING );
|
||||
ExitProcess(0);
|
||||
}
|
||||
|
||||
static void usage(void)
|
||||
{
|
||||
MESSAGE( "%s\n", PACKAGE_STRING );
|
||||
MESSAGE( "Usage: wine PROGRAM [ARGUMENTS...] Run the specified program\n" );
|
||||
MESSAGE( " wine --help Display this help and exit\n");
|
||||
MESSAGE( " wine --version Output version information and exit\n");
|
||||
ExitProcess(0);
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* init_user_process_params
|
||||
|
@ -780,9 +794,6 @@ static BOOL process_init( char *argv[], char **environ )
|
|||
/* Copy the parent environment */
|
||||
if (!build_initial_environment( environ )) return FALSE;
|
||||
|
||||
/* Parse command line arguments */
|
||||
if (!info_size) OPTIONS_ParseOptions( argv );
|
||||
|
||||
/* Create device symlinks */
|
||||
VOLUME_CreateDevices();
|
||||
|
||||
|
@ -867,7 +878,12 @@ void __wine_kernel_init(void)
|
|||
WCHAR buffer[MAX_PATH];
|
||||
WCHAR exe_nameW[MAX_PATH];
|
||||
|
||||
if (!__wine_main_argv[0]) OPTIONS_Usage();
|
||||
if (!__wine_main_argv[0]) usage();
|
||||
if (__wine_main_argc == 1)
|
||||
{
|
||||
if (strcmp(__wine_main_argv[0], "--help") == 0) usage();
|
||||
if (strcmp(__wine_main_argv[0], "--version") == 0) version();
|
||||
}
|
||||
|
||||
MultiByteToWideChar( CP_UNIXCP, 0, __wine_main_argv[0], -1, exe_nameW, MAX_PATH );
|
||||
if (!find_exe_file( exe_nameW, buffer, MAX_PATH, &main_exe_file ))
|
||||
|
|
|
@ -156,17 +156,6 @@ Im Falle von Library-Ladefehlern (z.B. "Error while loading shared libraries:
|
|||
libntdll.so") fügen Sie bitte den Library-Pfad zur Datei /etc/ld.so.conf hinzu
|
||||
und führen Sie ldconfig als root aus.
|
||||
|
||||
Um zu prüfen, ob Ihre Umgebung passend eingerichtet ist, um Wine erfolgreich
|
||||
laufen zu lassen, können Sie das Kommando "./tools/winecheck | less" ausführen.
|
||||
Es wird Ihnen eine Punktzahl in Prozent mitgeteilt, welche die "Korrektheit der
|
||||
Wine-Konfiguration" darstellt.
|
||||
Da dieses Programm immer noch im Alpha-Stadium ist, führt es aber keinen wirklich
|
||||
umfassenden Test durch, die Ergebnisse der Überprüfungsollten sollten also nur
|
||||
als erster Prüfschritt betrachtet werden.
|
||||
|
||||
In der Man-Page zu wine.conf können Sie nachlesen, wie Sie zum reinen Text-Modus
|
||||
wechseln können, wenn gewünscht.
|
||||
|
||||
6. AUSFÜHREN VON PROGRAMMEN
|
||||
|
||||
Wenn Sie Wine aufrufen, können Sie den vollständigen Pfad zur ausführbaren
|
||||
|
@ -181,7 +170,7 @@ Beispiel: Um Solitaire auszuf
|
|||
|
||||
wine /usr/windows/sol.exe (die Dateinamen-Syntax von Unix benutzend)
|
||||
|
||||
wine -- sol.exe /parameter1 -parameter2 parameter3
|
||||
wine sol.exe /parameter1 -parameter2 parameter3
|
||||
(Programmaufruf mit Parametern)
|
||||
|
||||
Hinweis: Der Pfad zur Datei wird auch zum Pfad hinzugefügt, wenn ein vollständiger
|
||||
|
|
|
@ -157,16 +157,6 @@ En cas d'erreur de chargement de librairie (par exemple
|
|||
"Error while loading shared libraries: libntdll.so"), assurez vous d'ajouter
|
||||
le chemin des librairies à /etc/ld.so.conf et exécuter ldconfig en tant que root.
|
||||
|
||||
Pour pouvoir vérifier l'exactitude de l'environnement dont vous avez besoin pour
|
||||
que Wine s'exécute correctement, vous pouvez exécuter "./tools/winecheck | less".
|
||||
Vous aurez un score en pourcentage indiquant "l'exactitude de la configuration
|
||||
de Wine". Ce programme est encore en développement alpha, il n'effectue pas
|
||||
encore un véritable test en profondeur, il devrait cependant être utile dans
|
||||
une première vérification.
|
||||
|
||||
Lisez les page man de wine.conf pour savoir comment basculer en un mode texte
|
||||
uniquement.
|
||||
|
||||
6. EXÉCUTER DES PROGRAMMES
|
||||
|
||||
Lorsque l'on invoque Wine, vous pouvez spécifier le chemin entier vers
|
||||
|
@ -182,7 +172,7 @@ Pour ex
|
|||
|
||||
wine /usr/windows/sol.exe (en utilisant la syntaxe de fichiers Unix)
|
||||
|
||||
wine -- sol.exe /parametre1 -parametre2 parametre3
|
||||
wine sol.exe /parametre1 -parametre2 parametre3
|
||||
(en appelant le programme avec des paramètres)
|
||||
|
||||
Note: le chemin du fichier sera également additionné au chemin par défaut
|
||||
|
|
|
@ -154,16 +154,6 @@ Nel caso di errori di caricamento delle librerie
|
|||
aggiungere il percorso della directory a /etc/ld.so.conf ed esegui ldconfig come
|
||||
root.
|
||||
|
||||
Per verificare la correttezza dell'ambiente di cui hai bisogno per eseguire Wine
|
||||
con successo, puoi eseguire "./tools/winecheck | less".
|
||||
Otterrai un punteggio percentuale che indica la "Correttezza della
|
||||
configurazione di Wine".
|
||||
poiché questo programma è una alpha, anche se non esegue un vero test completo
|
||||
ancora, può essere utilizzato come un primo step di verifica.
|
||||
|
||||
Controlla la pagina wine.conf man su come passare alla modalità solo testuale
|
||||
se lo desideri.
|
||||
|
||||
6. ESEGUIRE I PROGRAMMI
|
||||
|
||||
Quando si esegue Wine, si può specificare l'intero percorso dell'eseguibile o
|
||||
|
@ -176,7 +166,7 @@ Per esempio: per eseguire Solitario:
|
|||
|
||||
wine c:\\windows\\sol.exe (utilizzando la sintassi DOS)
|
||||
wine /usr/windows/sol.exe (utilizzando la sintassi Unix)
|
||||
wine - sol.exe /parameter1 -parameter2 parameter3
|
||||
wine sol.exe /parameter1 -parameter2 parameter3
|
||||
(chiama il programma con dei parametri)
|
||||
|
||||
Nota: il percorso del file può essere aggiunto al percorso quando è fornito un
|
||||
|
|
|
@ -150,15 +150,6 @@ No caso de erros de carga da biblioteca
|
|||
de adicionar o caminho da biblioteca a /etc/ld.so.conf e executar
|
||||
ldconfig como root.
|
||||
|
||||
A fim verificar a exatidão do ambiente que você necessita para que o
|
||||
Wine funcione com sucesso, você pode executar "./tools/winecheck | less".
|
||||
Você irá obter um percentual do resultado indicando "Wine configuration
|
||||
correctness".
|
||||
Como este programa é alfa, não rodou um teste verdadeiramente completo ainda,
|
||||
embora, assim deve ser feito como uma primeira etapa da verificação somente.
|
||||
|
||||
Veja em "man wine.conf" como se muda para o suporte em modo texto se desejar.
|
||||
|
||||
6.EXECUTAR PROGRAMAS
|
||||
|
||||
Ao invocar o Wine, você pode especificar o caminho completo do executável,
|
||||
|
@ -172,7 +163,7 @@ Por exemplo: para executar a Paci
|
|||
|
||||
wine /usr/windows/sol.exe (usando um nome de arquivo Unix)
|
||||
|
||||
wine -- sol.exe /parameter1 -parameter2 parameter3
|
||||
wine sol.exe /parameter1 -parameter2 parameter3
|
||||
(chamando o programa com parãmetros)
|
||||
|
||||
Nota: o caminho do arquivo será também adicionado ao caminho
|
||||
|
|
|
@ -73,30 +73,20 @@
|
|||
<title>How to run Wine</title>
|
||||
|
||||
<para>
|
||||
You can invoke the <command>wine --help</command> command to
|
||||
get a listing of all Wine's command-line parameters:
|
||||
You can simply invoke the <command>wine</command> command to
|
||||
get a small help message:
|
||||
</para>
|
||||
<para>
|
||||
<screen>
|
||||
Usage: ./wine [options] program_name [arguments]
|
||||
|
||||
Options:
|
||||
--debugmsg name Turn debugging-messages on or off
|
||||
--help,-h Show this help message
|
||||
--version,-v Display the Wine version
|
||||
Wine 20040405
|
||||
Usage: wine PROGRAM [ARGUMENTS...] Run the specified program
|
||||
wine --help Display this help and exit
|
||||
wine --version Output version information and exit
|
||||
</screen>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
You can specify as many options as you want, if any.
|
||||
Typically, you will want to have your configuration file set
|
||||
up with a sensible set of defaults; in this case, you can run
|
||||
<command>wine</command> without explicitly listing any
|
||||
options. In rare cases, you might want to override certain
|
||||
parameters on the command line.
|
||||
</para>
|
||||
<para>
|
||||
After the options, you should put the name of the file you
|
||||
The first argument should be the name of the file you
|
||||
want <command>wine</command> to execute. If the executable is
|
||||
in the <parameter>Path</parameter> parameter in the
|
||||
configuration file, you can simply give the executable file
|
||||
|
@ -148,8 +138,25 @@ Options:
|
|||
<sect1 id="command-line-options">
|
||||
<title>Wine Command Line Options</title>
|
||||
|
||||
<sect2 id="config-parameter">
|
||||
<title>--debugmsg [channels]</title>
|
||||
<sect2>
|
||||
<title>--help</title>
|
||||
<para>
|
||||
Shows a small command line help page.
|
||||
</para>
|
||||
</sect2>
|
||||
|
||||
<sect2>
|
||||
<title>--version</title>
|
||||
<para>
|
||||
Shows the Wine version string. Useful to verify your installation.
|
||||
</para>
|
||||
</sect2>
|
||||
</sect1>
|
||||
|
||||
<sect1>
|
||||
<title>Environment variables</title>
|
||||
<sect2>
|
||||
<title>WINEDEBUG=[channels]</title>
|
||||
<para>
|
||||
Wine isn't perfect, and many Windows applications still
|
||||
don't run without bugs under Wine (but then, a lot of programs
|
||||
|
@ -178,7 +185,7 @@ Options:
|
|||
section of configuring wine you can
|
||||
modify what the <parameter>relay</parameter> trace reports).
|
||||
Logging does slow down Wine
|
||||
quite a bit, so don't use <parameter>--debugmsg</parameter>
|
||||
quite a bit, so don't use <parameter>WINEDEBUG</parameter>
|
||||
unless you really do want log files.
|
||||
</para>
|
||||
<para>
|
||||
|
@ -197,28 +204,28 @@ Options:
|
|||
To turn on a debug channel, use the form
|
||||
<parameter>class+channel</parameter>. To turn it off, use
|
||||
<parameter>class-channel</parameter>. To list more than one
|
||||
channel in the same <parameter>--debugmsg</parameter>
|
||||
channel in the same <parameter>WINEDEBUG</parameter>
|
||||
option, separate them with commas. For example, to request
|
||||
<parameter>warn</parameter> class messages in the
|
||||
<parameter>heap</parameter> debug channel, you could invoke
|
||||
<command>wine</command> like this:
|
||||
</para>
|
||||
<screen>
|
||||
<prompt>$</prompt> <userinput>wine --debugmsg warn+heap <replaceable>program_name</replaceable></userinput>
|
||||
<prompt>$</prompt> <userinput>WINEDEBUG=warn+heap wine <replaceable>program_name</replaceable></userinput>
|
||||
</screen>
|
||||
<para>
|
||||
If you leave off the message class, <command>wine</command>
|
||||
will display messages from all four classes for that channel:
|
||||
</para>
|
||||
<screen>
|
||||
<prompt>$</prompt> <userinput>wine --debugmsg +heap <replaceable>program_name</replaceable></userinput>
|
||||
<prompt>$</prompt> <userinput>WINEDEBUG=heap wine <replaceable>program_name</replaceable></userinput>
|
||||
</screen>
|
||||
<para>
|
||||
If you wanted to see log messages for everything except the
|
||||
relay channel, you might do something like this:
|
||||
</para>
|
||||
<screen>
|
||||
<prompt>$</prompt> <userinput>wine --debugmsg +all,-relay <replaceable>program_name</replaceable></userinput>
|
||||
<prompt>$</prompt> <userinput>WINEDEBUG=+all,-relay wine <replaceable>program_name</replaceable></userinput>
|
||||
</screen>
|
||||
<para>
|
||||
Here is a list of the debug channels and classes in Wine.
|
||||
|
@ -286,20 +293,6 @@ Options:
|
|||
The Wine Developer's Guide</ulink>.
|
||||
</para>
|
||||
</sect2>
|
||||
|
||||
<sect2>
|
||||
<title>--help</title>
|
||||
<para>
|
||||
Shows a small command line help page.
|
||||
</para>
|
||||
</sect2>
|
||||
|
||||
<sect2>
|
||||
<title>--version</title>
|
||||
<para>
|
||||
Shows the Wine version string. Useful to verify your installation.
|
||||
</para>
|
||||
</sect2>
|
||||
</sect1>
|
||||
|
||||
<sect1 id="wineserver-command-line-options">
|
||||
|
@ -319,7 +312,7 @@ Options:
|
|||
Sets the debug level for debug output in the terminal that
|
||||
wineserver got started in at level <n>.
|
||||
In other words: everything greater than 0 will enable
|
||||
wineserver specific debugging output (not to confuse with Wine's wineserver logging channel, --debugmsg +server, though!).
|
||||
wineserver specific debugging output.
|
||||
</para>
|
||||
</sect2>
|
||||
|
||||
|
|
|
@ -174,7 +174,7 @@ wine cannot use native versions for these libraries.
|
|||
Always make sure that you have some kind of strategy in mind when you start
|
||||
fiddling with the current defaults and needless to say that you must know
|
||||
what you are doing.
|
||||
--debugmsg +loaddll might come in handy for experimenting with that stuff.
|
||||
WINEDEBUG=loaddll might come in handy for experimenting with that stuff.
|
||||
.PP
|
||||
.B [Debug]
|
||||
.br
|
||||
|
|
|
@ -1,9 +1,13 @@
|
|||
.\" -*- nroff -*-
|
||||
.TH WINE 1 "May 2002" "@PACKAGE_STRING@" "Windows On Unix"
|
||||
.TH WINE 1 "May 2004" "@PACKAGE_STRING@" "Windows On Unix"
|
||||
.SH NAME
|
||||
wine \- run Windows programs on Unix
|
||||
.SH SYNOPSIS
|
||||
.BI "wine " "[wine_options] " "[--] " "program " "[arguments ... ]"
|
||||
.BI "wine " "program " "[arguments ... ]"
|
||||
.br
|
||||
.B wine --help
|
||||
.br
|
||||
.B wine --version
|
||||
.PP
|
||||
For instructions on passing arguments to Windows programs, please see the
|
||||
.B
|
||||
|
@ -28,27 +32,18 @@ run). Not using
|
|||
for CUI programs will only provide very limited console support, and your
|
||||
program might not function properly.
|
||||
.PP
|
||||
.B wine
|
||||
currently runs a growing list of applications written for all kinds of
|
||||
Windows versions >= Win2.0, e.g. Win3.1, Win95/98, NT.
|
||||
Older, simpler applications work better than newer, more complex ones.
|
||||
Using Windows ME or Win2000 components with Wine is more problematic than
|
||||
using none at all or the ones from older Windows versions.
|
||||
A large percentage of the API has been implemented,
|
||||
although there are still several major pieces of work left to do.
|
||||
When invoked with
|
||||
.B --help
|
||||
or
|
||||
.B --version
|
||||
as the only argument,
|
||||
.B wine
|
||||
will simply print a small help message or its version respectively and exit.
|
||||
.SH REQUIREMENTS AND INSTALLATION
|
||||
Read the README file in the Wine source distribution and the
|
||||
.BR wine.conf (5)
|
||||
man page to know what Wine requires and how it is installed from
|
||||
source.
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
.I --debugmsg [xxx]#name[,[xxx1]#name1]
|
||||
Turn debugging messages on or off. This option is deprecated, you
|
||||
should use the
|
||||
.I WINEDEBUG
|
||||
environment variable instead (see below).
|
||||
.PD 1
|
||||
.SH PROGRAM/ARGUMENTS
|
||||
The program name may be specified in DOS format (
|
||||
.I
|
||||
|
@ -64,45 +59,6 @@ a shell, e.g.
|
|||
.PP
|
||||
wine C:\(rs\(rsProgram\(rs Files\(rs\(rsMyPrg\(rs\(rstest.exe
|
||||
.PP
|
||||
Command line processing goes as
|
||||
follows: first
|
||||
.B wine
|
||||
checks whether one or more of the above mentioned
|
||||
.B wine
|
||||
options have been specified. These
|
||||
are removed from the command line, which is passed to the windows program. You can use
|
||||
the parameter
|
||||
.I --
|
||||
to indicate that
|
||||
.B wine
|
||||
should stop command line processing. This is needed in case a windows program understands
|
||||
an option that is usually interpreted (and thus removed from the command line)
|
||||
by
|
||||
.B wine.
|
||||
For example, if you want to execute
|
||||
.B wine
|
||||
with the options
|
||||
.I --debugmsg +module
|
||||
and if
|
||||
.B wine
|
||||
should run the program
|
||||
.I myapp.exe
|
||||
with the arguments
|
||||
.I --display 3d somefile
|
||||
, then you could use the following command line to invoke
|
||||
.B wine:
|
||||
.PP
|
||||
.I wine --debugmsg +module -- myapp.exe --display 3d somefile
|
||||
.PP
|
||||
Note that in contrast to previous versions of
|
||||
.B wine,
|
||||
you must not pass
|
||||
program name and program option in one argument to
|
||||
.B wine.
|
||||
To run more
|
||||
than one windows program, just execute
|
||||
.B wine
|
||||
once with the name of each program as argument.
|
||||
.SH ENVIRONMENT VARIABLES
|
||||
.B wine
|
||||
makes the environment variables of the shell from which
|
||||
|
@ -323,7 +279,7 @@ in the top-level directory of the source distribution.
|
|||
.SH BUGS
|
||||
.PP
|
||||
A status report on many applications is available from
|
||||
.I http://www.winehq.org/Apps.
|
||||
.I http://appdb.winehq.org.
|
||||
Please add entries to this list for applications you currently run.
|
||||
.PP
|
||||
Bug reports may be posted to Wine Bugzilla
|
||||
|
@ -350,18 +306,10 @@ http://www.winehq.org/cvs
|
|||
WineHQ, the
|
||||
.B wine
|
||||
development headquarters, is at
|
||||
.I http://www.winehq.org/.
|
||||
.I http://www.winehq.org.
|
||||
This website contains a great deal of information about
|
||||
.B wine.
|
||||
.PP
|
||||
The
|
||||
.B wine
|
||||
newsgroup is
|
||||
.I comp.emulators.ms-windows.wine.
|
||||
It is used for discussion of various
|
||||
.B wine
|
||||
end user aspects/help.
|
||||
.PP
|
||||
For further information about
|
||||
.B wine
|
||||
development, you might want to subscribe to the
|
||||
|
|
|
@ -1,29 +0,0 @@
|
|||
/*
|
||||
* Command-line options.
|
||||
*
|
||||
* Copyright 1994 Alexandre Julliard
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef __WINE_OPTIONS_H
|
||||
#define __WINE_OPTIONS_H
|
||||
|
||||
#include <windef.h>
|
||||
|
||||
extern void DECLSPEC_NORETURN OPTIONS_Usage(void);
|
||||
extern void OPTIONS_ParseOptions( char *argv[] );
|
||||
|
||||
#endif /* __WINE_OPTIONS_H */
|
177
misc/options.c
177
misc/options.c
|
@ -1,177 +0,0 @@
|
|||
/*
|
||||
* Option parsing
|
||||
*
|
||||
* Copyright 2000 Alexandre Julliard
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "winnls.h"
|
||||
#include "winreg.h"
|
||||
#include "winternl.h"
|
||||
#include "wine/library.h"
|
||||
#include "options.h"
|
||||
#include "wine/debug.h"
|
||||
|
||||
struct option_descr
|
||||
{
|
||||
const char *longname;
|
||||
char shortname;
|
||||
int has_arg;
|
||||
void (*func)( const char *arg );
|
||||
const char *usage;
|
||||
};
|
||||
|
||||
static void do_debugmsg( const char *arg );
|
||||
static void do_help( const char *arg );
|
||||
static void do_version( const char *arg );
|
||||
|
||||
static const struct option_descr option_table[] =
|
||||
{
|
||||
{ "debugmsg", 0, 1, do_debugmsg,
|
||||
"--debugmsg name No longer supported, use the WINEDEBUG variable instead" },
|
||||
{ "help", 'h', 0, do_help,
|
||||
"--help,-h Show this help message" },
|
||||
{ "version", 'v', 0, do_version,
|
||||
"--version,-v Display the Wine version" },
|
||||
{ NULL, 0, 0, NULL, NULL } /* terminator */
|
||||
};
|
||||
|
||||
|
||||
static void do_help( const char *arg )
|
||||
{
|
||||
OPTIONS_Usage();
|
||||
}
|
||||
|
||||
static void do_version( const char *arg )
|
||||
{
|
||||
MESSAGE( "%s\n", PACKAGE_STRING );
|
||||
ExitProcess(0);
|
||||
}
|
||||
|
||||
static void do_debugmsg( const char *arg )
|
||||
{
|
||||
MESSAGE("Error: the --debugmsg option is no longer supported. You should use\n");
|
||||
MESSAGE("the WINEDEBUG environment variable instead, like this:\n\n");
|
||||
MESSAGE(" WINEDEBUG=%s wine ...\n\n", arg );
|
||||
ExitProcess(1);
|
||||
}
|
||||
|
||||
static inline void remove_options( char *argv[], int pos, int count )
|
||||
{
|
||||
while ((argv[pos] = argv[pos+count])) pos++;
|
||||
}
|
||||
|
||||
/* parse options from the argv array and remove all the recognized ones */
|
||||
static void parse_options( char *argv[] )
|
||||
{
|
||||
const struct option_descr *opt;
|
||||
int i;
|
||||
|
||||
for (i = 0; argv[i]; i++)
|
||||
{
|
||||
const char *equalarg = NULL;
|
||||
char *p = argv[i];
|
||||
if (*p++ != '-') continue; /* not an option */
|
||||
if (*p && !p[1]) /* short name */
|
||||
{
|
||||
if (*p == '-') break; /* "--" option */
|
||||
for (opt = option_table; opt->longname; opt++) if (opt->shortname == *p) break;
|
||||
}
|
||||
else /* long name */
|
||||
{
|
||||
const char *equal = strchr (p, '=');
|
||||
if (*p == '-') p++;
|
||||
/* check for the long name */
|
||||
for (opt = option_table; opt->longname; opt++) {
|
||||
/* Plain --option */
|
||||
if (!strcmp( p, opt->longname )) break;
|
||||
|
||||
/* --option=value */
|
||||
if (opt->has_arg &&
|
||||
equal &&
|
||||
strlen (opt->longname) == equal - p &&
|
||||
!strncmp (p, opt->longname, equal - p)) {
|
||||
equalarg = equal + 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!opt->longname) continue;
|
||||
|
||||
if (equalarg)
|
||||
{
|
||||
opt->func( equalarg );
|
||||
remove_options( argv, i, 1 );
|
||||
}
|
||||
else if (opt->has_arg && argv[i+1])
|
||||
{
|
||||
opt->func( argv[i+1] );
|
||||
remove_options( argv, i, 2 );
|
||||
}
|
||||
else
|
||||
{
|
||||
opt->func( "" );
|
||||
remove_options( argv, i, 1 );
|
||||
}
|
||||
i--;
|
||||
}
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* OPTIONS_Usage
|
||||
*/
|
||||
void OPTIONS_Usage(void)
|
||||
{
|
||||
const struct option_descr *opt;
|
||||
MESSAGE( "%s\n\n", PACKAGE_STRING );
|
||||
MESSAGE( "Usage: wine [options] [--] program_name [arguments]\n" );
|
||||
MESSAGE("The -- has to be used if you specify arguments (of the program)\n\n");
|
||||
MESSAGE( "Options:\n" );
|
||||
for (opt = option_table; opt->longname; opt++) MESSAGE( " %s\n", opt->usage );
|
||||
ExitProcess(0);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* OPTIONS_ParseOptions
|
||||
*/
|
||||
void OPTIONS_ParseOptions( char *argv[] )
|
||||
{
|
||||
int i;
|
||||
|
||||
parse_options( argv + 1 );
|
||||
|
||||
/* check if any option remains */
|
||||
for (i = 1; argv[i]; i++)
|
||||
{
|
||||
if (!strcmp( argv[i], "--" ))
|
||||
{
|
||||
remove_options( argv, i, 1 );
|
||||
break;
|
||||
}
|
||||
if (argv[i][0] == '-')
|
||||
{
|
||||
MESSAGE( "Unknown option '%s'\n\n", argv[i] );
|
||||
OPTIONS_Usage();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -119,18 +119,6 @@ static const char* app_loader_template =
|
|||
" ;;\n"
|
||||
"esac\n"
|
||||
"\n"
|
||||
"while true; do\n"
|
||||
" case \"$1\" in\n"
|
||||
" --debugmsg)\n"
|
||||
" debugmsg=\"$1 $2\"\n"
|
||||
" shift; shift;\n"
|
||||
" ;;\n"
|
||||
" *)\n"
|
||||
" break\n"
|
||||
" ;;\n"
|
||||
" esac\n"
|
||||
"done\n"
|
||||
"\n"
|
||||
"# figure out the full app path\n"
|
||||
"if [ -n \"$appdir\" ]; then\n"
|
||||
" apppath=\"$appdir/$appname\"\n"
|
||||
|
@ -144,7 +132,7 @@ static const char* app_loader_template =
|
|||
"if [ ! -x \"$WINELOADER\" ]; then WINELOADER=\"wine\"; fi\n"
|
||||
"\n"
|
||||
"# and try to start the app\n"
|
||||
"exec \"$WINELOADER\" $debugmsg -- \"$apppath\" \"$@\"\n"
|
||||
"exec \"$WINELOADER\" \"$apppath\" \"$@\"\n"
|
||||
;
|
||||
|
||||
static int keep_generated = 0;
|
||||
|
|
Loading…
Reference in New Issue