⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 nstrcmp.c

📁 一个基于linux的TCP/IP协议栈的实现
💻 C
字号:
/* Copyright 1998 by Andi Kleen. Subject to the GPL. *//* $Id: nstrcmp.c,v 1.2 1998/11/15 20:11:38 freitag Exp $ */ #include <ctype.h>#include <stdlib.h>#include "util.h"/* like strcmp(), but knows about numbers */int nstrcmp(const char *astr, const char *b){    const char *a = astr;    while (*a == *b) {	if (*a == '\0')	    return 0;	a++;	b++;    }    if (isdigit(*a)) {	if (!isdigit(*b))	    return -1;	while (a > astr) {	    a--;	    if (!isdigit(*a)) {		a++;		break;	    }	    if (!isdigit(*b))		return -1;	    b--;	}	return atoi(a) > atoi(b) ? 1 : -1;    }    return *a - *b;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -