From b0fd7672fd85110505720d76850a463cb32b4b7c Mon Sep 17 00:00:00 2001 From: Marc Hoersken Date: Sat, 26 Jul 2014 17:15:52 +0200 Subject: [PATCH] winsane-dbg: Added support for custom port parameter --- winsane-dbg/winsane-dbg.cpp | 14 ++++++++++---- winsane-dbg/winsane-dbg.h | 4 ++-- winsane-dbg/winsane-dbg.vcxproj.user | 2 +- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/winsane-dbg/winsane-dbg.cpp b/winsane-dbg/winsane-dbg.cpp index 5b1e914..3460da2 100644 --- a/winsane-dbg/winsane-dbg.cpp +++ b/winsane-dbg/winsane-dbg.cpp @@ -5,7 +5,7 @@ * | |/ |/ / / /_/ /___/ / /_/ / / / / __/ * |__/|__/_/\__,_//____/\__,_/_/ /_/\___/ * - * Copyright (C) 2012 - 2013, Marc Hoersken, + * Copyright (C) 2012 - 2014, Marc Hoersken, * * This software is licensed as described in the file COPYING, which * you should have received as part of this software distribution. @@ -23,21 +23,27 @@ int WINAPIV _tmain(int argc, TCHAR *argv[]) { PTSTR hostname; + USHORT port; if (argc > 1) { hostname = argv[1]; - Debug(hostname); + if (argc > 2) { + port = (USHORT) _tstoi(argv[2]); + } else { + port = WINSANE_DEFAULT_PORT; + } + Debug(hostname, port); exit(0); } else { exit(1); } } -VOID Debug(PTSTR hostname) +VOID Debug(PTSTR hostname, USHORT port) { WINSANE_Session *session; - session = WINSANE_Session::Remote(hostname); + session = WINSANE_Session::Remote(hostname, port); if (session) { DebugSession(session); delete session; diff --git a/winsane-dbg/winsane-dbg.h b/winsane-dbg/winsane-dbg.h index 070d428..2eb6721 100644 --- a/winsane-dbg/winsane-dbg.h +++ b/winsane-dbg/winsane-dbg.h @@ -5,7 +5,7 @@ * | |/ |/ / / /_/ /___/ / /_/ / / / / __/ * |__/|__/_/\__,_//____/\__,_/_/ /_/\___/ * - * Copyright (C) 2012 - 2013, Marc Hoersken, + * Copyright (C) 2012 - 2014, Marc Hoersken, * * This software is licensed as described in the file COPYING, which * you should have received as part of this software distribution. @@ -35,7 +35,7 @@ __user_code #include "winsane.h" -VOID Debug(PTSTR hostname); +VOID Debug(PTSTR hostname, USHORT port); VOID DebugSession(WINSANE_Session *session); VOID DebugSessionDevice(WINSANE_Session *session, WINSANE_Device *device); VOID DebugSessionDeviceOption(WINSANE_Session *session, WINSANE_Device *device, WINSANE_Option *option); diff --git a/winsane-dbg/winsane-dbg.vcxproj.user b/winsane-dbg/winsane-dbg.vcxproj.user index e3d62b3..2f4635d 100644 --- a/winsane-dbg/winsane-dbg.vcxproj.user +++ b/winsane-dbg/winsane-dbg.vcxproj.user @@ -3,6 +3,6 @@ WindowsLocalDebugger PATH=$(SolutionDir)winsane\$(OutDir);%PATH% - $(SANED) + $(SANED) 6566 \ No newline at end of file