diff --git a/build.bat b/build.bat new file mode 100644 index 0000000..365f6e9 --- /dev/null +++ b/build.bat @@ -0,0 +1,2 @@ +call "c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat" x86 +cl.exe /clr long2ip.cpp \ No newline at end of file diff --git a/long2ip.cpp b/long2ip.cpp new file mode 100644 index 0000000..3d27da4 --- /dev/null +++ b/long2ip.cpp @@ -0,0 +1,29 @@ +#include +#include +#include + +using namespace std; + +int main(int argc,char *argv[]) +{ + int oct1, oct2, oct3, oct4; + unsigned int addr; + string nlopt = ""; + if (argc == 2) + nlopt = argv[1]; + try + { + cin >> addr; + + oct4 = addr & 0xFF; + oct3 = ( addr >> 8 ) & 0xFF; + oct2 = ( addr >> 16 ) & 0xFF; + oct1 = ( addr >> 24 ) & 0xFF; + cout << oct1 << "." << oct2 << "." << oct3 << "." << oct4; + if (argc == 2 && nlopt == "-n") + cout << endl; + } catch (exception& e) { + cout << e.what() << endl; + } + return 0; +} diff --git a/long2ip/DEBIAN/control b/long2ip/DEBIAN/control new file mode 100644 index 0000000..31afb1a --- /dev/null +++ b/long2ip/DEBIAN/control @@ -0,0 +1,8 @@ +Package: long2ip +Version: 1 +Section: base +Priority: optional +Architecture: all +Depends: bash +Maintainer: adamsna@datanethost.net +Description: Converts an long to an IP