Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
P
proxy-in-proxychains
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nanahira
proxy-in-proxychains
Commits
c2c29fd6
Commit
c2c29fd6
authored
Dec 18, 2015
by
Krzysztof Klis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Return error code on syntax error
parent
40d09f55
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
5 deletions
+6
-5
proxy.c
proxy.c
+6
-5
No files found.
proxy.c
View file @
c2c29fd6
...
@@ -55,6 +55,7 @@
...
@@ -55,6 +55,7 @@
#define CLIENT_CONNECT_ERROR -7
#define CLIENT_CONNECT_ERROR -7
#define CREATE_PIPE_ERROR -8
#define CREATE_PIPE_ERROR -8
#define BROKEN_PIPE_ERROR -9
#define BROKEN_PIPE_ERROR -9
#define SYNTAX_ERROR -10
typedef
enum
{
TRUE
=
1
,
FALSE
=
0
}
bool
;
typedef
enum
{
TRUE
=
1
,
FALSE
=
0
}
bool
;
...
@@ -80,7 +81,7 @@ int main(int argc, char *argv[]) {
...
@@ -80,7 +81,7 @@ int main(int argc, char *argv[]) {
if
(
local_port
<
0
)
{
if
(
local_port
<
0
)
{
printf
(
"Syntax: %s -l local_port -h remote_host -p remote_port [-i
\"
input parser
\"
] [-o
\"
output parser
\"
]
\n
"
,
argv
[
0
]);
printf
(
"Syntax: %s -l local_port -h remote_host -p remote_port [-i
\"
input parser
\"
] [-o
\"
output parser
\"
]
\n
"
,
argv
[
0
]);
return
0
;
return
local_port
;
}
}
if
((
server_sock
=
create_socket
(
local_port
))
<
0
)
{
// start server
if
((
server_sock
=
create_socket
(
local_port
))
<
0
)
{
// start server
...
@@ -102,7 +103,7 @@ int main(int argc, char *argv[]) {
...
@@ -102,7 +103,7 @@ int main(int argc, char *argv[]) {
close
(
server_sock
);
close
(
server_sock
);
}
}
return
0
;
return
EXIT_SUCCESS
;
}
}
/* Parse command line options */
/* Parse command line options */
...
@@ -127,12 +128,12 @@ int parse_options(int argc, char *argv[]) {
...
@@ -127,12 +128,12 @@ int parse_options(int argc, char *argv[]) {
p
=
TRUE
;
p
=
TRUE
;
break
;
break
;
case
'i'
:
case
'i'
:
opt_in
=
TRUE
;
cmd_in
=
optarg
;
cmd_in
=
optarg
;
opt_in
=
TRUE
;
break
;
break
;
case
'o'
:
case
'o'
:
opt_out
=
TRUE
;
cmd_out
=
optarg
;
cmd_out
=
optarg
;
opt_out
=
TRUE
;
break
;
break
;
}
}
}
}
...
@@ -140,7 +141,7 @@ int parse_options(int argc, char *argv[]) {
...
@@ -140,7 +141,7 @@ int parse_options(int argc, char *argv[]) {
if
(
l
&&
h
&&
p
)
{
if
(
l
&&
h
&&
p
)
{
return
local_port
;
return
local_port
;
}
else
{
}
else
{
return
-
1
;
return
SYNTAX_ERROR
;
}
}
}
}
...
...
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