Bug in partition command

I think I found a bug in the partition command, which is reproduced by the
following short C program (which links to LAMMPS as a library):
/* START */
#include "library.h"
int main (int argc, char **argv) {
    void *lmp = NULL;
    lammps_open_no_mpi (argc, argv, &lmp);
    lammps_command (lmp, "partition yes 1 print 'Hello'");
    lammps_close (lmp);
    return 0;
} /* END */

It gets more interesting if you remove the single quotes. *smile*

The culprit is lines 783 of input.cpp:
   strcpy(copy,line); // line 782
   copy[strlen(copy)-1] = '\0';
   char *ptr = strtok(copy," \t\n\r\f");
Line 783 assumes that the last character in "line" is \n, which is not the
case in the example above (though it would be if I'd read the command from
a file the way input->file does it).

I think simply deleting that line is a fix, since the strtok command will
remove the \n anyway if it's present.

An alternative is to do something like
   if ( copy[strlen(copy)-1] == '\n' ) copy[strlen(copy)-1] = '\0';

Karl D. Hammond
University of Tennessee, Knoxville
[email protected]...

"You can never know everything, and part of what you know is always
   wrong. A portion of wisdom lies in knowing that. A portion of courage
   lies in going on anyway."
"Nothing ever goes as you expect. Expect nothing, and you will not be
   surprised."

fixed it by removing the line ... will be in next patch

Thanks,
Steve