Commit f950d973 authored by Dimitrie O. Paun's avatar Dimitrie O. Paun Committed by Alexandre Julliard

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.
parent 329aa748
...@@ -146,14 +146,6 @@ In case of library loading errors ...@@ -146,14 +146,6 @@ In case of library loading errors
(e.g. "Error while loading shared libraries: libntdll.so"), make sure (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. 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 6. RUNNING PROGRAMS
When invoking Wine, you may specify the entire path to the executable, When invoking Wine, you may specify the entire path to the executable,
...@@ -168,7 +160,7 @@ For example: to run Solitaire: ...@@ -168,7 +160,7 @@ For example: to run Solitaire:
wine /usr/windows/sol.exe (using Unix filename syntax) 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) (calling program with parameters)
Note: the path of the file will also be added to the path when Note: the path of the file will also be added to the path when
......
...@@ -20,7 +20,6 @@ SPEC_SRCS16 = \ ...@@ -20,7 +20,6 @@ SPEC_SRCS16 = \
C_SRCS = \ C_SRCS = \
$(TOPOBJDIR)/files/directory.c \ $(TOPOBJDIR)/files/directory.c \
$(TOPOBJDIR)/files/smb.c \ $(TOPOBJDIR)/files/smb.c \
$(TOPOBJDIR)/misc/options.c \
$(TOPOBJDIR)/misc/registry.c \ $(TOPOBJDIR)/misc/registry.c \
actctx.c \ actctx.c \
atom.c \ atom.c \
......
...@@ -38,7 +38,6 @@ ...@@ -38,7 +38,6 @@
#include "ntstatus.h" #include "ntstatus.h"
#include "thread.h" #include "thread.h"
#include "module.h" #include "module.h"
#include "options.h"
#include "kernel_private.h" #include "kernel_private.h"
#include "wine/exception.h" #include "wine/exception.h"
#include "wine/server.h" #include "wine/server.h"
...@@ -636,6 +635,21 @@ static inline void fix_unicode_string( UNICODE_STRING *str, char *end_ptr ) ...@@ -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 * init_user_process_params
...@@ -780,9 +794,6 @@ static BOOL process_init( char *argv[], char **environ ) ...@@ -780,9 +794,6 @@ static BOOL process_init( char *argv[], char **environ )
/* Copy the parent environment */ /* Copy the parent environment */
if (!build_initial_environment( environ )) return FALSE; if (!build_initial_environment( environ )) return FALSE;
/* Parse command line arguments */
if (!info_size) OPTIONS_ParseOptions( argv );
/* Create device symlinks */ /* Create device symlinks */
VOLUME_CreateDevices(); VOLUME_CreateDevices();
...@@ -867,7 +878,12 @@ void __wine_kernel_init(void) ...@@ -867,7 +878,12 @@ void __wine_kernel_init(void)
WCHAR buffer[MAX_PATH]; WCHAR buffer[MAX_PATH];
WCHAR exe_nameW[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 ); 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 )) 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: ...@@ -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 libntdll.so") fügen Sie bitte den Library-Pfad zur Datei /etc/ld.so.conf hinzu
und führen Sie ldconfig als root aus. 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 6. AUSFÜHREN VON PROGRAMMEN
Wenn Sie Wine aufrufen, können Sie den vollständigen Pfad zur ausführbaren Wenn Sie Wine aufrufen, können Sie den vollständigen Pfad zur ausführbaren
...@@ -181,7 +170,7 @@ Beispiel: Um Solitaire auszuführen: ...@@ -181,7 +170,7 @@ Beispiel: Um Solitaire auszuführen:
wine /usr/windows/sol.exe (die Dateinamen-Syntax von Unix benutzend) 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) (Programmaufruf mit Parametern)
Hinweis: Der Pfad zur Datei wird auch zum Pfad hinzugefügt, wenn ein vollständiger 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 ...@@ -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 "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. 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 6. EXÉCUTER DES PROGRAMMES
Lorsque l'on invoque Wine, vous pouvez spécifier le chemin entier vers Lorsque l'on invoque Wine, vous pouvez spécifier le chemin entier vers
...@@ -182,7 +172,7 @@ Pour exécuter Solitaire par exemple : ...@@ -182,7 +172,7 @@ Pour exécuter Solitaire par exemple :
wine /usr/windows/sol.exe (en utilisant la syntaxe de fichiers Unix) 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) (en appelant le programme avec des paramètres)
Note: le chemin du fichier sera également additionné au chemin par défaut 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 ...@@ -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 aggiungere il percorso della directory a /etc/ld.so.conf ed esegui ldconfig come
root. 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 6. ESEGUIRE I PROGRAMMI
Quando si esegue Wine, si può specificare l'intero percorso dell'eseguibile o Quando si esegue Wine, si può specificare l'intero percorso dell'eseguibile o
...@@ -176,7 +166,7 @@ Per esempio: per eseguire Solitario: ...@@ -176,7 +166,7 @@ Per esempio: per eseguire Solitario:
wine c:\\windows\\sol.exe (utilizzando la sintassi DOS) wine c:\\windows\\sol.exe (utilizzando la sintassi DOS)
wine /usr/windows/sol.exe (utilizzando la sintassi Unix) 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) (chiama il programma con dei parametri)
Nota: il percorso del file può essere aggiunto al percorso quando è fornito un 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 ...@@ -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 de adicionar o caminho da biblioteca a /etc/ld.so.conf e executar
ldconfig como root. 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 6.EXECUTAR PROGRAMAS
Ao invocar o Wine, você pode especificar o caminho completo do executável, Ao invocar o Wine, você pode especificar o caminho completo do executável,
...@@ -172,7 +163,7 @@ Por exemplo: para executar a Paciência: ...@@ -172,7 +163,7 @@ Por exemplo: para executar a Paciência:
wine /usr/windows/sol.exe (usando um nome de arquivo Unix) 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) (chamando o programa com parãmetros)
Nota: o caminho do arquivo será também adicionado ao caminho Nota: o caminho do arquivo será também adicionado ao caminho
......
...@@ -73,30 +73,20 @@ ...@@ -73,30 +73,20 @@
<title>How to run Wine</title> <title>How to run Wine</title>
<para> <para>
You can invoke the <command>wine --help</command> command to You can simply invoke the <command>wine</command> command to
get a listing of all Wine's command-line parameters: get a small help message:
</para> </para>
<para> <para>
<screen> <screen>
Usage: ./wine [options] program_name [arguments] Wine 20040405
Usage: wine PROGRAM [ARGUMENTS...] Run the specified program
Options: wine --help Display this help and exit
--debugmsg name Turn debugging-messages on or off wine --version Output version information and exit
--help,-h Show this help message
--version,-v Display the Wine version
</screen> </screen>
</para> </para>
<para> <para>
You can specify as many options as you want, if any. The first argument should be the name of the file you
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
want <command>wine</command> to execute. If the executable is want <command>wine</command> to execute. If the executable is
in the <parameter>Path</parameter> parameter in the in the <parameter>Path</parameter> parameter in the
configuration file, you can simply give the executable file configuration file, you can simply give the executable file
...@@ -148,8 +138,25 @@ Options: ...@@ -148,8 +138,25 @@ Options:
<sect1 id="command-line-options"> <sect1 id="command-line-options">
<title>Wine Command Line Options</title> <title>Wine Command Line Options</title>
<sect2 id="config-parameter"> <sect2>
<title>--debugmsg [channels]</title> <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> <para>
Wine isn't perfect, and many Windows applications still Wine isn't perfect, and many Windows applications still
don't run without bugs under Wine (but then, a lot of programs don't run without bugs under Wine (but then, a lot of programs
...@@ -178,7 +185,7 @@ Options: ...@@ -178,7 +185,7 @@ Options:
section of configuring wine you can section of configuring wine you can
modify what the <parameter>relay</parameter> trace reports). modify what the <parameter>relay</parameter> trace reports).
Logging does slow down Wine 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. unless you really do want log files.
</para> </para>
<para> <para>
...@@ -197,28 +204,28 @@ Options: ...@@ -197,28 +204,28 @@ Options:
To turn on a debug channel, use the form To turn on a debug channel, use the form
<parameter>class+channel</parameter>. To turn it off, use <parameter>class+channel</parameter>. To turn it off, use
<parameter>class-channel</parameter>. To list more than one <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 option, separate them with commas. For example, to request
<parameter>warn</parameter> class messages in the <parameter>warn</parameter> class messages in the
<parameter>heap</parameter> debug channel, you could invoke <parameter>heap</parameter> debug channel, you could invoke
<command>wine</command> like this: <command>wine</command> like this:
</para> </para>
<screen> <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> </screen>
<para> <para>
If you leave off the message class, <command>wine</command> If you leave off the message class, <command>wine</command>
will display messages from all four classes for that channel: will display messages from all four classes for that channel:
</para> </para>
<screen> <screen>
<prompt>$</prompt> <userinput>wine --debugmsg +heap <replaceable>program_name</replaceable></userinput> <prompt>$</prompt> <userinput>WINEDEBUG=heap wine <replaceable>program_name</replaceable></userinput>
</screen> </screen>
<para> <para>
If you wanted to see log messages for everything except the If you wanted to see log messages for everything except the
relay channel, you might do something like this: relay channel, you might do something like this:
</para> </para>
<screen> <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> </screen>
<para> <para>
Here is a list of the debug channels and classes in Wine. Here is a list of the debug channels and classes in Wine.
...@@ -286,20 +293,6 @@ Options: ...@@ -286,20 +293,6 @@ Options:
The Wine Developer's Guide</ulink>. The Wine Developer's Guide</ulink>.
</para> </para>
</sect2> </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>
<sect1 id="wineserver-command-line-options"> <sect1 id="wineserver-command-line-options">
...@@ -319,7 +312,7 @@ Options: ...@@ -319,7 +312,7 @@ Options:
Sets the debug level for debug output in the terminal that Sets the debug level for debug output in the terminal that
wineserver got started in at level &lt;n&gt;. wineserver got started in at level &lt;n&gt;.
In other words: everything greater than 0 will enable 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> </para>
</sect2> </sect2>
......
...@@ -174,7 +174,7 @@ wine cannot use native versions for these libraries. ...@@ -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 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 fiddling with the current defaults and needless to say that you must know
what you are doing. 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 .PP
.B [Debug] .B [Debug]
.br .br
......
.\" -*- nroff -*- .\" -*- nroff -*-
.TH WINE 1 "May 2002" "@PACKAGE_STRING@" "Windows On Unix" .TH WINE 1 "May 2004" "@PACKAGE_STRING@" "Windows On Unix"
.SH NAME .SH NAME
wine \- run Windows programs on Unix wine \- run Windows programs on Unix
.SH SYNOPSIS .SH SYNOPSIS
.BI "wine " "[wine_options] " "[--] " "program " "[arguments ... ]" .BI "wine " "program " "[arguments ... ]"
.br
.B wine --help
.br
.B wine --version
.PP .PP
For instructions on passing arguments to Windows programs, please see the For instructions on passing arguments to Windows programs, please see the
.B .B
...@@ -28,27 +32,18 @@ run). Not using ...@@ -28,27 +32,18 @@ run). Not using
for CUI programs will only provide very limited console support, and your for CUI programs will only provide very limited console support, and your
program might not function properly. program might not function properly.
.PP .PP
.B wine When invoked with
currently runs a growing list of applications written for all kinds of .B --help
Windows versions >= Win2.0, e.g. Win3.1, Win95/98, NT. or
Older, simpler applications work better than newer, more complex ones. .B --version
Using Windows ME or Win2000 components with Wine is more problematic than as the only argument,
using none at all or the ones from older Windows versions. .B wine
A large percentage of the API has been implemented, will simply print a small help message or its version respectively and exit.
although there are still several major pieces of work left to do.
.SH REQUIREMENTS AND INSTALLATION .SH REQUIREMENTS AND INSTALLATION
Read the README file in the Wine source distribution and the Read the README file in the Wine source distribution and the
.BR wine.conf (5) .BR wine.conf (5)
man page to know what Wine requires and how it is installed from man page to know what Wine requires and how it is installed from
source. 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 .SH PROGRAM/ARGUMENTS
The program name may be specified in DOS format ( The program name may be specified in DOS format (
.I .I
...@@ -64,45 +59,6 @@ a shell, e.g. ...@@ -64,45 +59,6 @@ a shell, e.g.
.PP .PP
wine C:\(rs\(rsProgram\(rs Files\(rs\(rsMyPrg\(rs\(rstest.exe wine C:\(rs\(rsProgram\(rs Files\(rs\(rsMyPrg\(rs\(rstest.exe
.PP .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 .SH ENVIRONMENT VARIABLES
.B wine .B wine
makes the environment variables of the shell from which makes the environment variables of the shell from which
...@@ -323,7 +279,7 @@ in the top-level directory of the source distribution. ...@@ -323,7 +279,7 @@ in the top-level directory of the source distribution.
.SH BUGS .SH BUGS
.PP .PP
A status report on many applications is available from 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. Please add entries to this list for applications you currently run.
.PP .PP
Bug reports may be posted to Wine Bugzilla Bug reports may be posted to Wine Bugzilla
...@@ -350,18 +306,10 @@ http://www.winehq.org/cvs ...@@ -350,18 +306,10 @@ http://www.winehq.org/cvs
WineHQ, the WineHQ, the
.B wine .B wine
development headquarters, is at development headquarters, is at
.I http://www.winehq.org/. .I http://www.winehq.org.
This website contains a great deal of information about This website contains a great deal of information about
.B wine. .B wine.
.PP .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 For further information about
.B wine .B wine
development, you might want to subscribe to the development, you might want to subscribe to the
......
/*
* 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 */
/*
* 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 = ...@@ -119,18 +119,6 @@ static const char* app_loader_template =
" ;;\n" " ;;\n"
"esac\n" "esac\n"
"\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" "# figure out the full app path\n"
"if [ -n \"$appdir\" ]; then\n" "if [ -n \"$appdir\" ]; then\n"
" apppath=\"$appdir/$appname\"\n" " apppath=\"$appdir/$appname\"\n"
...@@ -144,7 +132,7 @@ static const char* app_loader_template = ...@@ -144,7 +132,7 @@ static const char* app_loader_template =
"if [ ! -x \"$WINELOADER\" ]; then WINELOADER=\"wine\"; fi\n" "if [ ! -x \"$WINELOADER\" ]; then WINELOADER=\"wine\"; fi\n"
"\n" "\n"
"# and try to start the app\n" "# and try to start the app\n"
"exec \"$WINELOADER\" $debugmsg -- \"$apppath\" \"$@\"\n" "exec \"$WINELOADER\" \"$apppath\" \"$@\"\n"
; ;
static int keep_generated = 0; static int keep_generated = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment