--- parser3/src/main/pa_common.C 2003/01/31 14:03:54 1.143.2.11 +++ parser3/src/main/pa_common.C 2003/02/04 10:57:16 1.143.2.13 @@ -5,7 +5,7 @@ Author: Alexandr Petrosian (http://paf.design.ru) */ -static const char* IDENT_COMMON_C="$Date: 2003/01/31 14:03:54 $"; +static const char* IDENT_COMMON_C="$Date: 2003/02/04 10:57:16 $"; #include "pa_common.h" #include "pa_exception.h" @@ -14,10 +14,19 @@ static const char* IDENT_COMMON_C="$Date #include "pa_vstring.h" #include "pa_vint.h" -#ifdef WIN32 -# include +#ifdef CYGWIN +#define _GNU_H_WINDOWS32_SOCKETS +// for PASCAL +#include +// SOCKET +typedef u_int SOCKET; +int PASCAL closesocket(SOCKET); #else -# define closesocket close +# if defined(WIN32) +# include +# else +# define closesocket close +# endif #endif // some maybe-undefined constants @@ -370,7 +379,7 @@ static HashStringValuePtr file_read_http if(pos<1) throw Exception("http.response", connect_string, - "bad response from host - bad header \"%s\"", line->cstr()); + "bad response from host - bad header \"%s\"", line->cstr().get()); headers->put( line->mid(0, pos)->change_case(pool, charset, String::CC_UPPER), @@ -473,14 +482,14 @@ bool file_read_action_under_lock(Pool& p throw Exception("file.lock", file_spec, "shared lock failed: %s (%d), actual filename '%s'", - strerror(errno), errno, fname); + strerror(errno), errno, fname.get()); struct stat finfo; if(stat(fname, &finfo)!=0) throw Exception("file.missing", // hardly possible: we just opened it OK file_spec, "stat failed: %s (%d), actual filename '%s'", - strerror(errno), errno, fname); + strerror(errno), errno, fname.get()); #ifdef PA_SAFE_MODE if(finfo.st_uid/*foreign?*/!=geteuid() @@ -488,7 +497,7 @@ bool file_read_action_under_lock(Pool& p throw Exception("parser.runtime", file_spec, "parser is in safe mode: reading files of foreign group and user disabled [recompile parser with --disable-safe-mode configure option], actual filename '%s'", - fname); + fname.get()); #endif action(pool, finfo, f, file_spec, fname, as_text, context); @@ -506,7 +515,7 @@ bool file_read_action_under_lock(Pool& p throw Exception(errno==EACCES?"file.access":errno==ENOENT?"file.missing":0, file_spec, "%s failed: %s (%d), actual filename '%s'", - action_name, strerror(errno), errno, fname); + action_name, strerror(errno), errno, fname.get()); return false; } } @@ -540,7 +549,7 @@ bool file_write_action_under_lock( Exception e("file.lock", file_spec, "shared lock failed: %s (%d), actual filename '%s'", - strerror(errno), errno, fname); + strerror(errno), errno, fname.get()); close(f); if(fail_on_lock_problem) throw e; @@ -568,7 +577,7 @@ bool file_write_action_under_lock( throw Exception(errno==EACCES?"file.access":0, file_spec, "%s failed: %s (%d), actual filename '%s'", - action_name, strerror(errno), errno, fname); + action_name, strerror(errno), errno, fname.get()); // here should be nothing, see rethrow above } @@ -615,7 +624,7 @@ bool file_delete(StringPtr file_spec, bo throw Exception(errno==EACCES?"file.access":errno==ENOENT?"file.missing":0, file_spec, "unlink failed: %s (%d), actual filename '%s'", - strerror(errno), errno, fname); + strerror(errno), errno, fname.get()); else return false; @@ -632,7 +641,7 @@ void file_move(StringPtr old_spec, Strin throw Exception(errno==EACCES?"file.access":errno==ENOENT?"file.missing":0, old_spec, "rename failed: %s (%d), actual filename '%s' to '%s'", - strerror(errno), errno, old_spec_cstr, new_spec_cstr); + strerror(errno), errno, old_spec_cstr.get(), new_spec_cstr.get()); rmdir(old_spec, 1); } @@ -699,7 +708,7 @@ bool file_stat(StringPtr file_spec, throw Exception("file.missing", file_spec, "getting file size failed: %s (%d), real filename '%s'", - strerror(errno), errno, fname); + strerror(errno), errno, fname.get()); else return false; rsize=finfo.st_size; @@ -907,7 +916,7 @@ int __vsnprintf(char* b, size_t s, const win32: mk:@MSITStore:C:\Program%20Files\Microsoft%20Visual%20Studio\MSDN\2001APR\1033\vccore.chm::/html/_crt__vsnprintf.2c_._vsnwprintf.htm - if the number of bytes to write exceeds buffer, then count bytes are written and –1 is returned + if the number of bytes to write exceeds buffer, then count bytes are written and Ö1 is returned */ r=_vsnprintf(b, s, f, l); if(r<0)