1
0
mirror of https://github.com/winscp/winscp.git synced 2026-10-25 14:19:30 +03:00
Files
winscp/source/putty/utils/nullstrcmp.c
Martin Prikryl 936ab62732 PuTTY 0.77 2022-01-22 Pre-release
Source commit: fe07f3c4a6b19aa55f5b7d58e66cb55365edc059
2022-02-04 19:45:22 +01:00

22 lines
470 B
C

/*
* Compare two strings, just like strcmp, except that we tolerate null
* pointers as a legal input, and define them to compare before any
* non-null string (even the empty string).
*/
#include <string.h>
#include "defs.h"
#include "misc.h"
int nullstrcmp(const char *a, const char *b)
{
if (a == NULL && b == NULL)
return 0;
if (a == NULL)
return -1;
if (b == NULL)
return +1;
return strcmp(a, b);
}