/* combine_arg.h */
#include <stdlib.h>
#include <string.h>
/* combine_arg.h */
char *combine_arg(int c,char **arg); /* combine the arguments on command line */
/* combine_arg.c */
/* combine the arguments on command line */
#include "combine_arg.h"
char *combine_arg(int c,char **arg)
{
int i,j=0;
char *s;
/* counts the number of characters in the arguments */
for (i=1;i<c;i++)
j+=strlen(arg[i])+1;
/* paste the arguments */
s = (char *)malloc(j*sizeof(char));
memset (s, "\0", sizeof(s));
strcat(s,arg[1]);
for (i=2;i<c;i++)
{
strcat(s," ");
strcat(s,arg[i]);
}
return s;
}
/* submit_cmd.h */
#include <lsf/lsbatch.h>
#include "combine_arg.h"
int submit_cmd(struct submit *req, struct submitReply *reply, int c, char **arg);
/* submit_cmd.c */
/* submit a job with specifications (without error checking) */
#include "submit_cmd.h"
int submit_cmd(struct submit *req, struct submitReply *reply, int c, char **arg)
{
int i;
lsb_init(arg[0]);
for (i = 0; i < LSF_RLIM_NLIMITS; i++)
req->rLimits[i] = DEFAULT_RLIMIT;
req->numProcessors = 1;
req->maxNumProcessors = 1;
req->options = 0;
req->options2 = 0;
req->command = combine_arg(c,arg);
req->beginTime = 0;
req->termTime = 0;
return lsb_submit(req, reply);
}