Skip to content

Instantly share code, notes, and snippets.

@ttldtor
Created May 17, 2014 10:26
Show Gist options
  • Save ttldtor/97287408dcd15c80ce07 to your computer and use it in GitHub Desktop.
Save ttldtor/97287408dcd15c80ce07 to your computer and use it in GitHub Desktop.
import std.stdio;
import std.net.curl;
import std.regex;
import std.conv;
version(Windows) {
import std.windows.charset;
}
class MessageProto {
string dateTime_;
string who_;
string text_;
this(string dateTime, string who, string text) {
dateTime_ = dateTime;
who_ = who;
text_ = text;
}
static MessageProto fromString(string source) {
return new MessageProto("", "", "");
}
};
int main(string[] argv) {
auto content = get("ya.ru");
writeln(content);
auto cs = match(content, regex("Лебедева", "g")).captures;
foreach (char[] c; cs) {
version(Windows) {
writeln(to!string(toMBSz(c, 1)));
} else {
writeln(c);
}
}
readln;
return 0;
}
ttldtor@ttldtor-VirtualBox2:~/prj/cjr_watcher/source$ dmd main.d
/usr/lib/x86_64-linux-gnu/libphobos2.a(curl.o): In function `_D3std3net4curl4HTTP19_sharedStaticCtor34FZv':
std/net/curl.d:(.text._D3std3net4curl4HTTP19_sharedStaticCtor34FZv+0xf): undefined reference to `curl_version_info'
/usr/lib/x86_64-linux-gnu/libphobos2.a(curl.o): In function `_D3std3net4curl4Curl19_sharedStaticCtor35FZv':
std/net/curl.d:(.text._D3std3net4curl4Curl19_sharedStaticCtor35FZv+0xf): undefined reference to `curl_global_init'
/usr/lib/x86_64-linux-gnu/libphobos2.a(curl.o): In function `_D3std3net4curl4Curl19_sharedStaticDtor36FZv':
std/net/curl.d:(.text._D3std3net4curl4Curl19_sharedStaticDtor36FZv+0x5): undefined reference to `curl_global_cleanup'
/usr/lib/x86_64-linux-gnu/libphobos2.a(curl_2c7d_ea.o): In function `_D3std3net4curl3FTP4Impl6__dtorMFZv':
std/net/curl.d:(.text._D3std3net4curl3FTP4Impl6__dtorMFZv+0x18): undefined reference to `curl_slist_free_all'
/usr/lib/x86_64-linux-gnu/libphobos2.a(curl_2c7d_ea.o): In function `_D3std3net4curl3FTP3dupMFZS3std3net4curl3FTP':
std/net/curl.d:(.text._D3std3net4curl3FTP3dupMFZS3std3net4curl3FTP+0xd1): undefined reference to `curl_slist_append'
/usr/lib/x86_64-linux-gnu/libphobos2.a(curl_2c7d_ea.o): In function `_D3std3net4curl3FTP13clearCommandsMFZv':
std/net/curl.d:(.text._D3std3net4curl3FTP13clearCommandsMFZv+0x20): undefined reference to `curl_slist_free_all'
/usr/lib/x86_64-linux-gnu/libphobos2.a(curl_2c7d_ea.o): In function `_D3std3net4curl3FTP10addCommandMFAxaZv':
std/net/curl.d:(.text._D3std3net4curl3FTP10addCommandMFAxaZv+0x3b): undefined reference to `curl_slist_append'
/usr/lib/x86_64-linux-gnu/libphobos2.a(curl_2c82_432.o): In function `_D3std3net4curl4Curl10initializeMFZv':
std/net/curl.d:(.text._D3std3net4curl4Curl10initializeMFZv+0x47): undefined reference to `curl_easy_init'
/usr/lib/x86_64-linux-gnu/libphobos2.a(curl_2c83_149.o): In function `_D3std3net4curl4Curl3dupMFZS3std3net4curl4Curl':
std/net/curl.d:(.text._D3std3net4curl4Curl3dupMFZS3std3net4curl4Curl+0x2b): undefined reference to `curl_easy_duphandle'
/usr/lib/x86_64-linux-gnu/libphobos2.a(curl_2c87_37c.o): In function `_D3std3net4curl4Curl8shutdownMFZv':
std/net/curl.d:(.text._D3std3net4curl4Curl8shutdownMFZv+0x1a): undefined reference to `curl_easy_cleanup'
/usr/lib/x86_64-linux-gnu/libphobos2.a(curl_2c89_14c.o): In function `_D3std3net4curl4Curl3setMFE3etc1c4curl10CurlOptionAxaZv':
std/net/curl.d:(.text._D3std3net4curl4Curl3setMFE3etc1c4curl10CurlOptionAxaZv+0x3d): undefined reference to `curl_easy_setopt'
/usr/lib/x86_64-linux-gnu/libphobos2.a(curl_2c8a_14c.o): In function `_D3std3net4curl4Curl3setMFE3etc1c4curl10CurlOptionlZv':
std/net/curl.d:(.text._D3std3net4curl4Curl3setMFE3etc1c4curl10CurlOptionlZv+0x2a): undefined reference to `curl_easy_setopt'
/usr/lib/x86_64-linux-gnu/libphobos2.a(curl_2c8b_14c.o): In function `_D3std3net4curl4Curl3setMFE3etc1c4curl10CurlOptionPvZv':
std/net/curl.d:(.text._D3std3net4curl4Curl3setMFE3etc1c4curl10CurlOptionPvZv+0x2a): undefined reference to `curl_easy_setopt'
/usr/lib/x86_64-linux-gnu/libphobos2.a(curl_2c8c_207.o): In function `_D3std3net4curl4Curl5clearMFE3etc1c4curl10CurlOptionZv':
std/net/curl.d:(.text._D3std3net4curl4Curl5clearMFE3etc1c4curl10CurlOptionZv+0x25): undefined reference to `curl_easy_setopt'
/usr/lib/x86_64-linux-gnu/libphobos2.a(curl_2c8d_2fb.o): In function `_D3std3net4curl4Curl7performMFbZi':
std/net/curl.d:(.text._D3std3net4curl4Curl7performMFbZi+0x1f): undefined reference to `curl_easy_perform'
/usr/lib/x86_64-linux-gnu/libphobos2.a(curl_2c56_192.o): In function `_D3std3net4curl4HTTP4Impl6__dtorMFZv':
std/net/curl.d:(.text._D3std3net4curl4HTTP4Impl6__dtorMFZv+0x19): undefined reference to `curl_slist_free_all'
/usr/lib/x86_64-linux-gnu/libphobos2.a(curl_2c60_65b.o): In function `_D3std3net4curl4HTTP16addRequestHeaderMFAxaAxaZv':
std/net/curl.d:(.text._D3std3net4curl4HTTP16addRequestHeaderMFAxaAxaZv+0xb9): undefined reference to `curl_slist_append'
/usr/lib/x86_64-linux-gnu/libphobos2.a(curl_2c85_4a1.o): In function `_D3std3net4curl4Curl11errorStringMFiZAya':
std/net/curl.d:(.text._D3std3net4curl4Curl11errorStringMFiZAya+0x11): undefined reference to `curl_easy_strerror'
collect2: error: ld returned 1 exit status
--- errorlevel 1
ttldtor@ttldtor-VirtualBox2:~/prj/cjr_watcher/source$ dmd -L-lcurl main.d
/usr/lib/x86_64-linux-gnu/libphobos2.a(curl.o): In function `_D3std3net4curl4HTTP19_sharedStaticCtor34FZv':
std/net/curl.d:(.text._D3std3net4curl4HTTP19_sharedStaticCtor34FZv+0xf): undefined reference to `curl_version_info'
/usr/lib/x86_64-linux-gnu/libphobos2.a(curl.o): In function `_D3std3net4curl4Curl19_sharedStaticCtor35FZv':
std/net/curl.d:(.text._D3std3net4curl4Curl19_sharedStaticCtor35FZv+0xf): undefined reference to `curl_global_init'
/usr/lib/x86_64-linux-gnu/libphobos2.a(curl.o): In function `_D3std3net4curl4Curl19_sharedStaticDtor36FZv':
std/net/curl.d:(.text._D3std3net4curl4Curl19_sharedStaticDtor36FZv+0x5): undefined reference to `curl_global_cleanup'
/usr/lib/x86_64-linux-gnu/libphobos2.a(curl_2c7d_ea.o): In function `_D3std3net4curl3FTP4Impl6__dtorMFZv':
std/net/curl.d:(.text._D3std3net4curl3FTP4Impl6__dtorMFZv+0x18): undefined reference to `curl_slist_free_all'
/usr/lib/x86_64-linux-gnu/libphobos2.a(curl_2c7d_ea.o): In function `_D3std3net4curl3FTP3dupMFZS3std3net4curl3FTP':
std/net/curl.d:(.text._D3std3net4curl3FTP3dupMFZS3std3net4curl3FTP+0xd1): undefined reference to `curl_slist_append'
/usr/lib/x86_64-linux-gnu/libphobos2.a(curl_2c7d_ea.o): In function `_D3std3net4curl3FTP13clearCommandsMFZv':
std/net/curl.d:(.text._D3std3net4curl3FTP13clearCommandsMFZv+0x20): undefined reference to `curl_slist_free_all'
/usr/lib/x86_64-linux-gnu/libphobos2.a(curl_2c7d_ea.o): In function `_D3std3net4curl3FTP10addCommandMFAxaZv':
std/net/curl.d:(.text._D3std3net4curl3FTP10addCommandMFAxaZv+0x3b): undefined reference to `curl_slist_append'
/usr/lib/x86_64-linux-gnu/libphobos2.a(curl_2c82_432.o): In function `_D3std3net4curl4Curl10initializeMFZv':
std/net/curl.d:(.text._D3std3net4curl4Curl10initializeMFZv+0x47): undefined reference to `curl_easy_init'
/usr/lib/x86_64-linux-gnu/libphobos2.a(curl_2c83_149.o): In function `_D3std3net4curl4Curl3dupMFZS3std3net4curl4Curl':
std/net/curl.d:(.text._D3std3net4curl4Curl3dupMFZS3std3net4curl4Curl+0x2b): undefined reference to `curl_easy_duphandle'
/usr/lib/x86_64-linux-gnu/libphobos2.a(curl_2c87_37c.o): In function `_D3std3net4curl4Curl8shutdownMFZv':
std/net/curl.d:(.text._D3std3net4curl4Curl8shutdownMFZv+0x1a): undefined reference to `curl_easy_cleanup'
/usr/lib/x86_64-linux-gnu/libphobos2.a(curl_2c89_14c.o): In function `_D3std3net4curl4Curl3setMFE3etc1c4curl10CurlOptionAxaZv':
std/net/curl.d:(.text._D3std3net4curl4Curl3setMFE3etc1c4curl10CurlOptionAxaZv+0x3d): undefined reference to `curl_easy_setopt'
/usr/lib/x86_64-linux-gnu/libphobos2.a(curl_2c8a_14c.o): In function `_D3std3net4curl4Curl3setMFE3etc1c4curl10CurlOptionlZv':
std/net/curl.d:(.text._D3std3net4curl4Curl3setMFE3etc1c4curl10CurlOptionlZv+0x2a): undefined reference to `curl_easy_setopt'
/usr/lib/x86_64-linux-gnu/libphobos2.a(curl_2c8b_14c.o): In function `_D3std3net4curl4Curl3setMFE3etc1c4curl10CurlOptionPvZv':
std/net/curl.d:(.text._D3std3net4curl4Curl3setMFE3etc1c4curl10CurlOptionPvZv+0x2a): undefined reference to `curl_easy_setopt'
/usr/lib/x86_64-linux-gnu/libphobos2.a(curl_2c8c_207.o): In function `_D3std3net4curl4Curl5clearMFE3etc1c4curl10CurlOptionZv':
std/net/curl.d:(.text._D3std3net4curl4Curl5clearMFE3etc1c4curl10CurlOptionZv+0x25): undefined reference to `curl_easy_setopt'
/usr/lib/x86_64-linux-gnu/libphobos2.a(curl_2c8d_2fb.o): In function `_D3std3net4curl4Curl7performMFbZi':
std/net/curl.d:(.text._D3std3net4curl4Curl7performMFbZi+0x1f): undefined reference to `curl_easy_perform'
/usr/lib/x86_64-linux-gnu/libphobos2.a(curl_2c56_192.o): In function `_D3std3net4curl4HTTP4Impl6__dtorMFZv':
std/net/curl.d:(.text._D3std3net4curl4HTTP4Impl6__dtorMFZv+0x19): undefined reference to `curl_slist_free_all'
/usr/lib/x86_64-linux-gnu/libphobos2.a(curl_2c60_65b.o): In function `_D3std3net4curl4HTTP16addRequestHeaderMFAxaAxaZv':
std/net/curl.d:(.text._D3std3net4curl4HTTP16addRequestHeaderMFAxaAxaZv+0xb9): undefined reference to `curl_slist_append'
/usr/lib/x86_64-linux-gnu/libphobos2.a(curl_2c85_4a1.o): In function `_D3std3net4curl4Curl11errorStringMFiZAya':
std/net/curl.d:(.text._D3std3net4curl4Curl11errorStringMFiZAya+0x11): undefined reference to `curl_easy_strerror'
collect2: error: ld returned 1 exit status
--- errorlevel 1
ttldtor@ttldtor-VirtualBox2:~/prj/cjr_watcher/source$ dmd -L-lphobos2 -L-lcurl main.d
ttldtor@ttldtor-VirtualBox2:~/prj/cjr_watcher/source$ ls
main main.d main.o
ttldtor@ttldtor-VirtualBox2:~/prj/cjr_watcher/source$ ./main
Fatal Error while loading '/usr/lib/x86_64-linux-gnu/libphobos2.so.0.65':
The module 'std.regex' is already defined in './main'.
Ошибка сегментирования (сделан дамп памяти)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment