mirror of
https://github.com/Dushistov/sdcv.git
synced 2025-12-16 18:01:54 +00:00
something working
This commit is contained in:
27
tests/call_stardict_strcmp.cpp
Normal file
27
tests/call_stardict_strcmp.cpp
Normal file
@@ -0,0 +1,27 @@
|
||||
//g++ `pkg-config --cflags glib-2.0` call_stardict_strcmp.cpp `pkg-config --libs glib-2.0`
|
||||
#include <glib.h>
|
||||
#include <locale.h>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <iostream>
|
||||
|
||||
static inline gint stardict_strcmp(const gchar *s1, const gchar *s2)
|
||||
{
|
||||
const gint a = g_ascii_strcasecmp(s1, s2);
|
||||
if (a == 0)
|
||||
return strcmp(s1, s2);
|
||||
else
|
||||
return a;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
setlocale(LC_ALL, "");
|
||||
std::cin.sync_with_stdio(false);
|
||||
std::string line1, line2;
|
||||
while (std::getline(std::cin, line1) &&
|
||||
std::getline(std::cin, line2)) {
|
||||
std::cout << stardict_strcmp(line1.c_str(), line2.c_str()) << "\n";
|
||||
}
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
Reference in New Issue
Block a user