Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Mike Perry
Tor
Commits
ffc54531
Commit
ffc54531
authored
Jul 15, 2002
by
Roger Dingledine
Browse files
removed args.c (bruce's popt stuff makes it obsolete)
svn:r49
parent
4aeca322
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/or/Makefile.am
View file @
ffc54531
...
...
@@ -7,7 +7,7 @@ bin_PROGRAMS = or
or_LDADD
=
-L
../common
-lor
or_SOURCES
=
args.c
buffers.c cell.c circuit.c command.c connection.c
\
or_SOURCES
=
buffers.c cell.c circuit.c command.c connection.c
\
connection_exit.c connection_ap.c connection_op.c connection_or.c config.c
\
main.c onion.c routers.c
...
...
src/or/args.c
deleted
100644 → 0
View file @
4aeca322
/**
* args.c
* Routines for processing command-line arguments.
*
* Matej Pfajfar <mp292@cam.ac.uk>
*/
/*
* Changes :
* $Log$
* Revision 1.1 2002/06/26 22:45:50 arma
* Initial revision
*
* Revision 1.3 2002/01/27 00:42:50 mp292
* Reviewed according to Secure-Programs-HOWTO.
*
* Revision 1.2 2002/01/04 10:05:28 badbytes
* Completed.
*
* Revision 1.1 2002/01/03 10:23:43 badbytes
* Code based on that in op. Needs to be modified.
*/
#include
"or.h"
/* prints help on using or */
void
print_usage
()
{
char
*
program
=
"or"
;
printf
(
"
\n
%s - Onion Router.
\n
Usage : %s -f config [-l loglevel -h]
\n
-h : display this help
\n
-f config : config file
\n
-l loglevel : logging threshold; one of alert|crit|err|warning|notice|info|debug
\n\n
"
,
program
,
program
);
}
/* get command-line arguments */
int
getargs
(
int
argc
,
char
*
argv
[],
char
*
args
,
char
**
conf_filename
,
int
*
loglevel
)
{
char
c
;
/* next option character */
int
gotf
=
0
;
if
((
!
args
)
||
(
!
conf_filename
)
||
(
!
loglevel
))
return
-
1
;
while
((
c
=
getopt
(
argc
,
argv
,
args
))
!=
-
1
)
{
switch
(
c
)
{
case
'f'
:
/* config file */
*
conf_filename
=
optarg
;
gotf
=
1
;
break
;
case
'h'
:
print_usage
(
argv
[
0
]);
exit
(
0
);
case
'l'
:
if
(
!
strcmp
(
optarg
,
"emerg"
))
*
loglevel
=
LOG_EMERG
;
else
if
(
!
strcmp
(
optarg
,
"alert"
))
*
loglevel
=
LOG_ALERT
;
else
if
(
!
strcmp
(
optarg
,
"crit"
))
*
loglevel
=
LOG_CRIT
;
else
if
(
!
strcmp
(
optarg
,
"err"
))
*
loglevel
=
LOG_ERR
;
else
if
(
!
strcmp
(
optarg
,
"warning"
))
*
loglevel
=
LOG_WARNING
;
else
if
(
!
strcmp
(
optarg
,
"notice"
))
*
loglevel
=
LOG_NOTICE
;
else
if
(
!
strcmp
(
optarg
,
"info"
))
*
loglevel
=
LOG_INFO
;
else
if
(
!
strcmp
(
optarg
,
"debug"
))
*
loglevel
=
LOG_DEBUG
;
else
{
log
(
LOG_ERR
,
"Error : argument to -l must be one of alert|crit|err|warning|notice|info|debug."
);
print_usage
(
argv
[
0
]);
return
-
1
;
}
break
;
case
'?'
:
if
(
isprint
(
c
))
log
(
LOG_ERR
,
"Missing argument or unknown option '-%c'. See help (-h)."
,
optopt
);
else
log
(
LOG_ERR
,
"Unknown option character 'x%x'. See help (-h)."
,
optopt
);
print_usage
(
argv
[
0
]);
return
-
1
;
break
;
default:
return
-
1
;
}
}
/* the -f option is mandatory */
if
(
!
gotf
)
{
log
(
LOG_ERR
,
"You must specify a config file with the -f option. See help (-h)."
);
return
-
1
;
}
return
0
;
}
Write
Preview
Supports
Markdown
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