/*
*  C Implementation: %{$MODULE}
*
* Description:
*
*
* Author: %{AUTHOR} <%{EMAIL}>, (C) %{YEAR}
*
* Copyright: See COPYING file that comes with this distribution
*
*/

#include <tcl.h>
#include <stdlib.h>

int myhello(ClientData cd,Tcl_Interp*inter,
	    int argc,CONST char*argv[])
{
	int i,sum=0;
	char buf[32];
	if(argc<2){
		Tcl_SetResult(inter,"Nothing to add.",TCL_STATIC);
		return TCL_ERROR;
	}
	for(i=1;i<argc;i++)
		sum+=atoi(argv[i]);
	sprintf(buf,"%i",sum);
	Tcl_SetResult(inter,buf,TCL_VOLATILE);
	return TCL_OK;
}


int Extstr_Init(Tcl_Interp*inter)
{
	Tcl_CreateCommand(inter,"hello",myhello,
		(ClientData)0,(Tcl_CmdDeleteProc*)0);
	return TCL_OK;
}
