Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Arne Øslebø
mapi
Commits
deed4db5
Commit
deed4db5
authored
Aug 28, 2006
by
Browse files
fixes in command line arguments handling
git-svn-id:
file:///home/svn/mapi/trunk@829
8d5bb341-7cf1-0310-8cf6-ba355fef3186
parent
ef740130
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/mapid.c
View file @
deed4db5
...
...
@@ -2543,65 +2543,48 @@ static void
parse_arguments
(
int
argc
,
char
**
argv
)
{
int
c
;
const
char
optstring
[]
=
"as:i:ht:r"
;
const
struct
option
longopts
[]
=
{
#ifdef WITH_ADMISSION_CONTROL
{
"admctrl"
,
no_argument
,
NULL
,
'a'
},
{
"shmpath"
,
required_argument
,
NULL
,
's'
},
{
"shmid"
,
required_argument
,
NULL
,
'i'
},
{
"timeout"
,
required_argument
,
NULL
,
't'
},
#ifdef WITH_RESOURCE_CONTROL
{
"resctrl"
,
no_argument
,
NULL
,
'r'
},
static
const
char
optstring
[]
=
"vhr"
;
#else
static
const
char
optstring
[]
=
"vh"
;
#endif
static
const
struct
option
longopts
[]
=
{
#ifdef WITH_RESOURCE_CONTROL
{
"resctrl"
,
no_argument
,
NULL
,
'r'
},
#endif
{
"version"
,
no_argument
,
NULL
,
'v'
},
{
"help"
,
no_argument
,
NULL
,
'h'
},
{
""
,
0
,
NULL
,
0
}
{
NULL
,
0
,
NULL
,
0
}
};
while
((
c
=
getopt_long
(
argc
,
argv
,
optstring
,
longopts
,
NULL
))
>=
0
)
switch
(
c
)
{
#ifdef WITH_ADMISSION_CONTROL
case
'a'
:
admission_control_enabled
=
1
;
break
;
case
's'
:
admctrl_pathname
=
optarg
;
break
;
case
'i'
:
admctrl_pid
=
*
optarg
;
break
;
case
't'
:
admctrl_timeout
=
strtol
(
optarg
,
NULL
,
10
);
if
(
admctrl_timeout
<
0
)
{
printf
(
"Invalid timeout!
\n
Using default %ld microsecs
\n
"
,
admctrl_timeout
);
admctrl_timeout
=
DEFAULT_ADMCTRL_TIMEOUT
;
}
break
;
while
((
c
=
getopt_long
(
argc
,
argv
,
optstring
,
longopts
,
NULL
))
!=
-
1
)
{
switch
(
c
)
{
#ifdef WITH_RESOURCE_CONTROL
case
'r'
:
resource_control_enabled
=
1
;
break
;
#endif
resource_control_enabled
=
1
;
break
;
#endif
case
'v'
:
printf
(
"mapid: MAPI v%s
\n
"
,
PACKAGE_VERSION
);
exit
(
EXIT_SUCCESS
);
break
;
case
0
:
// long option without an equivalent short arg
case
'h'
:
print_usage
(
argv
[
0
]);
exit
(
EXIT_SUCCESS
);
case
'?'
:
default:
print_usage
(
argv
[
0
]);
exit
(
EXIT_FAILURE
);
}
print_usage
(
argv
[
0
]);
exit
(
EXIT_FAILURE
);
}
}
}
static
void
set_debug
()
{
conf_category_entry_t
*
cat
=
NULL
;
conf_parameter_t
*
p
=
NULL
;
int
logmask
=
0
;
if
(
pc_load
(
mapid_conf
))
...
...
@@ -2610,15 +2593,14 @@ static void set_debug()
}
if
(
cat
!=
NULL
&&
cat
->
params
!=
NULL
)
p
=
cat
->
params
;
if
(
p
!=
NULL
)
{
if
(
strcmp
(
p
->
name
,
"debuglevel"
)
==
0
)
logmask
=
atoi
(
p
->
value
);
pc_close
();
}
if
(
logmask
==
0
||
logmask
==
2
)
setlogmask
(
LOG_UPTO
(
LOG_WARNING
));
if
(
logmask
==
1
)
...
...
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