-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFTP.cpp
More file actions
29 lines (27 loc) · 724 Bytes
/
FTP.cpp
File metadata and controls
29 lines (27 loc) · 724 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/*************************************************************************
> File Name: FTP.cpp
> Author: MidCHeck
> Mail: midcheck@foxmail.com
> Created Time: 2019年07月02日 星期二 01时02分53秒
************************************************************************/
#include "FTP.h"
namespace MidCHeck{
void parse_ip(char *src, uint16_t& port){
char *ptr = src;
for(int i = 0; i < 3; ++i){
if((ptr = strstr(ptr, ",")) != nullptr){
*ptr++ = '.';
}
}
if((ptr = strstr(ptr, ",")) != nullptr){
*ptr++ = '\0';
}
char *next = strstr(ptr, ",");
if(next != nullptr) {
*next++ = '\0';
port = 256*atoi(ptr) + atoi(next);
}else{
port = atoi(ptr);
}
}
} // end namespace MidCHeck