use a list instead of a string to store the names of installed packages
This commit is contained in:
@ -153,10 +153,10 @@ help:
|
||||
|
||||
lmpinstalledpkgs.h: $(SRC) $(INC)
|
||||
@echo 'Gathering installed package information (may take a little while)'
|
||||
@echo 'static const char lammps_installed_packages[] = " "' > lmpinstalledpkgs.tmp
|
||||
@echo 'static const char * lammps_installed_packages[] = {' > lmpinstalledpkgs.tmp
|
||||
@for p in $(PACKAGEUC) $(PACKUSERUC); do info=$$($(SHELL) Package.sh $$p installed); \
|
||||
[ -n "$$info" ] && echo "\"$$info\"" | sed -e 's/".*package/"/' >> lmpinstalledpkgs.tmp || :; done
|
||||
@echo ';' >> lmpinstalledpkgs.tmp
|
||||
[ -n "$$info" ] && echo "\"$$info\"" | sed -e 's/".*package \(.*\)"/"\1",/' >> lmpinstalledpkgs.tmp || :; done
|
||||
@echo ' NULL };' >> lmpinstalledpkgs.tmp
|
||||
@if [ -f lmpinstalledpkgs.h ]; \
|
||||
then test "`diff --brief lmpinstalledpkgs.tmp lmpinstalledpkgs.h`" != "" && \
|
||||
mv lmpinstalledpkgs.tmp lmpinstalledpkgs.h || rm lmpinstalledpkgs.tmp ; \
|
||||
|
||||
@ -826,7 +826,7 @@ void LAMMPS::help()
|
||||
|
||||
|
||||
print_config(fp);
|
||||
fprintf(fp,"List of style options included in this LAMMPS executable\n\n");
|
||||
fprintf(fp,"List of individual style options included in this LAMMPS executable\n\n");
|
||||
|
||||
int pos = 80;
|
||||
fprintf(fp,"* Atom styles:\n");
|
||||
@ -1060,6 +1060,19 @@ static const char lammps_config_options[]
|
||||
|
||||
void LAMMPS::print_config(FILE *fp)
|
||||
{
|
||||
const char *pkg;
|
||||
int ncword, ncline = 0;
|
||||
|
||||
fputs(lammps_config_options,fp);
|
||||
fprintf(fp,"Installed packages:%s\n\n",lammps_installed_packages);
|
||||
fputs("Installed packages:\n\n",fp);
|
||||
for (int i = 0; NULL != (pkg = lammps_installed_packages[i]); ++i) {
|
||||
ncword = strlen(pkg);
|
||||
if (ncline + ncword > 78) {
|
||||
ncline = 0;
|
||||
fputs("\n",fp);
|
||||
}
|
||||
fprintf(fp,"%s ",pkg);
|
||||
ncline += ncword + 1;
|
||||
}
|
||||
fputs("\n\n",fp);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user