MCPcopy Create free account
hub / github.com/HASwitchPlate/openHASP / makePath

Method makePath

lib/SimpleFTPServer/FtpServer.cpp:1705–1734  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1703// true, if done
1704
1705bool FtpServer::makePath(char* fullName, char* param)
1706{
1707 if(param == NULL) param = parameter;
1708
1709 // Root or empty?
1710 if(strcmp(param, "/") == 0 || strlen(param) == 0) {
1711 strcpy(fullName, "/");
1712 return true;
1713 }
1714 // If relative path, concatenate with current dir
1715 if(param[0] != '/') {
1716 strcpy(fullName, cwdName);
1717 if(fullName[strlen(fullName) - 1] != '/') strncat(fullName, "/", FTP_CWD_SIZE);
1718 strncat(fullName, param, FTP_CWD_SIZE);
1719 } else
1720 strcpy(fullName, param);
1721 // If ends with '/', remove it
1722 uint16_t strl = strlen(fullName) - 1;
1723 if(fullName[strl] == '/' && strl > 1) fullName[strl] = 0;
1724 if(strlen(fullName) >= FTP_CWD_SIZE) {
1725 client.println(F("500 Command line too long"));
1726 return false;
1727 }
1728 for(uint8_t i = 0; i < strlen(fullName); i++)
1729 if(!legalChar(fullName[i])) {
1730 client.println(F("553 File name not allowed"));
1731 return false;
1732 }
1733 return true;
1734}
1735
1736bool FtpServer::makeExistsPath(char* path, char* param)
1737{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected