void rush(int w, int l) { int x; int y; x = 1; y = 1; if (x == 1 && y == 1) ft_putchar('o'); while (y <= l) { while (x <= w) { if (l > 1) left_line_bottom_left_corner(l, x, y); if (w > 1) upper_line_right_corner(w, x, y); if (l > 1 && w > 1) the_rest(w, l, x, y); x++; } y++; x = 1; ft_putchar('\n'); } }
bool PWSRun::runcmd(const StringX &run_command, const bool &bAutotype) const { // Get first parameter either enclosed by quotes or delimited by a space StringX full_string(run_command), first_part(_T("")), the_rest(_T("")); StringX env_var, sx_temp(_T("")); StringX::size_type end_delim; bool bfound(true); TrimLeft(full_string, _T(" ")); if (full_string.c_str()[0] == _T('"')) { end_delim = full_string.find(_T('"'), 1); first_part = full_string.substr(1, end_delim - 1); the_rest = full_string.substr(end_delim + 1); } else { end_delim = full_string.find(_T(' ')); if (end_delim != StringX::npos) { first_part = full_string.substr(0, end_delim); the_rest = full_string.substr(end_delim + 1); } else first_part = full_string; } // tokenize into separate elements using % as the field separator. // If this corresponds to a set envrionmental variable - replace it // and rebuild the command for (StringX::size_type st_startpos = 0; st_startpos < first_part.size(); /* st_startpos advanced in body */) { StringX::size_type st_next = first_part.find(_T('%'), st_startpos); if (st_next == StringX::npos) { sx_temp += first_part.substr(st_startpos); break; } if (st_next > 0) { env_var = first_part.substr(st_startpos, st_next - st_startpos); size_t mblen = pws_os::wcstombs(NULL, 0, env_var.c_str(), size_t(-1), false); unsigned char * mbtemp = new unsigned char[mblen + 1]; // Finally get result size_t tmplen = pws_os::wcstombs((char *)mbtemp, mblen, env_var.c_str(), size_t(-1), false); if (tmplen != mblen) { return false; } mbtemp[mblen - 1] = '\0'; StringX envar = (pws_os::getenv((char *)mbtemp, false)).c_str(); if (!envar.empty()) { sx_temp += envar; } else { sx_temp += StringX(_T("%")) + env_var + StringX(_T("%")); } } st_startpos = st_next + 1; // too complex for for statement } // tokenization for loop // Replace string by rebuilt string first_part = sx_temp; first_part = getruncmd(first_part, bfound); bool rc; if (bfound) rc = issuecmd(first_part, the_rest, bAutotype); else rc = issuecmd(full_string, _T(""), bAutotype); return rc; }