From 71f2203148663e19f7b9817f7d2e981a159741e0 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Mon, 4 Aug 2008 14:27:07 +0000 Subject: [PATCH] 2008-08-04 16:23 UTC+0200 Viktor Szakats (harbour.01 syenar hu) * harbour-ce-spec * harbour-w32-spec * harbour.spec * common.mak * make_b32.mak * make_gcc.mak * make_vc.mak * make_vcce.mak * make_tgz.sh * utils/Makefile - utils/hbver - Removed obsolete binary hbverfix. --- harbour/ChangeLog | 14 ++ harbour/common.mak | 11 +- harbour/harbour-ce-spec | 2 +- harbour/harbour-w32-spec | 2 +- harbour/harbour.spec | 2 +- harbour/make_b32.mak | 13 - harbour/make_gcc.mak | 4 - harbour/make_tgz.sh | 2 +- harbour/make_vc.mak | 27 -- harbour/make_vcce.mak | 28 --- harbour/utils/Makefile | 1 - harbour/utils/hbver/Makefile | 13 - harbour/utils/hbver/hbverfix.c | 437 --------------------------------- 13 files changed, 19 insertions(+), 537 deletions(-) delete mode 100644 harbour/utils/hbver/Makefile delete mode 100644 harbour/utils/hbver/hbverfix.c diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 210caa7524..24a713d17a 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,20 @@ 2008-12-31 13:59 UTC+0100 Foo Bar */ +2008-08-04 16:23 UTC+0200 Viktor Szakats (harbour.01 syenar hu) + * harbour-ce-spec + * harbour-w32-spec + * harbour.spec + * common.mak + * make_b32.mak + * make_gcc.mak + * make_vc.mak + * make_vcce.mak + * make_tgz.sh + * utils/Makefile + - utils/hbver + - Removed obsolete binary hbverfix. + 2008-08-04 16:02 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/common.mak * harbour/source/compiler/Makefile diff --git a/harbour/common.mak b/harbour/common.mak index 27a645da1b..e6c3910a34 100644 --- a/harbour/common.mak +++ b/harbour/common.mak @@ -146,7 +146,6 @@ HBDOT_DIR = utils\hbdot HBTEST_DIR = utils\hbtest HBDOC_DIR = utils\hbdoc HBMAKE_DIR = utils\hbmake -HBVER_DIR = utils\hbver #********************************************************** @@ -192,8 +191,7 @@ $(HBRUN_DIR);\ $(HBDOT_DIR);\ $(HBTEST_DIR);\ $(HBDOC_DIR);\ -$(HBMAKE_DIR);\ -$(HBVER_DIR)\ +$(HBMAKE_DIR)\ ALL_SRC_DIRS_TMP=\ $(ALL_LIB_SRC_DIRS_TMP);\ @@ -255,7 +253,6 @@ HBDOT_EXE = $(BIN_DIR)\hbdot$(EXEEXT) HBTEST_EXE = $(BIN_DIR)\hbtest$(EXEEXT) HBDOC_EXE = $(BIN_DIR)\hbdoc$(EXEEXT) HBMAKE_EXE = $(BIN_DIR)\hbmake$(EXEEXT) -HBVER_EXE = $(BIN_DIR)\hbverfix$(EXEEXT) HARBOUR_DLL = $(BIN_DIR)\$(LIBPREF)harbour-$(HB_CC_NAME)$(DLLEXT) HBTESTDLL_EXE= $(BIN_DIR)\hbtest-dll$(EXEEXT) @@ -1111,11 +1108,6 @@ HBMAKE_EXE_OBJS = \ $(OBJ_DIR)\readline$(OBJEXT) \ $(OBJ_DIR)\tmake$(OBJEXT) \ -#********************************************************** - -HBVER_EXE_OBJS = \ - $(OBJ_DIR)\hbverfix$(OBJEXT) \ - #********************************************************** #********************************************************** #********************************************************** @@ -1211,7 +1203,6 @@ HB_BUILD_TARGETS = \ $(HBPPTEST_EXE) \ $(HBDOC_EXE) \ $(HBMAKE_EXE) \ - $(HBVER_EXE) \ # DLL Target is disabled by default # It can be enabled by setting env diff --git a/harbour/harbour-ce-spec b/harbour/harbour-ce-spec index 4395ad752c..594e49fada 100644 --- a/harbour/harbour-ce-spec +++ b/harbour/harbour-ce-spec @@ -173,7 +173,7 @@ make -r -i install ${CCPREFIX}strip --strip-debug $HB_LIB_INSTALL/* # remove unused files -rm -fR ${HB_BIN_INSTALL}/{harbour,hbpp,hbdoc,hbdot,hbmake,hbrun,hbtest,hbverfix,hbpptest}.exe +rm -fR ${HB_BIN_INSTALL}/{harbour,hbpp,hbdoc,hbdot,hbmake,hbrun,hbtest,hbpptest}.exe # Create a README file for people using this RPM. cat > doc/%{readme} < doc/%{readme} < doc/%{readme} < NUL - $(CC) @&&! -$(CFLAGS) --e$(HBVER_EXE) -$(**: = ^ -) -$(STANDARD_STATIC_HBLIBS) -! -#********************************************************** #********************************************************** # DLL Targets diff --git a/harbour/make_gcc.mak b/harbour/make_gcc.mak index cdd50a795a..e1da309e73 100644 --- a/harbour/make_gcc.mak +++ b/harbour/make_gcc.mak @@ -437,10 +437,6 @@ $(HBMAKE_EXE) :: $(StdLibs) $(HBMAKE_EXE) :: $(HBMAKE_EXE_OBJS) $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) #********************************************************** -$(HBVER_EXE) :: $(StdLibs) -$(HBVER_EXE) :: $(HBVER_EXE_OBJS) - $(CC) $(CFLAGS) -o $@ $^ $(HB_OS_LIBS) -#********************************************************** #********************************************************** # DLL Targets diff --git a/harbour/make_tgz.sh b/harbour/make_tgz.sh index 0c2d1905f4..6295a82da3 100755 --- a/harbour/make_tgz.sh +++ b/harbour/make_tgz.sh @@ -238,7 +238,7 @@ do done # remove some unnecessary binaries -rm -f $HB_BIN_INSTALL/hbverfix${hb_exesuf} $HB_BIN_INSTALL/hbpptest${hb_exesuf} +rm -f $HB_BIN_INSTALL/hbpptest${hb_exesuf} # Keep the size of the binaries to a minimim. if [ -f $HB_BIN_INSTALL/harbour${hb_exesuf} ]; then diff --git a/harbour/make_vc.mak b/harbour/make_vc.mak index a27b9bff90..04c92c6c44 100644 --- a/harbour/make_vc.mak +++ b/harbour/make_vc.mak @@ -278,9 +278,6 @@ LDFLAGSDLL = /DEBUG $(LDFLAGSDLL) {$(HBMAKE_DIR)}.c{$(OBJ_DIR)}$(OBJEXT):: $(CC) $(CLIBFLAGS) -Fo$(OBJ_DIR)\ $< #******************************************************* -{$(HBVER_DIR)}.c{$(OBJ_DIR)}$(OBJEXT):: - $(CC) $(CLIBFLAGS) -Fo$(OBJ_DIR)\ $< -#******************************************************* #******************************************************* # General *.prg --> *.obj COMPILE rules for STATIC Libraries @@ -413,10 +410,6 @@ LDFLAGSDLL = /DEBUG $(LDFLAGSDLL) $(HB) $(HARBOURFLAGS) -o$(OBJ_DIR)\ $< $(CC) $(CLIBFLAGS) -Fo$(OBJ_DIR)\ $(OBJ_DIR)\$(*B).c #******************************************************* -{$(HBVER_DIR)}.prg{$(OBJ_DIR)}$(OBJEXT): - $(HB) $(HARBOURFLAGS) -o$(OBJ_DIR)\ $< - $(CC) $(CLIBFLAGS) -Fo$(OBJ_DIR)\ $(OBJ_DIR)\$(*B).c -#******************************************************* #******************************************************* # General *.c --> *.obj COMPILE rules for SHARED Libraries @@ -528,9 +521,6 @@ LDFLAGSDLL = /DEBUG $(LDFLAGSDLL) {$(HBMAKE_DIR)}.c{$(DLL_OBJ_DIR)}$(OBJEXT):: $(CC) $(CEXEFLAGSDLL) -Fo$(DLL_OBJ_DIR)\ $< #******************************************************* -{$(HBVER_DIR)}.c{$(DLL_OBJ_DIR)}$(OBJEXT):: - $(CC) $(CEXEFLAGSDLL) -Fo$(DLL_OBJ_DIR)\ $< -#******************************************************* #******************************************************* # General *.prg --> *.obj COMPILE rules for SHARED Libraries @@ -667,10 +657,6 @@ LDFLAGSDLL = /DEBUG $(LDFLAGSDLL) {$(HBMAKE_DIR)}.prg{$(DLL_OBJ_DIR)}$(OBJEXT): $(HB) $(HARBOURFLAGS) -o$(DLL_OBJ_DIR)\ $< $(CC) $(CEXEFLAGSDLL) -Fo$(DLL_OBJ_DIR)\ $(DLL_OBJ_DIR)\$(*B).c -#******************************************************* -{$(HBVER_DIR)}.prg{$(DLL_OBJ_DIR)}$(OBJEXT): - $(HB) $(HARBOURFLAGS) -o$(DLL_OBJ_DIR)\ $< - $(CC) $(CEXEFLAGSDLL) -Fo$(DLL_OBJ_DIR)\ $(DLL_OBJ_DIR)\$(*B).c #********************************************************** #********************************************************** @@ -885,19 +871,6 @@ $(STANDARD_STATIC_HBLIBS) user32.lib winspool.lib <<$(HB_KEEPSTATE) #********************************************************** -# HBVER build rule -#********************************************************** -$(HBVER_EXE) : $(HBVER_EXE_OBJS) - IF EXIST "$(HBVER_EXE)" $(DEL) "$(HBVER_EXE)" > nul - $(LINKER) @<< -$(LDFLAGS) -/OUT:$(HBVER_EXE) -$(**: = ^ -) -$(STANDARD_STATIC_HBLIBS) -user32.lib winspool.lib -<<$(HB_KEEPSTATE) -#********************************************************** #********************************************************** # DLL Targets diff --git a/harbour/make_vcce.mak b/harbour/make_vcce.mak index a886c9d98f..94d9e73961 100644 --- a/harbour/make_vcce.mak +++ b/harbour/make_vcce.mak @@ -304,9 +304,6 @@ LDFLAGSDLL = /DEBUG $(LDFLAGSDLL) {$(HBMAKE_DIR)}.c{$(OBJ_DIR)}$(OBJEXT):: $(CC) $(CLIBFLAGS) -Fo$(OBJ_DIR)\ $< #******************************************************* -{$(HBVER_DIR)}.c{$(OBJ_DIR)}$(OBJEXT):: - $(CC) $(CLIBFLAGS) -Fo$(OBJ_DIR)\ $< -#******************************************************* #******************************************************* # General *.prg --> *.obj COMPILE rules for STATIC Libraries @@ -439,10 +436,6 @@ LDFLAGSDLL = /DEBUG $(LDFLAGSDLL) $(HB) $(HARBOURFLAGS) -o$(OBJ_DIR)\ $< $(CC) $(CLIBFLAGS) -Fo$(OBJ_DIR)\ $(OBJ_DIR)\$(*B).c #******************************************************* -{$(HBVER_DIR)}.prg{$(OBJ_DIR)}$(OBJEXT): - $(HB) $(HARBOURFLAGS) -o$(OBJ_DIR)\ $< - $(CC) $(CLIBFLAGS) -Fo$(OBJ_DIR)\ $(OBJ_DIR)\$(*B).c -#******************************************************* #******************************************************* # General *.c --> *.obj COMPILE rules for SHARED Libraries @@ -554,9 +547,6 @@ LDFLAGSDLL = /DEBUG $(LDFLAGSDLL) {$(HBMAKE_DIR)}.c{$(DLL_OBJ_DIR)}$(OBJEXT):: $(CC) $(CEXEFLAGSDLL) -Fo$(DLL_OBJ_DIR)\ $< #******************************************************* -{$(HBVER_DIR)}.c{$(DLL_OBJ_DIR)}$(OBJEXT):: - $(CC) $(CEXEFLAGSDLL) -Fo$(DLL_OBJ_DIR)\ $< -#******************************************************* #******************************************************* # General *.prg --> *.obj COMPILE rules for SHARED Libraries @@ -693,10 +683,6 @@ LDFLAGSDLL = /DEBUG $(LDFLAGSDLL) {$(HBMAKE_DIR)}.prg{$(DLL_OBJ_DIR)}$(OBJEXT): $(HB) $(HARBOURFLAGS) -o$(DLL_OBJ_DIR)\ $< $(CC) $(CEXEFLAGSDLL) -Fo$(DLL_OBJ_DIR)\ $(DLL_OBJ_DIR)\$(*B).c -#******************************************************* -{$(HBVER_DIR)}.prg{$(DLL_OBJ_DIR)}$(OBJEXT): - $(HB) $(HARBOURFLAGS) -o$(DLL_OBJ_DIR)\ $< - $(CC) $(CEXEFLAGSDLL) -Fo$(DLL_OBJ_DIR)\ $(DLL_OBJ_DIR)\$(*B).c #********************************************************** #********************************************************** @@ -912,20 +898,6 @@ $(**: = ^ $(STANDARD_STATIC_HBLIBS) coredll.lib corelibc.lib winsock.lib ws2.lib <<$(HB_KEEPSTATE) -#********************************************************** -# HBVER build rule -#********************************************************** -$(HBVER_EXE) : $(HBVER_EXE_OBJS) - IF EXIST "$(HBVER_EXE)" $(DEL) "$(HBVER_EXE)" > nul - $(LINKER) @<< -$(LDFLAGS) -/OUT:$(HBVER_EXE) -$(**: = ^ -) -$(STANDARD_STATIC_HBLIBS) -coredll.lib corelibc.lib winsock.lib ws2.lib -<<$(HB_KEEPSTATE) -#********************************************************** #********************************************************** # DLL Targets diff --git a/harbour/utils/Makefile b/harbour/utils/Makefile index 2154169a0b..7eea722ecb 100644 --- a/harbour/utils/Makefile +++ b/harbour/utils/Makefile @@ -6,7 +6,6 @@ ROOT = ../ DIRS=\ hbpptest \ - hbver \ hbrun \ hbdot \ hbdoc \ diff --git a/harbour/utils/hbver/Makefile b/harbour/utils/hbver/Makefile deleted file mode 100644 index 1dee657b85..0000000000 --- a/harbour/utils/hbver/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -# -# $Id$ -# - -ROOT = ../../ - -C_SOURCES=\ - -C_MAIN=hbverfix.c - -LIBS=\ - -include $(TOP)$(ROOT)config/bin.cf diff --git a/harbour/utils/hbver/hbverfix.c b/harbour/utils/hbver/hbverfix.c deleted file mode 100644 index d99a2d524d..0000000000 --- a/harbour/utils/hbver/hbverfix.c +++ /dev/null @@ -1,437 +0,0 @@ -/* - * $Id$ - */ - -/* - * Harbour Project source code: - * Harbour Version Updater standalone main module - * - * Copyright 2003 David G. Holm - * www - http://www.harbour-project.org - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this software; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/). - * - * As a special exception, the Harbour Project gives permission for - * additional uses of the text contained in its release of Harbour. - * - * The exception is that, if you link the Harbour libraries with other - * files to produce an executable, this does not by itself cause the - * resulting executable to be covered by the GNU General Public License. - * Your use of that executable is in no way restricted on account of - * linking the Harbour library code into it. - * - * This exception does not however invalidate any other reasons why - * the executable file might be covered by the GNU General Public License. - * - * This exception applies only to the code released by the Harbour - * Project under the name Harbour. If you copy code from other - * Harbour Project or Free Software Foundation releases into a copy of - * Harbour, as the General Public License permits, the exception does - * not apply to the code that you add in this way. To avoid misleading - * anyone as to the status of such modified files, you must delete - * this exception notice from them. - * - * If you write modifications of your own for Harbour, it is your choice - * whether to permit this exception to apply to your modifications. - * If you do not wish that, delete this exception notice. - * - */ - -/* - * Avoid tracing in preprocessor/compiler. - */ -#if ! defined(HB_TRACE_UTILS) - #if defined(HB_TRACE_LEVEL) - #undef HB_TRACE_LEVEL - #endif -#endif - -#define HB_OS_WIN_32_USED - -#include -#include -#include - -#include "hbcomp.h" - -#if !defined(__MINGW32CE__) && !( defined( _MSC_VER ) && defined( HB_WINCE ) ) -# include -#endif - -#define MAX_BUF_LEN 4096 - -#if defined(HB_WINCE) - -#define hb_xgrab(x) malloc(x) -#define hb_xfree(x) free(x) - -wchar_t *hb_mbtowc( const char * srcA ) -{ - DWORD length; - wchar_t * dstW; - - length = MultiByteToWideChar( CP_ACP, 0, srcA, -1, NULL, 0 ); - dstW = ( wchar_t * ) malloc( ( length + 1 ) * sizeof( wchar_t ) ); - MultiByteToWideChar( CP_ACP, 0, srcA, -1, dstW, length + 1 ); - - return dstW; -} - -char *hb_wctomb( const wchar_t *srcW ) -{ - DWORD length; - char *dstA; - - length = WideCharToMultiByte( CP_ACP, 0, srcW, -1, NULL, 0, NULL, NULL ); - dstA = ( char * ) hb_xgrab( length + 1 ); - WideCharToMultiByte( CP_ACP, 0, srcW, -1, dstA, length + 1, NULL, NULL ); - - return dstA; -} - -void hb_wctombget( char *dstA, const wchar_t *srcW, unsigned long ulLen ) -{ - WideCharToMultiByte( CP_ACP, 0, srcW, ulLen, dstA, ulLen, NULL, NULL ); -} - -int remove( const char * path ) -{ - wchar_t * wpath; - int result; - - wpath = hb_mbtowc( path ); - result = DeleteFileW( wpath ) ? 0 : -1; - free( wpath ); - - return result; -} - -void perror( const char *szError ) -{ - fprintf( stderr, "error: %s\n", szError ); -} - -int rename( const char * fn1, const char * fn2 ) -{ - wchar_t * wfn1, * wfn2; - int result; - - wfn1 = hb_mbtowc( fn1 ); - wfn2 = hb_mbtowc( fn2 ); - result = MoveFileW( wfn1, wfn2 ) ? 0 : -1; - free( wfn1 ); - free( wfn2 ); - - return result; -} - -#endif - -static char * szIncrementNumber( char * szBuffer, size_t stSkipOver ) -{ - size_t i; - for( i = stSkipOver; i < strlen( szBuffer ) && isspace( ( BYTE ) szBuffer[ i ] ); i++ ) {} - if( i > stSkipOver && i < strlen( szBuffer ) ) - { - int iVersion; - char szIntBuf[ 8 ]; - size_t stStart = i; - iVersion = atoi( &szBuffer[ stStart ] ) + 1; - snprintf( szIntBuf, sizeof( szIntBuf ), "%-7d", iVersion ); - for( i = 0; i < strlen( szIntBuf ); i++ ) - { - szBuffer[ stStart + i ] = szIntBuf[ i ]; - } - } - return szBuffer; -} - -static char * szReplaceQuoted( char * szBuffer, const char * new_string ) -{ - char szOldBuf[ MAX_BUF_LEN ]; - char * szOpening = strchr( szBuffer, 34 ); /* Locate starting quote */ - if( szOpening ) - { - char * szClosing = strchr( szOpening + 1, 34 ); /* Locate ending quote */ - if( szClosing ) - { - strncpy( szOldBuf, szClosing, MAX_BUF_LEN ); - szOldBuf[ MAX_BUF_LEN - 1 ] = '\0'; - strncpy( szOpening + 1, new_string, MAX_BUF_LEN - ( szOpening - szBuffer ) ); - szBuffer[ MAX_BUF_LEN - 1 ] = '\0'; - strncat( szBuffer, szOldBuf, MAX_BUF_LEN - strlen( szBuffer ) ); - szBuffer[ MAX_BUF_LEN - 1 ] = '\0'; - return szBuffer; - } - } - return NULL; -} - -int main( int argc, char * argv[] ) -{ - BOOL bBadCmdLine = FALSE; - BOOL bShowHelp = FALSE; - char cIncrement = ' '; - char szErrBuf[ MAX_BUF_LEN ]; - int iDebugLevel = 0; - int iArg = 1; - - while( iArg < argc ) - { - if( HB_ISOPTSEP(argv[ iArg ][ 0 ])) - { - BOOL bInvalid = FALSE; - switch( argv[ iArg ][ 1 ] ) - { - case 'd': - case 'D': - iDebugLevel = atoi( &argv[ iArg ][ 2 ] ); - break; - case 'h': - case 'H': - case '?': - bShowHelp = TRUE; - break; - case 'i': - case 'I': - if( strlen( argv[ iArg ] ) > 2 ) - { - switch( argv[ iArg ][ 2 ] ) - { - case 'v': - case 'V': - case 'm': - case 'M': - case 'r': - case 'R': - cIncrement = tolower( argv[ iArg ][ 2 ] ); - break; - default: - bInvalid = TRUE; - } - break; - } - bInvalid = TRUE; - break; - default: - bInvalid = TRUE; - break; - } - if( bInvalid ) - { - bBadCmdLine = TRUE; - fprintf( stderr, "\nInvalid command line option: %s\n", &argv[ iArg ][ 1 ] ); - } - } - else - { - bBadCmdLine = TRUE; - fprintf( stderr, "\nInvalid command line argument: %s\n", &argv[ iArg ][ 0 ] ); - } - iArg++; - } - - if( bShowHelp ) - { - fprintf( stderr, "\nSyntax: %s [options]" - "\n" - "\nOptions: -d[level] set debug level (-1 == none, 0 == minimal*, 1 == verbose)" - "\n -iv increment major version number+" - "\n -im increment minor version number+" - "\n -ir increment revision number+" - "\n" - "\nAn * indicates a default option. A + indicates mutually exclusive options" - "\n(the last one that is present on the command line will be being used)." - "\n" - , argv[ 0 ] ); - - return 1; - } - else if( bBadCmdLine ) - { - return 2; - } - else - { - const char * cszChangeLogName = "ChangeLog"; - const char * cszVersionName = "include/hbver.h"; - const char * cszRewriteName = "include/hbver.rw"; - char szInputBuffer[ MAX_BUF_LEN + 16 ]; - char szNewID[ MAX_BUF_LEN + 8 ]; - char szNewLog[ MAX_BUF_LEN + 8 ]; - BOOL bFoundID = FALSE; - BOOL bFoundLog = FALSE; - FILE * fhChangeLog; - - snprintf( szErrBuf, sizeof( szErrBuf ), "Opening %s", cszChangeLogName ); - fhChangeLog = fopen( cszChangeLogName, "rt" ); - if( fhChangeLog == NULL ) - { -#if defined(__MINGW32CE__) || ( defined( _MSC_VER ) && defined( HB_WINCE ) ) - perror( szErrBuf ); - return 4; -#else - switch( errno ) - { - case ENOENT: - fprintf( stderr, "\nThis program needs to be run from the directory with the %s file.\n", cszChangeLogName ); - return 3; - default: - perror( szErrBuf ); - return 4; - } -#endif - } - while( ! ( bFoundID && bFoundLog ) && ! feof( fhChangeLog ) ) - { - snprintf( szErrBuf, sizeof( szErrBuf ), "Reading from %s", cszChangeLogName ); - fgets( szInputBuffer, MAX_BUF_LEN, fhChangeLog ); - if( ferror( fhChangeLog ) ) - { - perror( szErrBuf ); - return 5; - } - if( iDebugLevel > 0 ) fprintf( stderr, "\n==> %u <==> %s <==", ( unsigned ) strlen( szInputBuffer ), szInputBuffer ); - if( ! bFoundID ) - { - char * szID = strstr( szInputBuffer, "$Id: " ); - if( szID ) - { - size_t stLen; - szID = &szID[ 5 ]; /* Leave out the id markers... */ - stLen = strcspn( szID, "$" ) - 5; /* ...on both ends */ - szID[ stLen ] = '\0'; - bFoundID = TRUE; - strncpy( szNewID, szID, sizeof( szNewID ) ); - szNewID[ sizeof( szNewID ) - 1 ] = '\0'; - if( iDebugLevel >= 0 ) fprintf( stderr, "\nID: %s\n", szID ); - } - } - else if( szInputBuffer[ 4 ] == '-' && szInputBuffer[ 7 ] == '-' && szInputBuffer[ 10 ] == ' ' && szInputBuffer[ 13 ] == ':' ) - { - bFoundLog = TRUE; - strncpy( szNewLog, szInputBuffer, sizeof( szNewLog ) ); - szNewLog[ sizeof( szNewLog ) - 1 ] = '\0'; - szNewLog[ strcspn( szNewLog, "\r\n" ) ] = '\0'; /* Strip newline chars */ - if( iDebugLevel >= 0 ) fprintf( stderr, "\nLOG: %s\n", szInputBuffer ); - } - else if( iDebugLevel > 0 ) fprintf( stderr, " ===> %c %c %c %c <===", szInputBuffer[ 4 ], szInputBuffer[ 7 ], szInputBuffer[ 10 ], szInputBuffer[ 13 ] ); - } - fclose( fhChangeLog ); - if( !bFoundID ) - { - fprintf( stderr, "\nUnable to locate %s $Id record.\n", cszChangeLogName ); - return 6; - } - else if( ! bFoundLog ) - { - fprintf( stderr, "\nUnable to locate a %s entry.\n", cszChangeLogName ); - return 7; - } - else - { - const char *cszMajorVersion = "#define HB_VER_MAJOR"; - const char *cszMinorVersion = "#define HB_VER_MINOR"; - const char *cszRevision = "#define HB_VER_REVISION"; - const char *cszLastEntry = "#define HB_VER_LENTRY"; - const char *cszLastID = "#define HB_VER_CHLCVS"; - - FILE * fhRewrite; - FILE * fhVersion; - - snprintf( szErrBuf, sizeof( szErrBuf ), "Opening %s", cszVersionName ); - fhVersion = fopen( cszVersionName, "rt" ); - if( fhVersion == NULL ) - { - perror( szErrBuf ); - return 9; - } - snprintf( szErrBuf, sizeof( szErrBuf ), "Creating %s", cszRewriteName ); - fhRewrite = fopen( cszRewriteName, "wt" ); - if( fhRewrite == NULL ) - { - perror( szErrBuf ); - return 8; - } - while( ! feof( fhVersion ) ) - { - snprintf( szErrBuf, sizeof( szErrBuf ), "Reading from %s", cszVersionName ); - fgets( szInputBuffer, MAX_BUF_LEN, fhVersion ); - if( iDebugLevel > 0 ) fprintf( stderr, "\n==> %u <==> %s <==", ( unsigned ) strlen( szInputBuffer ), szInputBuffer ); - if( ferror( fhVersion ) ) - { - perror( szErrBuf ); - return 9; - } - if( iDebugLevel > 0 ) fprintf( stderr, "\n==> %u <==> %s <==", ( unsigned ) strlen( szInputBuffer ), szInputBuffer ); - if( cIncrement == 'v' && strncmp( szInputBuffer, cszMajorVersion, strlen( cszMajorVersion ) ) == 0 ) - { - szIncrementNumber( szInputBuffer, strlen( cszMajorVersion ) ); - if( iDebugLevel >= 0 ) fprintf( stderr, "\nMajor version: %s", szInputBuffer ); - } - if( cIncrement == 'm' && strncmp( szInputBuffer, cszMinorVersion, strlen( cszMinorVersion ) ) == 0 ) - { - szIncrementNumber( szInputBuffer, strlen( cszMinorVersion ) ); - if( iDebugLevel >= 0 ) fprintf( stderr, "\nMinor version: %s", szInputBuffer ); - } - if( cIncrement == 'r' && strncmp( szInputBuffer, cszRevision, strlen( cszRevision ) ) == 0 ) - { - szIncrementNumber( szInputBuffer, strlen( cszRevision ) ); - if( iDebugLevel >= 0 ) fprintf( stderr, "\nRevision level: %s", szInputBuffer ); - } - if( strncmp( szInputBuffer, cszLastEntry, strlen( cszLastEntry ) ) == 0 ) - { - szReplaceQuoted( szInputBuffer, szNewLog ); - if( iDebugLevel >= 0 ) fprintf( stderr, "\nNew log: %s", szInputBuffer ); - } - if( strncmp( szInputBuffer, cszLastID, strlen( cszLastID ) ) == 0 ) - { - szReplaceQuoted( szInputBuffer, szNewID ); - if( iDebugLevel >= 0 ) fprintf( stderr, "\nNew ID: %s", szInputBuffer ); - } - if( !feof( fhVersion ) ) - { - snprintf( szErrBuf, sizeof( szErrBuf ), "Writing to %s", cszRewriteName ); - fputs( szInputBuffer, fhRewrite ); - if( ferror( fhRewrite ) ) - { - perror( szErrBuf ); - return 10; - } - } - } - fclose( fhVersion ); - fclose( fhRewrite ); - snprintf( szErrBuf, sizeof( szErrBuf ), "Deleting %s", cszVersionName ); - if( remove( cszVersionName ) ) - { - perror( szErrBuf ); - return 11; - } - snprintf( szErrBuf, sizeof( szErrBuf ), "Renaming %s to %s", cszRewriteName, cszVersionName ); - if( rename( cszRewriteName, cszVersionName ) ) - { - perror( szErrBuf ); - return 11; - } - } - } - return 0; -} - -#if defined( HB_WINCE ) && !defined( __CEGCC__ ) -# include "hbwmain.c" -#endif