DocumentationGenerated on Thu Aug 31 00:02:41 2006 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Utilities Class Reference#include <Utilities.h>
Detailed Description
Definition at line 17 of file Utilities.h. Member Function Documentation
Definition at line 28 of file Utilities.cpp. Referenced by Configuration::fill_buff(), and Handler::init(). 00029 { 00030 int spaces = 0; 00031 00032 // removing leading spaces... 00033 while(isspace(victim[0])) 00034 victim.erase(0, 1); 00035 00036 // removing trailing spaces... 00037 while(isspace(victim[victim.size() - 1])) 00038 victim.erase(victim.size() - 1, 1); 00039 00040 for(string::iterator victim_it = victim.begin(); victim_it != victim.end(); 00041 ++victim_it) 00042 { 00043 if(isspace(*victim_it) || !isascii(*victim_it)) 00044 { 00045 if(*victim_it == ' ') 00046 spaces++; 00047 if((isspace(*(victim_it - 1))) || !isascii(*victim_it)) 00048 { 00049 if(*victim_it == ' ') 00050 spaces--; 00051 victim_it = victim.erase(victim_it); 00052 --victim_it; 00053 } 00054 } 00055 } 00056 return(spaces); 00057 }
Definition at line 30 of file Utilities.h. Referenced by Commands::cwd(), Handler::interpreter(), Commands::list(), Commands::mlsx(), parse_perms_ls(), parse_perms_num(), Commands::pasv(), Commands::port(), Commands::rname(), Commands::sim1(), Commands::sim2(), Commands::stor(), and Connection::verify_cert().
Definition at line 60 of file Utilities.cpp. Referenced by data_wrapper(), exit_baby(), lifebeat(), Commands::list_file(), listener(), Log::log_this(), Commands::mlsx(), Data::open_active(), Connection::operator<<(), User::operator>>(), Commands::pasv(), Commands::port(), Commands::retr(), Connection::send(), Configuration::set_structs(), sig_handler(), Commands::sim2(), Data::~Data(), and User::~User(). 00061 { 00062 string message; 00063 char buf[12] = {0}; 00064 00065 snprintf(buf, 12, "%lld", num); 00066 message = buf; 00067 00068 return(message); 00069 }
Definition at line 72 of file Utilities.cpp. References is_set(). Referenced by Commands::list_file(). 00073 { 00074 string attr; 00075 00076 attr = "----------"; 00077 00078 if(S_ISDIR(perm)) 00079 attr[0] = 'd'; 00080 else if(S_ISLNK(perm)) 00081 attr[0] = 'l'; 00082 else if(S_ISCHR(perm)) 00083 attr[0] = 'c'; 00084 else if(S_ISBLK(perm)) 00085 attr[0] = 'b'; 00086 else if(S_ISFIFO(perm)) 00087 attr[0] = 'p'; 00088 else if(S_ISSOCK(perm)) 00089 attr[0] = 's'; 00090 00091 if(is_set(perm, S_IRUSR)) attr[1] = 'r'; 00092 if(is_set(perm, S_IWUSR)) attr[2] = 'w'; 00093 if(is_set(perm, S_IXUSR)) { 00094 if(is_set(perm, S_ISUID)) attr[3] = 's'; 00095 else attr[3] = 'x'; 00096 } else if(is_set(perm, S_ISUID)) attr[3] = 'S'; 00097 00098 if(is_set(perm, S_IRGRP)) attr[4] = 'r'; 00099 if(is_set(perm, S_IWGRP)) attr[5] = 'w'; 00100 if(is_set(perm, S_IXGRP)) { 00101 if(is_set(perm, S_ISGID)) attr[6] = 's'; 00102 else attr[6] = 'x'; 00103 } else if(is_set(perm, S_ISGID)) attr[6] = 'S'; 00104 00105 if(is_set(perm, S_IROTH)) attr[7] = 'r'; 00106 if(is_set(perm, S_IWOTH)) attr[8] = 'w'; 00107 if(is_set(perm, S_IXOTH)) { 00108 if(is_set(perm, S_ISVTX)) attr[9] = 't'; 00109 else attr[9] = 'x'; 00110 } else if(is_set(perm, S_ISVTX)) attr[9] = 'T'; 00111 00112 return(attr); 00113 }
Here is the call graph for this function: ![]()
Definition at line 115 of file Utilities.cpp. References is_set(). Referenced by Commands::mlsx(). 00116 { 00117 string attr; 00118 00119 attr = "0000"; 00120 00121 if(is_set(perm, S_ISUID)) 00122 attr[0] += 4; 00123 if(is_set(perm, S_ISGID)) 00124 attr[0] += 2; 00125 if(is_set(perm, S_ISVTX)) 00126 attr[0]++; 00127 if(is_set(perm, S_IRUSR)) 00128 attr[1] += 4; 00129 if(is_set(perm, S_IWUSR)) 00130 attr[1] += 2; 00131 if(is_set(perm, S_IXUSR)) 00132 attr[1]++; 00133 00134 if(is_set(perm, S_IRGRP)) 00135 attr[2] += 4; 00136 if(is_set(perm, S_IWGRP)) 00137 attr[2] += 2; 00138 if(is_set(perm, S_IXGRP)) 00139 attr[2]++; 00140 00141 if(is_set(perm, S_IROTH)) 00142 attr[3] += 4; 00143 if(is_set(perm, S_IWOTH)) 00144 attr[3] += 2; 00145 if(is_set(perm, S_IXOTH)) 00146 attr[3]++; 00147 00148 return(attr); 00149 }
Here is the call graph for this function: ![]()
Definition at line 16 of file Utilities.cpp. 00017 { 00018 size_t last = victim.find_last_of('\n'); 00019 if(last >= 0 && last < victim.size()) 00020 victim = victim.erase(last); 00021 }
Definition at line 152 of file Utilities.cpp. Referenced by data_wrapper(), Commands::list_file(), Log::log_main(), Commands::mlsx(), and Commands::sim2(). 00154 { 00155 char *timestr = new char[len + 1]; 00156 struct tm now; 00157 memset(timestr, 0, len + 1); 00158 00159 if(timep == 0) 00160 timep = time(NULL); 00161 localtime_r(&timep, &now); 00162 int ret = strftime(timestr, len, format.c_str(), &now); 00163 victim = timestr; 00164 00165 delete[] timestr; 00166 return(ret); 00167 }
The documentation for this class was generated from the following files: |
- Copyright © 2005, BabyFTPd
- Powered by: