Changeset 2725 in MondoRescue for branches/2.2.9/mindi-busybox/networking/httpd_indexcgi.c
- Timestamp:
- Feb 25, 2011, 9:26:54 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2.9/mindi-busybox/networking/httpd_indexcgi.c
r1765 r2725 2 2 * Copyright (c) 2007 Denys Vlasenko <vda.linux@googlemail.com> 3 3 * 4 * Licensed under GPLv2, see file LICENSE in this tarball for details.4 * Licensed under GPLv2, see file LICENSE in this source tree. 5 5 */ 6 6 … … 29 29 /* Currently malloc machinery is the biggest part of libc we pull in. */ 30 30 /* We have only one realloc and one strdup, any idea how to do without? */ 31 /* Size (i386, approximate): 31 32 /* Size (i386, static uclibc, approximate): 32 33 * text data bss dec hex filename 33 34 * 13036 44 3052 16132 3f04 index.cgi … … 126 127 if (buffer + (BUFFER_SIZE-HEADROOM) - dst >= size) 127 128 return; 128 write( 1, buffer, dst - buffer);129 write(STDOUT_FILENO, buffer, dst - buffer); 129 130 dst = buffer; 130 131 } … … 149 150 *dst = c; 150 151 if ((c - '0') > 9 /* not a digit */ 151 && ((c|0x20) - 'a') > 26/* not A-Z or a-z */152 && ((c|0x20) - 'a') > ('z' - 'a') /* not A-Z or a-z */ 152 153 && !strchr("._-+@", c) 153 154 ) { … … 211 212 } 212 213 213 int main( void)214 int main(int argc, char *argv[]) 214 215 { 215 216 dir_list_t *dir_list; … … 226 227 if (!QUERY_STRING 227 228 || QUERY_STRING[0] != '/' 229 || strstr(QUERY_STRING, "//") 228 230 || strstr(QUERY_STRING, "/../") 229 231 || strcmp(strrchr(QUERY_STRING, '/'), "/..") == 0 … … 290 292 cdir = dir_list; 291 293 while (dir_list_count--) { 292 struct tm * tm;294 struct tm *ptm; 293 295 294 296 if (S_ISDIR(cdir->dl_mode)) { … … 314 316 fmt_ull(cdir->dl_size); 315 317 fmt_str("<td class=dt>"); 316 tm = gmtime(&cdir->dl_mtime);317 fmt_04u(1900 + tm->tm_year); *dst++ = '-';318 fmt_02u( tm->tm_mon + 1); *dst++ = '-';319 fmt_02u( tm->tm_mday); *dst++ = ' ';320 fmt_02u( tm->tm_hour); *dst++ = ':';321 fmt_02u( tm->tm_min); *dst++ = ':';322 fmt_02u( tm->tm_sec);318 ptm = gmtime(&cdir->dl_mtime); 319 fmt_04u(1900 + ptm->tm_year); *dst++ = '-'; 320 fmt_02u(ptm->tm_mon + 1); *dst++ = '-'; 321 fmt_02u(ptm->tm_mday); *dst++ = ' '; 322 fmt_02u(ptm->tm_hour); *dst++ = ':'; 323 fmt_02u(ptm->tm_min); *dst++ = ':'; 324 fmt_02u(ptm->tm_sec); 323 325 *dst++ = '\n'; 324 326
Note:
See TracChangeset
for help on using the changeset viewer.