Skip to content

Commit

Permalink
update version 3.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Paradiseduo committed Nov 23, 2020
1 parent e8b9c32 commit 7105fe4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
2 changes: 1 addition & 1 deletion tcping/Version.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
#ifndef Version_h
#define Version_h

#define VERSION @"3.1"
#define VERSION @"3.2"

#endif /* Version_h */
21 changes: 15 additions & 6 deletions tcping/main.m
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,20 @@ int main(int argc, const char * argv[]) {
if (argc == 3) {
NSString * a = [[NSString alloc] initWithCString:argv[1] encoding:NSUTF8StringEncoding];
NSString * b = [[NSString alloc] initWithCString:argv[2] encoding:NSUTF8StringEncoding];
if ([a length] > [b length]) {
if ([a containsString:@":"]) {
ip = a;
port = b;
} else {
} else if ([b containsString:@":"]) {
ip = b;
port = a;
} else {
if ([a length] > [b length]) {
ip = a;
port = b;
} else {
ip = b;
port = a;
}
}
UInt16 p = port.intValue;
if (p) {
Expand Down Expand Up @@ -69,11 +77,10 @@ int main(int argc, const char * argv[]) {
}
} else {
if (i != countIndex && i != countStringIndex) {
if ([port length] >= [item length]) {
port = item;
}
if ([ip length] <= [item length]) {
if ([item containsString:@":"] || [item containsString:@"."]) {
ip = item;
} else {
port = item;
}
}
}
Expand All @@ -87,9 +94,11 @@ int main(int argc, const char * argv[]) {
ping(ip, p, c, group, queue, sockets);
} else {
[ConsoleIO writeMessage:@"Count only a number, or out of range(1-65535)" to:OutputTypeStandard];
return 0;
}
} else {
[ConsoleIO writeMessage:@"Port only a number, or out of range(1-65535)" to:OutputTypeStandard];
return 0;
}
} else {
[ConsoleIO printUsage];
Expand Down

0 comments on commit 7105fe4

Please sign in to comment.