| 136 | } |
| 137 | |
| 138 | static bool create_http_servlet(file_tmpl& tmpl, const char* type) |
| 139 | { |
| 140 | tpl_t* tpl = tmpl.open_tpl("http_servlet.cpp"); |
| 141 | if (tpl == NULL) { |
| 142 | return false; |
| 143 | } |
| 144 | |
| 145 | printf("Do you want add cookie? [y/n]: "); |
| 146 | fflush(stdout); |
| 147 | |
| 148 | char buf[64]; |
| 149 | int n = acl_vstream_gets_nonl(ACL_VSTREAM_IN, buf, sizeof(buf)); |
| 150 | if (n != ACL_VSTREAM_EOF && strcasecmp(buf, "y") == 0) { |
| 151 | set_cookies(tpl); |
| 152 | } |
| 153 | |
| 154 | string filepath; |
| 155 | filepath.format("%s/http_servlet.cpp", tmpl.get_project_name()); |
| 156 | if (tpl_save_as(tpl, filepath.c_str()) != TPL_OK) { |
| 157 | printf("save to %s error: %s\r\n", filepath.c_str(), |
| 158 | last_serror()); |
| 159 | tpl_free(tpl); |
| 160 | return false; |
| 161 | } |
| 162 | |
| 163 | printf("create %s ok.\r\n", filepath.c_str()); |
| 164 | tpl_free(tpl); |
| 165 | |
| 166 | // ���÷�����ģ������ |
| 167 | return create_service(tmpl, type); |
| 168 | } |
| 169 | |
| 170 | void http_creator(const char* name, const char* type) |
| 171 | { |
no test coverage detected
searching dependent graphs…