Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
wsssh
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexlab
wsssh
Commits
755c2be1
Commit
755c2be1
authored
Sep 15, 2025
by
nextime
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor flag printing functions for improved code organization
parent
034ca420
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
60 additions
and
2 deletions
+60
-2
wsscp.c
wssshtools/wsscp.c
+30
-1
wsssh.c
wssshtools/wsssh.c
+30
-1
No files found.
wssshtools/wsscp.c
View file @
755c2be1
...
@@ -112,6 +112,31 @@ void print_trans_flag(void) {
...
@@ -112,6 +112,31 @@ void print_trans_flag(void) {
printf
(
"
\n
"
);
printf
(
"
\n
"
);
}
}
void
print_palestinian_flag
(
void
)
{
const
char
*
reset
=
"
\033
[0m"
;
const
char
*
red
=
"
\033
[41m"
;
const
char
*
black
=
"
\033
[40m"
;
const
char
*
white
=
"
\033
[47m"
;
const
char
*
green
=
"
\033
[42m"
;
int
width
=
40
;
int
triangle_widths
[
6
]
=
{
2
,
4
,
6
,
8
,
10
,
12
};
const
char
*
stripe_colors
[
6
]
=
{
black
,
black
,
white
,
white
,
green
,
green
};
for
(
int
i
=
0
;
i
<
6
;
i
++
)
{
printf
(
"%s"
,
red
);
for
(
int
j
=
0
;
j
<
triangle_widths
[
i
];
j
++
)
{
printf
(
" "
);
}
printf
(
"%s"
,
stripe_colors
[
i
]);
for
(
int
j
=
triangle_widths
[
i
];
j
<
width
;
j
++
)
{
printf
(
" "
);
}
printf
(
"%s
\n
"
,
reset
);
}
printf
(
"
\n
"
);
}
void
print_usage
(
const
char
*
program_name
)
{
void
print_usage
(
const
char
*
program_name
)
{
fprintf
(
stderr
,
"Usage: %s [options] [scp_options...] source destination
\n
"
,
program_name
);
fprintf
(
stderr
,
"Usage: %s [options] [scp_options...] source destination
\n
"
,
program_name
);
fprintf
(
stderr
,
"WebSocket SCP Wrapper - SCP through WebSocket tunnels
\n\n
"
);
fprintf
(
stderr
,
"WebSocket SCP Wrapper - SCP through WebSocket tunnels
\n\n
"
);
...
@@ -1221,12 +1246,16 @@ int main(int argc, char *argv[]) {
...
@@ -1221,12 +1246,16 @@ int main(int argc, char *argv[]) {
return
0
;
return
0
;
}
}
// Handle --help before parsing
// Handle --help
and --free
before parsing
for
(
int
i
=
1
;
i
<
argc
;
i
++
)
{
for
(
int
i
=
1
;
i
<
argc
;
i
++
)
{
if
(
strcmp
(
argv
[
i
],
"--help"
)
==
0
||
strcmp
(
argv
[
i
],
"-h"
)
==
0
)
{
if
(
strcmp
(
argv
[
i
],
"--help"
)
==
0
||
strcmp
(
argv
[
i
],
"-h"
)
==
0
)
{
print_usage
(
argv
[
0
]);
print_usage
(
argv
[
0
]);
free
(
config_domain
);
free
(
config_domain
);
return
0
;
return
0
;
}
else
if
(
strcmp
(
argv
[
i
],
"--free"
)
==
0
)
{
print_palestinian_flag
();
free
(
config_domain
);
return
0
;
}
}
}
}
...
...
wssshtools/wsssh.c
View file @
755c2be1
...
@@ -146,6 +146,31 @@ void print_trans_flag(void) {
...
@@ -146,6 +146,31 @@ void print_trans_flag(void) {
printf
(
"
\n
"
);
printf
(
"
\n
"
);
}
}
void
print_palestinian_flag
(
void
)
{
const
char
*
reset
=
"
\033
[0m"
;
const
char
*
red
=
"
\033
[41m"
;
const
char
*
black
=
"
\033
[40m"
;
const
char
*
white
=
"
\033
[47m"
;
const
char
*
green
=
"
\033
[42m"
;
int
width
=
40
;
int
triangle_widths
[
6
]
=
{
2
,
4
,
6
,
8
,
10
,
12
};
const
char
*
stripe_colors
[
6
]
=
{
black
,
black
,
white
,
white
,
green
,
green
};
for
(
int
i
=
0
;
i
<
6
;
i
++
)
{
printf
(
"%s"
,
red
);
for
(
int
j
=
0
;
j
<
triangle_widths
[
i
];
j
++
)
{
printf
(
" "
);
}
printf
(
"%s"
,
stripe_colors
[
i
]);
for
(
int
j
=
triangle_widths
[
i
];
j
<
width
;
j
++
)
{
printf
(
" "
);
}
printf
(
"%s
\n
"
,
reset
);
}
printf
(
"
\n
"
);
}
void
print_usage
(
const
char
*
program_name
)
{
void
print_usage
(
const
char
*
program_name
)
{
fprintf
(
stderr
,
"Usage: %s [options] user@client.domain [ssh_options...]
\n
"
,
program_name
);
fprintf
(
stderr
,
"Usage: %s [options] user@client.domain [ssh_options...]
\n
"
,
program_name
);
fprintf
(
stderr
,
"WebSocket SSH Wrapper - SSH through WebSocket tunnels
\n\n
"
);
fprintf
(
stderr
,
"WebSocket SSH Wrapper - SSH through WebSocket tunnels
\n\n
"
);
...
@@ -1103,12 +1128,16 @@ int main(int argc, char *argv[]) {
...
@@ -1103,12 +1128,16 @@ int main(int argc, char *argv[]) {
return
0
;
return
0
;
}
}
// Handle --help before parsing
// Handle --help
and --free
before parsing
for
(
int
i
=
1
;
i
<
argc
;
i
++
)
{
for
(
int
i
=
1
;
i
<
argc
;
i
++
)
{
if
(
strcmp
(
argv
[
i
],
"--help"
)
==
0
||
strcmp
(
argv
[
i
],
"-h"
)
==
0
)
{
if
(
strcmp
(
argv
[
i
],
"--help"
)
==
0
||
strcmp
(
argv
[
i
],
"-h"
)
==
0
)
{
print_usage
(
argv
[
0
]);
print_usage
(
argv
[
0
]);
free
(
config_domain
);
free
(
config_domain
);
return
0
;
return
0
;
}
else
if
(
strcmp
(
argv
[
i
],
"--free"
)
==
0
)
{
print_palestinian_flag
();
free
(
config_domain
);
return
0
;
}
}
}
}
...
...
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