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

#include <tcl.h>

int myhello(ClientData cd,Tcl_Interp*inter,
	    int objc,Tcl_Obj *CONST objv[])
{
	int i,x,sum=0;
	Tcl_Obj *ret;
	if(objc<2){
		Tcl_SetResult(inter,"Nothing to add.",TCL_STATIC);
		return TCL_ERROR;
	}
	for(i=1;i<objc;i++){
		if(Tcl_GetIntFromObj(inter,objv[i],&x)==TCL_OK){
			sum+=x;
		} else {
			return TCL_ERROR;
		}
	}
	ret=Tcl_NewIntObj(sum);
	Tcl_SetObjResult(inter,ret);
	return TCL_OK;
}


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