Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
87ae825b
Commit
87ae825b
authored
Oct 08, 2003
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Get rid of the argv0 and full_argv0 global variables.
parent
5986e3a7
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
38 deletions
+13
-38
process.c
dlls/kernel/process.c
+5
-8
server.c
dlls/ntdll/server.c
+6
-22
options.h
include/options.h
+0
-3
options.c
misc/options.c
+2
-5
No files found.
dlls/kernel/process.c
View file @
87ae825b
...
...
@@ -507,9 +507,6 @@ static BOOL process_init( char *argv[] )
setbuf
(
stderr
,
NULL
);
setlocale
(
LC_CTYPE
,
""
);
/* store the program name */
argv0
=
argv
[
0
];
/* Fill the initial process structure */
current_process
.
threads
=
1
;
current_process
.
running_threads
=
1
;
...
...
@@ -967,14 +964,14 @@ static void exec_wine_binary( char **argv, char **envp )
execve
(
argv
[
0
],
argv
,
envp
);
/* now try the path of argv0 of the current binary */
if
(
!
(
argv
[
0
]
=
malloc
(
strlen
(
full_argv0
)
+
6
)))
return
;
if
((
ptr
=
strrchr
(
full_argv0
,
'/'
)))
if
((
path
=
wine_get_argv0_path
()))
{
memcpy
(
argv
[
0
],
full_argv0
,
ptr
-
full_argv0
);
strcpy
(
argv
[
0
]
+
(
ptr
-
full_argv0
),
"/wine"
);
if
(
!
(
argv
[
0
]
=
malloc
(
strlen
(
path
)
+
sizeof
(
"wine"
)
)))
return
;
strcpy
(
argv
[
0
],
path
);
strcat
(
argv
[
0
],
"wine"
);
execve
(
argv
[
0
],
argv
,
envp
);
free
(
argv
[
0
]
);
}
free
(
argv
[
0
]
);
/* now search in the Unix path */
if
((
path
=
getenv
(
"PATH"
)))
...
...
dlls/ntdll/server.c
View file @
87ae825b
...
...
@@ -55,7 +55,6 @@
#include "wine/library.h"
#include "wine/server.h"
#include "winerror.h"
#include "options.h"
/* Some versions of glibc don't define this */
#ifndef SCM_RIGHTS
...
...
@@ -450,6 +449,7 @@ static void start_server( const char *oldcwd )
{
static
int
started
;
/* we only try once */
char
*
path
,
*
p
;
const
char
*
argv0_path
;
if
(
!
started
)
{
int
status
;
...
...
@@ -476,15 +476,13 @@ static void start_server( const char *oldcwd )
execl
(
BINDIR
"/wineserver"
,
"wineserver"
,
NULL
);
/* now try the dir we were launched from */
if
(
full_argv0
)
if
(
(
argv0_path
=
wine_get_argv0_path
())
)
{
if
(
!
(
path
=
malloc
(
strlen
(
full_argv0
)
+
20
)))
if
(
!
(
path
=
malloc
(
strlen
(
argv0_path
)
+
sizeof
(
"wineserver"
)
)))
fatal_error
(
"out of memory
\n
"
);
if
((
p
=
strrchr
(
strcpy
(
path
,
full_argv0
),
'/'
)))
{
strcpy
(
p
,
"/wineserver"
);
execl
(
path
,
path
,
NULL
);
}
strcpy
(
path
,
argv0_path
);
strcat
(
path
,
"wineserver"
);
execl
(
path
,
path
,
NULL
);
free
(
path
);
}
...
...
@@ -622,20 +620,6 @@ static void server_init(void)
break
;
}
/* if argv[0] is a relative path, make it absolute */
full_argv0
=
argv0
;
if
(
oldcwd
&&
argv0
[
0
]
!=
'/'
&&
strchr
(
argv0
,
'/'
))
{
char
*
new_argv0
=
malloc
(
strlen
(
oldcwd
)
+
strlen
(
argv0
)
+
2
);
if
(
new_argv0
)
{
strcpy
(
new_argv0
,
oldcwd
);
strcat
(
new_argv0
,
"/"
);
strcat
(
new_argv0
,
argv0
);
full_argv0
=
new_argv0
;
}
}
/* connect to the server */
fd_socket
=
server_connect
(
oldcwd
,
wine_get_server_dir
()
);
...
...
include/options.h
View file @
87ae825b
...
...
@@ -23,9 +23,6 @@
#include <windef.h>
extern
const
char
*
argv0
;
extern
const
char
*
full_argv0
;
extern
void
DECLSPEC_NORETURN
OPTIONS_Usage
(
void
);
extern
void
OPTIONS_ParseOptions
(
char
*
argv
[]
);
...
...
misc/options.c
View file @
87ae825b
...
...
@@ -43,9 +43,6 @@ struct option_descr
const
char
*
usage
;
};
const
char
*
argv0
;
/* the original argv[0] */
const
char
*
full_argv0
;
/* the full path of argv[0] (if known) */
static
char
*
inherit_str
;
/* options to pass to child processes */
static
void
DECLSPEC_NORETURN
out_of_memory
(
void
);
...
...
@@ -89,7 +86,7 @@ static void do_debugmsg( const char *arg )
{
if
(
wine_dbg_parse_options
(
arg
))
{
MESSAGE
(
"
%s: Syntax: --debugmsg [class]+xxx,... or -debugmsg [class]-xxx,...
\n
"
,
argv0
);
MESSAGE
(
"
wine: Syntax: --debugmsg [class]+xxx,... or -debugmsg [class]-xxx,...
\n
"
);
MESSAGE
(
"Example: --debugmsg +all,warn-heap
\n
"
" turn on all messages except warning heap messages
\n
"
);
MESSAGE
(
"Available message classes: err, warn, fixme, trace
\n\n
"
);
...
...
@@ -216,7 +213,7 @@ void OPTIONS_Usage(void)
{
const
struct
option_descr
*
opt
;
MESSAGE
(
"%s
\n\n
"
,
PACKAGE_STRING
);
MESSAGE
(
"Usage:
%s [options] [--] program_name [arguments]
\n
"
,
argv0
);
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
);
...
...
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