/* Implementation of the factor command */
#include "mktclapp.h"

int ET_COMMAND_factor(ET_TCLARGS){
  int i, n;
  if( argc!=3 ){
    Et_ResultF(interp,"wrong # args: should be \"%s NUM PROC\"",argv[0]);
    return TCL_ERROR;
  }
  n = atoi(argv[1]);
  for(i=1; i<=n; i++){
    if( (n/i)*i!=n ) continue;
    if( Et_EvalF(interp, "%s %d", argv[2], i)!=TCL_OK ){
      return TCL_ERROR;
    }
  }
  return TCL_OK;
}
