src/ffs/ffs.c
int ffs_command_line_set(ffs_t * obj, const char * argstring) {

  int n;
  size_t argc = 0;
  char ** argv = NULL;

  dbg_return_if(obj == NULL, -1);
  dbg_return_if(argstring == NULL, -1);
  dbg_return_ifm(obj->argc != 0, -1, "Use ffs_command_line_reset()\n");

  /* Use u_strtok() to parse the argstring */

  dbg_err_if(u_strtok(argstring, " ", &argv, &argc));

  /* Add 1 for simulation executable name, and 1 to accommodate
   * argv[argc] = NULL, required by the standard. */

  obj->argc = argc + 1;
  dbg_err_sif((obj->argv = u_calloc((obj->argc + 1), sizeof(char *))) == NULL);

  obj->argv[0] = u_strdup(FFS_SIM_EXECUTABLE_NAME);

  for (n = 0; n < argc; n++) {
    obj->argv[n+1] = u_strdup(argv[n]);
  }
  obj->argv[obj->argc] = NULL;

  u_strtok_cleanup(argv, argc);

  return 0;

 err:
  u_strtok_cleanup(argv, argc);

  return -1;
}
/*****************************************************************************
 *
 *  ffs_command_line_set
 *
 *  We are going to use the utility u_strtok() to build the argv
 *  from the single argument string. We assume this will succeed
 *  or fail uniformly on all ranks, although this does involve
 *  some memory allocation.
 *
 *****************************************************************************/
ffs_command_line_set
We are going to use the utility u_strtok() to build the argv
from the single argument string. We assume this will succeed
or fail uniformly on all ranks, although this does involve
some memory allocation.
ffs_command_line_set We are going to use the utility u_strtok () to build the argv from the single argument string . We assume this will succeed or fail uniformly on all ranks although this does involve some memory allocation .
int ffs_command_line_set(ffs_t * obj, const char * argstring) {
  int n;
  size_t argc = 0;
  char ** argv = NULL;
  dbg_return_if(obj == NULL, -1);
  dbg_return_if(argstring == NULL, -1);
  dbg_return_ifm(obj->argc != 0, -1, "Use ffs_command_line_reset()\n");
  dbg_err_if(u_strtok(argstring, " ", &argv, &argc));
  obj->argc = argc + 1;
  dbg_err_sif((obj->argv = u_calloc((obj->argc + 1), sizeof(char *))) == NULL);
  obj->argv[0] = u_strdup(FFS_SIM_EXECUTABLE_NAME);
  for (n = 0; n < argc; n++) {
    obj->argv[n+1] = u_strdup(argv[n]);
  }
  obj->argv[obj->argc] = NULL;
  u_strtok_cleanup(argv, argc);
  return 0;
 err:
  u_strtok_cleanup(argv, argc);
  return -1;
}
int ffs_command_line_set ( ffs_t * obj , const char * argstring ) { int n ; size_t argc = 0 ; char * * argv = NULL ; dbg_return_if ( obj == NULL , -1 ) ; dbg_return_if ( argstring == NULL , -1 ) ; dbg_return_ifm ( obj -> argc != 0 , -1 , " \n " ) ; dbg_err_if ( u_strtok ( argstring , " " , & argv , & argc ) ) ; obj -> argc = argc + 1 ; dbg_err_sif ( ( obj -> argv = u_calloc ( ( obj -> argc + 1 ) , sizeof ( char * ) ) ) == NULL ) ; obj -> argv [ 0 ] = u_strdup ( FFS_SIM_EXECUTABLE_NAME ) ; for ( n = 0 ; n < argc ; n ++ ) { obj -> argv [ n + 1 ] = u_strdup ( argv [ n ] ) ; } obj -> argv [ obj -> argc ] = NULL ; u_strtok_cleanup ( argv , argc ) ; return 0 ; err : u_strtok_cleanup ( argv , argc ) ; return -1 ; }
ffs_command_line_set
  We are going to use the utility u_strtok() to build the argv
  from the single argument string.
ffs_command_line_set We are going to use the utility u_strtok () to build the argv from the single argument string .
/* Use u_strtok() to parse the argstring */ /* Add 1 for simulation executable name, and 1 to accommodate
   * argv[argc] = NULL, required by the standard. */