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
67daa7f7
Commit
67daa7f7
authored
May 21, 2008
by
Vitaliy Margolen
Committed by
Alexandre Julliard
May 22, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wineserver: Add support for long command line options.
parent
28433522
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
36 deletions
+45
-36
main.c
server/main.c
+38
-29
wineserver.man.in
server/wineserver.man.in
+7
-7
No files found.
server/main.c
View file @
67daa7f7
...
...
@@ -28,6 +28,9 @@
#include <stdlib.h>
#include <sys/time.h>
#include <unistd.h>
#ifdef HAVE_GETOPT_H
# include <getopt.h>
#endif
#include "object.h"
#include "file.h"
...
...
@@ -41,36 +44,48 @@ timeout_t master_socket_timeout = 3 * -TICKS_PER_SEC; /* master socket timeout,
const
char
*
server_argv0
;
/* parse-line args */
/* FIXME: should probably use getopt, and add a (more complete?) help option */
static
void
usage
(
void
)
{
fprintf
(
stderr
,
"
\n
u
sage: %s [options]
\n\n
"
,
server_argv0
);
fprintf
(
stderr
,
"
o
ptions:
\n
"
);
fprintf
(
stderr
,
" -d
<n> set debug level to <n>
\n
"
);
fprintf
(
stderr
,
" -f remain in the foreground for debugging
\n
"
);
fprintf
(
stderr
,
" -h display this help message
\n
"
);
fprintf
(
stderr
,
" -k[n] kill the current wineserver, optionally with signal n
\n
"
);
fprintf
(
stderr
,
" -p[n] make server persistent, optionally for n seconds
\n
"
);
fprintf
(
stderr
,
" -v display version information and exit
\n
"
);
fprintf
(
stderr
,
" -w wait until the current wineserver terminates
\n
"
);
fprintf
(
stderr
,
"
U
sage: %s [options]
\n\n
"
,
server_argv0
);
fprintf
(
stderr
,
"
O
ptions:
\n
"
);
fprintf
(
stderr
,
" -d
[n], --debug[=n] set debug level to n or +1 if n not specified
\n
"
);
fprintf
(
stderr
,
" -f
, --foreground
remain in the foreground for debugging
\n
"
);
fprintf
(
stderr
,
" -h
, --help
display this help message
\n
"
);
fprintf
(
stderr
,
" -k[n]
, --kill[=n]
kill the current wineserver, optionally with signal n
\n
"
);
fprintf
(
stderr
,
" -p[n]
, --persistent[=n]
make server persistent, optionally for n seconds
\n
"
);
fprintf
(
stderr
,
" -v
, --version
display version information and exit
\n
"
);
fprintf
(
stderr
,
" -w
, --wait
wait until the current wineserver terminates
\n
"
);
fprintf
(
stderr
,
"
\n
"
);
}
static
void
parse_args
(
int
argc
,
char
*
argv
[]
)
{
int
i
,
ret
;
int
ret
,
optc
;
static
struct
option
long_options
[]
=
{
{
"debug"
,
2
,
0
,
'd'
},
{
"foreground"
,
0
,
0
,
'f'
},
{
"help"
,
0
,
0
,
'h'
},
{
"kill"
,
2
,
0
,
'k'
},
{
"persistent"
,
2
,
0
,
'p'
},
{
"version"
,
0
,
0
,
'v'
},
{
"wait"
,
0
,
0
,
'w'
},
{
NULL
,
0
,
0
,
0
}
};
server_argv0
=
argv
[
0
];
for
(
i
=
1
;
i
<
argc
;
i
++
)
while
((
optc
=
getopt_long
(
argc
,
argv
,
"d::fhk::p::vw"
,
long_options
,
NULL
))
!=
-
1
)
{
if
(
argv
[
i
][
0
]
==
'-'
)
switch
(
optc
)
{
switch
(
argv
[
i
][
1
])
{
case
'd'
:
if
(
isdigit
(
argv
[
i
][
2
]))
debug_level
=
atoi
(
argv
[
i
]
+
2
);
else
debug_level
++
;
if
(
optarg
&&
isdigit
(
*
optarg
))
debug_level
=
atoi
(
optarg
);
else
debug_level
++
;
break
;
case
'f'
:
foreground
=
1
;
...
...
@@ -80,12 +95,14 @@ static void parse_args( int argc, char *argv[] )
exit
(
0
);
break
;
case
'k'
:
if
(
isdigit
(
argv
[
i
][
2
]))
ret
=
kill_lock_owner
(
atoi
(
argv
[
i
]
+
2
)
);
else
ret
=
kill_lock_owner
(
-
1
);
if
(
optarg
&&
isdigit
(
*
optarg
))
ret
=
kill_lock_owner
(
atoi
(
optarg
)
);
else
ret
=
kill_lock_owner
(
-
1
);
exit
(
!
ret
);
case
'p'
:
if
(
isdigit
(
argv
[
i
][
2
]
))
master_socket_timeout
=
(
timeout_t
)
atoi
(
argv
[
i
]
+
2
)
*
-
TICKS_PER_SEC
;
if
(
optarg
&&
isdigit
(
*
optarg
))
master_socket_timeout
=
(
timeout_t
)
atoi
(
optarg
)
*
-
TICKS_PER_SEC
;
else
master_socket_timeout
=
TIMEOUT_INFINITE
;
break
;
...
...
@@ -96,16 +113,8 @@ static void parse_args( int argc, char *argv[] )
wait_for_lock
();
exit
(
0
);
default:
fprintf
(
stderr
,
"wineserver: unknown option '%s'
\n
"
,
argv
[
i
]
);
usage
();
exit
(
1
);
}
}
else
{
fprintf
(
stderr
,
"wineserver: unknown argument '%s'.
\n
"
,
argv
[
i
]
);
usage
();
exit
(
1
);
}
}
}
...
...
server/wineserver.man.in
View file @
67daa7f7
...
...
@@ -16,7 +16,7 @@ useful to start \fBwineserver\fR explicitly with different options, as
explained below.
.SH OPTIONS
.TP
.BI \-d [n]
.BI \-d [n]
,\ --debug [=n]
Set the debug level to
.I n.
0 means no debugging information, 1 is the normal level, and 2 is for
...
...
@@ -27,14 +27,14 @@ stderr. \fBwine(1)\fR will automatically set the debug level when
starting \fBwineserver\fR if the +server option is set in the
WINEDEBUG variable.
.TP
.B \-f
.B \-f
, --foreground
Make the server remain in the foreground for easier debugging, for
instance when running it under a debugger.
.TP
.B \-h
.B \-h
, --help
Display a help message.
.TP
.BI \-k [n]
.BI \-k [n]
,\ --kill [=n]
Kill the currently running
.B wineserver,
optionally by sending signal \fIn\fR. If no signal is specified, sends
...
...
@@ -42,7 +42,7 @@ a SIGINT first and then a SIGKILL. The instance of \fBwineserver\fR
that is killed is selected based on the WINEPREFIX environment
variable.
.TP
.BI \-p [n]
.BI \-p [n]
,\ --persistent [=n]
Specify the \fBwineserver\fR persistence delay, i.e. the amount of
time that the server will keep running when all client processes have
terminated. This avoids the cost of shutting down and starting again
...
...
@@ -50,10 +50,10 @@ when programs are launched in quick succession. The timeout \fIn\fR is
in seconds, the default value is 3 seconds. If \fIn\fR is not
specified, the server stays around forever.
.TP
.B \-v
.B \-v
, --version
Display version information and exit.
.TP
.B \-w
.B \-w
, --wait
Wait until the currently running
.B wineserver
terminates.
...
...
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