Commit 1660723e authored by smorlat's avatar smorlat

make linphonecsh/linphonec work on windows

git-svn-id: svn+ssh://svn.savannah.nongnu.org/linphone/trunk@266 3f6dc0c8-ddfe-455d-9043-3cd528dc4637
parent bce9a50c
......@@ -527,7 +527,7 @@ void linphonec_out(const char *fmt,...){
va_end (args);
printf("%s",res);fflush(stdout);
if (client_sock!=-1){
if (write(client_sock,res,strlen(res))==-1){
if (send(client_sock,res,strlen(res),0)==-1){
fprintf(stderr,"Fail to send output via socket: %s",getSocketError());
}
}
......
[Project]
FileName=linphonecsh.dev
Name=linphonec
UnitCount=1
PchHead=-1
PchSource=-1
Ver=3
IsCpp=1
ProfilesCount=2
ProfileIndex=0
Folders=
[VersionInfo]
Major=0
Minor=1
Release=1
Build=1
LanguageID=1033
CharsetID=1252
CompanyName=
FileVersion=
FileDescription=
InternalName=
LegalCopyright=
LegalTrademarks=
OriginalFilename=
ProductName=
ProductVersion=
AutoIncBuildNrOnRebuild=0
AutoIncBuildNrOnCompile=0
UnitCount=1
[Profile1]
ProfileName=Mingw 3.4.2
Type=1
ObjFiles=
Includes=../oRTP/include;../mediastreamer2/include;../../linphone-deps/include;../coreapi
Libs=../oRTP/build/win32native;../mediastreamer2/build/win32native;../coreapi/;../../linphone-deps/lib
ResourceIncludes=
MakeIncludes=
Compiler=-g -02_@@_-D_WIN32_WINNT=0x0501 _@@_
CppCompiler=
Linker=-mwindows_@@_-Wl,--export-all-symbols_@@_-Wl,--add-stdcall-alias_@@_-llinphone_@@_-lmediastreamer2_@@_-lortp_@@_-losip2_@@_-losipparser2_@@_-leXosip2_@@_-lws2_32_@@_
PreprocDefines=
CompilerSettings=0000000000000000000000
Icon=
ExeOutput=
ObjectOutput=Objects\MingW
OverrideOutput=0
OverrideOutputName=linphonec.exe
HostApplication=
CommandLine=
UseCustomMakefile=0
CustomMakefile=
IncludeVersionInfo=0
SupportXPThemes=0
CompilerSet=0
compilerType=0
[Profile2]
ProfileName=MS VC++ 2005
Type=1
ObjFiles=
Includes=
Libs=
ResourceIncludes=
MakeIncludes=
Compiler=
CppCompiler=
Linker=
PreprocDefines=
CompilerSettings=000000000000010000000000000000000000
Icon=
ExeOutput=Output\MSVC++2005
ObjectOutput=Objects\MSVC++2005
OverrideOutput=0
OverrideOutputName=
HostApplication=
CommandLine=
UseCustomMakefile=0
CustomMakefile=
IncludeVersionInfo=0
SupportXPThemes=0
CompilerSet=1
compilerType=1
[Unit1]
FileName=shell.c
CompileCpp=0
Folder=linphonec
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=$(CC) -c shell.c -o Objects/MingW/shell.o $(CFLAGS)
......@@ -26,6 +26,8 @@
#ifdef WIN32
#include <ws2tcpip.h>
#include <ctype.h>
#include <conio.h>
#else
#include <sys/socket.h>
#include <netdb.h>
......@@ -45,7 +47,11 @@
#define STATUS_IN_CONNECTED (1<<4) /* incoming call accepted */
#define STATUS_OUT_CONNECTED (1<<5) /*outgoing call accepted */
#ifndef WIN32
static int tcp=0;
#else
static int tcp=1;
#endif
static int make_status_value(const char *status_string){
int ret=0;
......@@ -142,6 +148,7 @@ static void print_usage(void){
#define MAX_ARGS 10
#ifndef WIN32
static void spawn_linphonec(int argc, char *argv[]){
char * args[10];
int i,j;
......@@ -185,12 +192,40 @@ static void spawn_linphonec(int argc, char *argv[]){
}
}
}
#else
static void spawn_linphonec(int argc, char *argv[]){
PPROCESS_INFORMATION pi;
STARTUPINFO si;
ZeroMemory( &si, sizeof(si) );
si.cb = sizeof(si);
ZeroMemory( &pi, sizeof(pi) );
BOOL ret=CreateProcess(NULL,"linphonec.exe --tcp " DEFAULT_TCP_PORT " -c NUL",
NULL,
NULL,
FALSE,
0,
NULL,
NULL,
&si,
&pi);
if (!ret){
fprintf(stderr,"Spawning of linphonec.exe failed.\n");
}
}
#endif
static int send_generic_command(const char *command, int print_result){
char reply[DEFAULT_REPLY_SIZE];
int err;
err=send_command(command,DEFAULT_TCP_PORT,reply,sizeof(reply),print_result);
if (err==0 && print_result) printf("%s",reply);
if (err==0 && print_result) {
printf("%s",reply);
fflush(stdout);
}
return err;
}
......@@ -280,6 +315,7 @@ int main(int argc, char *argv[]){
/*check if there is running instance*/
if (send_generic_command("help",0)==0){
fprintf(stderr,"A running linphonec has been found, not spawning a second one.\n");
return 0;
}
spawn_linphonec(argc-argi-1,&argv[argi+1]);
if (tcp) fprintf(stderr,"WARNING: using --tcp is unsafe: unprivilegied users can make calls.\n");
......
......@@ -118,7 +118,7 @@ Includes=../../gtk+2.12\include\gtk-2.0;../../gtk+2.12\include\libglade-2.0;../c
Libs=../coreapi;../../gtk+2.12/lib;../mediastreamer2/build/win32native;../oRTP/build/win32native;../../linphone-deps/lib
ResourceIncludes=
MakeIncludes=
Compiler=-ggdb -O2_@@_-DENABLE_NLS_@@__@@_
Compiler=-ggdb -O2_@@_-DENABLE_NLS_@@_-D_WIN32_WINNT=0x0501 _@@_
CppCompiler=
Linker=-mwindows_@@_-Wl,--export-all-symbols_@@_-Wl,--add-stdcall-alias_@@_-llinphone_@@_-lmediastreamer2_@@_-lortp_@@_-lglade-2.0_@@_-lgtk-win32-2.0_@@_-lglib-2.0_@@_-lintl_@@_-lgdk_pixbuf-2.0_@@_-latk-1.0_@@_-lgobject-2.0_@@_-lgthread-2.0_@@_-lgdk-win32-2.0_@@_-losip2_@@_-losipparser2_@@_-leXosip2_@@_-lws2_32_@@_-lwininet_@@_
PreprocDefines=
......@@ -172,5 +172,5 @@ Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd= $(CC) -c update.c -o Objects/update.o $(CFLAGS)
BuildCmd=$(CC) -c update.c -o Objects/update.o $(CFLAGS)
......@@ -26,6 +26,7 @@ Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{
Source: "linphone.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\mediastreamer2\build\win32native\mediastream.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\console\linphonec.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\console\linphonecsh.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "*.glade"; DestDir: "{app}/linphone"; Flags: ignoreversion
Source: "..\pixmaps\*.png"; DestDir: "{app}/linphone"; Flags: ignoreversion
Source: "*.png"; DestDir: "{app}/linphone"; Flags: ignoreversion
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment