论坛: 编程破解 标题: ND麻烦贴个UNIX上标准C库的strcmp的源码出来,感谢 复制本贴地址    
作者: sniper167 [sniper167]    论坛用户   登录
这个是linux 2.4.18的
代码:

/**
* strcmp - Compare two strings
* @cs: One string
* @ct: Another string
*/
int strcmp(const char * cs,const char * ct)
{
register signed char __res;

while (1) {
if ((__res = *cs - *ct++) != 0 || !*cs++)
break;
}

return __res;
}




[此贴被 啥都不会(sniper167) 在 10月14日22时09分 编辑过]

地主 发表时间: 06-10-14 22:08

回复: radom [f_h]   论坛用户   登录
代码:


/*
*  arch/s390/lib/strcmp.S
*    S390 strcmp routine
*
*  S390 version
*    Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation
*    Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com),
*/

/*
* R2 = address of compare string
* R3 = address of test string
*/
        .globl  strcmp
strcmp:
        SR      0,0
        SR      1,1
        CLST    2,3
        JO      .-4
        JE      strcmp_equal
        IC      0,0(3)
        IC      1,0(2)
        SR      1,0
strcmp_equal:
        LR      2,1
        BR      14
       



[此贴被 radom(f_h) 在 10月15日02时35分 编辑过]

B1层 发表时间: 06-10-15 00:14

回复: sniper167 [sniper167]   论坛用户   登录


B2层 发表时间: 06-10-15 01:06

回复: NetDemon [netdemon]   ADMIN   登录
代码:

#include <sys/cdefs.h>
#include <string.h>

/*
* Compare strings.
*/
int
strcmp(s1, s2)
        register const char *s1, *s2;
{
        while (*s1 == *s2++)
                if (*s1++ == 0)
                        return (0);
        return (*(const unsigned char *)s1 - *(const unsigned char *)(s2 - 1));
}



B3层 发表时间: 06-10-15 02:24

论坛: 编程破解

20CN网络安全小组版权所有
Copyright © 2000-2010 20CN Security Group. All Rights Reserved.
论坛程序编写:NetDemon

粤ICP备05087286号