X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=winboard%2Fhelp.c;h=e1e0345679fb1c55d10a6bda0261447a286b7b08;hb=c0bcf53dc4abc3fc4001252c734b926765598837;hp=a8cebd64a6d68090d578e1e0ccec50423caa8f02;hpb=9370698c82696695f0bcd0327a8b5c3703d3eea7;p=xboard.git diff --git a/winboard/help.c b/winboard/help.c index a8cebd6..e1e0345 100644 --- a/winboard/help.c +++ b/winboard/help.c @@ -1,7 +1,7 @@ /* * help.h * - * Copyright 2009 Free Software Foundation, Inc. + * Copyright 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016 Free Software Foundation, Inc. * ------------------------------------------------------------------------ * * GNU XBoard is free software: you can redistribute it and/or modify @@ -24,6 +24,8 @@ #include #include +#include "config.h" +#include "help.h" FILE *debugFP; @@ -59,10 +61,10 @@ HtmlHelp( HWND hwnd, LPCSTR helpFile, UINT action, DWORD_PTR data ) siStartInfo.hStdOutput = NULL; siStartInfo.hStdError = debugFP; - sprintf(buf, "Hh.exe %s", helpFile); + snprintf(buf, sizeof(buf)/sizeof(buf[0]),"Hh.exe %s", helpFile); // ignore the other parameters; just start the viewer with the help file - return CreateProcess(NULL, + if( CreateProcess(NULL, buf, /* command line */ NULL, /* process security attributes */ NULL, /* primary thread security attrs */ @@ -71,7 +73,8 @@ HtmlHelp( HWND hwnd, LPCSTR helpFile, UINT action, DWORD_PTR data ) NULL, /* use parent's environment */ NULL, &siStartInfo, /* STARTUPINFO pointer */ - &helpProcInfo); /* receives PROCESS_INFORMATION */ + &helpProcInfo) /* receives PROCESS_INFORMATION */ + ) return hwnd; else return NULL; } //HWND WINAPI @@ -81,13 +84,13 @@ MyHelp(HWND hwnd, LPSTR helpFile, UINT action, DWORD_PTR data) static int status = 0; FILE *f; - if(status < 0) return NULL; + if(status < 0) return 0; if(!status) { f = fopen(helpFile, "r"); if(f == NULL) { status = -1; - return NULL; + return 0; } status = 1; fclose(f);