mirror of
https://github.com/DragonOS-Community/DragonOS.git
synced 2025-06-18 12:16:31 +00:00
🆕 pwd命令
This commit is contained in:
@ -34,4 +34,35 @@ size_t strlen(const char *s)
|
||||
++__res;
|
||||
}
|
||||
return __res;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
比较字符串 FirstPart and SecondPart
|
||||
FirstPart = SecondPart => 0
|
||||
FirstPart > SecondPart => 1
|
||||
FirstPart < SecondPart => -1
|
||||
*/
|
||||
|
||||
int strcmp(const char *FirstPart, const char *SecondPart)
|
||||
{
|
||||
register int __res;
|
||||
__asm__ __volatile__("cld \n\t"
|
||||
"1: \n\t"
|
||||
"lodsb \n\t"
|
||||
"scasb \n\t"
|
||||
"jne 2f \n\t"
|
||||
"testb %%al, %%al \n\t"
|
||||
"jne 1b \n\t"
|
||||
"xorl %%eax, %%eax \n\t"
|
||||
"jmp 3f \n\t"
|
||||
"2: \n\t"
|
||||
"movl $1, %%eax \n\t"
|
||||
"jl 3f \n\t"
|
||||
"negl %%eax \n\t"
|
||||
"3: \n\t"
|
||||
: "=a"(__res)
|
||||
: "D"(FirstPart), "S"(SecondPart)
|
||||
:);
|
||||
return __res;
|
||||
}
|
Reference in New Issue
Block a user