- 论坛徽章:
- 0
|
本帖最后由 wangzhen11aaa 于 2011-09-29 15:43 编辑
<---------------__________________
返回到
parse_content_disposion()
{
int isFilename = BOUNDED_EQUAL_NO_CASE ( name.b, name.e, "filename" );/*判断是否是个文件名*/
_____________------------------> D (define) /*wget-1.13/src/wget.h*/
这里才恍然过来,远来的test的作用就是这样.......,前面安排了很多路径,
#define BOUNDED_EQUAL_NO_CASE (beg , end, string_literal)
((end) - (beg) == sizeof(string_literal) -1 && ! strncasecmp (beg, string_literal, sizeof(string_literal) -1 ))
__________________________--------------------------->
/*src/cmpt.c*/
int strncasecmp(const char *s1, const char *s2, size_t)
{
......
do{
c1 = c_tolower(*p1++);
c2 = c_tolower(*p2++);
if (c1 == '\0' | | c1 != c2) /*如果c1中出现'\0',或者c1 != c2,这句话有意思。
return c1 - c2; 就返回c1 - c2;/*一般只有test中第一个字符串会成功,返回为0*/
}while(--n > 0);
return c1 - c2;
}
前面的memrchr( )
#include <string.h>
void *memchr(const void *s, int c, size_t n);
void *memrchr(const void *s, int c, size_t n);
Description
The memchr() function scans the first n bytes of the memory area pointed to by s for the character c. The first byte to match c (interpreted as an unsigned character) stops the operation.
The memrchr() function is like the memchr() function, except that it searches backwards from the end of the n bytes pointed to by s instead of forwards from the front.
Return Value
The memchr() and memrchr() functions return a pointer to the matching byte or NULL if the character does not occur in the given memory area.
<-------------__________
- 回到
- parse_content_disposion()
- {
- .......
- else
- *filename = strdupdelim(value.b, value.e)/*__________------------->src/utils.c */
- char *strdupdelim(const char * beg, const char *end)
- {
- char *res = xmalloc(end - beg + 1); _____________----------------->/*lib/xmalloc.c*/
- memcpy(res, beg, end - beg);
- res[end - beg] = '\0'
- return res;
- }
- void * xmalloc(size_t n)
- {
- void *p = malloc(n);
- if (! p && n! = 0)
- xalloc_die( ); ___________-------------->/* /lib/xalloc-die.c*/
- return p;
- }
- void xalloc_die(void)
- {
- error(exit_failure, 0, "%s", _(memory exhausted));
- abort(); /*This is so familiar to me : )_________------------>*/
- }
复制代码 |
|