[cvsnt] How to force CVSNT users to write acommentwhencommintingchanges?

Prochazka, Jan Jan.Prochazka at brooks.com
Fri Feb 18 21:15:47 GMT 2005


Hmm, I do not have any public website and do not plan on it either and
still would like to share with others some useful piece of code...
Never mind, bad luck for the others.

Jan

P.S. Here, at least, my verifymsg.cpp is:
---------------------------

#include <stdio.h>
#include <stdlib.h>
#include <direct.h>
#include <errno.h>
#include <tchar.h>
#include <atlstr.h>

int _tmain(int argc, _TCHAR* argv[])
{
	char* buffer;
	CString msg, msgOrig="";
	FILE* msgFile; 
    long lSize;

	//something is wrong (file name should be here)
	if (argc <= 1){
		printf("\nSomething ir really wrong, file name is
missing.\n\n");
		return 2;
	}
	if (NULL==(msgFile = fopen(argv[1],"rt"))){
		printf("\nSomething ir really wrong, can not open
message file.\n\n");
		return 2;
	}

	//jump to C

    // obtain file size.
	fseek(msgFile , 0 , SEEK_END);
	lSize = ftell(msgFile);
	rewind(msgFile);

	// allocate memory to contain the whole file.
	buffer = (char*) malloc(lSize);
	if (buffer == NULL){
		printf("\nSomething ir really wrong, can not allocate
message buffer.\n\n");
		fclose(msgFile);
		return 3;
	}
	// copy the file into the buffer.
	fread(buffer,1,lSize,msgFile);

	/*** the whole file is loaded in the buffer. ***/

    fclose(msgFile);
	//add end of string
	buffer[lSize-1] = '\0';
	
	//jump back to C++
	 
	msgOrig = msg = buffer;
	free(buffer);
    
	msg.Trim();
	
	//at least 1 space in the message
	if (msg.Find(" ") == -1){
		printf("\nPlease provide a more substantial commit
message then \n\n");
		printf("'%s'\n\n",msgOrig);
		return 1;
	}

	//at least 6 chaqracters   
	msg.Remove(' ');
	msg.Remove('\t');
	msg.Remove('\n');
	if (msg.GetLength() < 6){
		printf("\nPlease provide a more substantial commit
message then \n\n");
		printf("'%s'\n\n",msgOrig);
		return 1;
	}
	
	//OK
	return 0;
}
-------------------------------


> -----Original Message-----
> From: cvsnt-bounces at cvsnt.org [mailto:cvsnt-bounces at cvsnt.org] On
Behalf
> Of Bo Berglund
> Sent: Friday, February 18, 2005 14:04
> To: cvsnt at cvsnt.org
> Subject: Re: [cvsnt] How to force CVSNT users to write
> acommentwhencommintingchanges?
> 
> On Fri, 18 Feb 2005 12:26:09 -0500, "Prochazka, Jan"
> <Jan.Prochazka at brooks.com> wrote:
> 
> >I see. Is there any way to upload somewhere some piece of code so the
> >others can also benefit form it (this particular one is MSVS7.1
project)
> >
> >Jan
> 
> Put it on your website and post a link here.
> 
> 
> /Bo
> (Bo Berglund, developer in Sweden)
> _______________________________________________
> cvsnt mailing list
> cvsnt at cvsnt.org
> http://www.cvsnt.org/cgi-bin/mailman/listinfo/cvsnt
> 
> _____________________________________________________________________
> This email has been scanned by the MessageLabs Email Security System.

_____________________________________________________________________
This email message, including any attachments, may contain confidential and proprietary information for the sole use of the intended recipient.  If you are not the intended recipient, you are hereby notified that any use, copying or dissemination of this message is strictly prohibited.  If you received this message in error, please notify Brooks Automation, Inc. immediately by reply email or by calling Brooks US Headquarters at +1 978-262-2400. Then delete this message from your system, without making any copy or distribution.  Thank you.



More information about the cvsnt mailing list