GAP 4.8.9 installation with standard packages -- copy to your CoCalc project to get it
#include "typedef.h"1#include "tools.h"2#include"getput.h"3#include"datei.h"4#include "matrix.h"56/**************************************************************************\7@---------------------------------------------------------------------------8@---------------------------------------------------------------------------9@ FILE: get_zentr.c10@---------------------------------------------------------------------------11@---------------------------------------------------------------------------12@13\**************************************************************************/1415/**************************************************************************\16@---------------------------------------------------------------------------17@ void get_zentr(B)18@ symbol_out *B;19@20@ Another function for the 'Datei' programm.21@ It reads matrices form the file 'B->fn' and22@ stores them in 'B->zentr'.23@ Reads additionally a filename stated beyond the matrices24@ and stores it in B->fn.25@---------------------------------------------------------------------------26@27\**************************************************************************/28void get_zentr(B)29symbol_out *B;30{3132char *file_name;33boolean header = FALSE;34char st;35char *fn,36*old_fn; /* the pointer fn is modified via fn++, old_fn37just makes it possible to free it */38FILE *infile;39int anz;40int k ;4142file_name = B->fn;43B->fn = NULL;44/*------------------------------------------------------------*\45| Open input file |46\*------------------------------------------------------------*/47if ( file_name == NULL )48infile = stdin;49else50if ( (infile = fopen (file_name, "r")) == NULL ) {51fprintf (stderr, "get_zentr: Could not open input-file %s\n", file_name);52exit (4);53}54fscanf (infile, "%*[ \t\n\r]");55st = getc(infile);56if ( st != '#' ) {57anz = 1;58ungetc(st,infile);59}60else61fscanf (infile, "%u", &anz);62/*--------------------------------------------------------------------*\63| read the matrices |64\*--------------------------------------------------------------------*/65if(anz != 0)66B->grp->zentr = (matrix_TYP **)malloc(anz*sizeof(matrix_TYP *));67B->grp->zentr_no = anz;68for ( k = 0; k < anz; k++) {69B->grp->zentr[k] = fget_mat(infile);70}7172/*------------------------------------------------------------*\73| read file with other almost decomposable bravais-group |74\*------------------------------------------------------------*/75old_fn = fn = (char *) malloc(80 *sizeof(char));76fscanf (infile, "%[ \t\n]", fn);77fscanf (infile, "%[^\n]", fn);78while(fn != NULL && fn[0] == ' ')79fn++;8081/* added free(old_fn), tilman 7/5/97 */82if(fn[0] == '\n' ||83fn[0] == '0' ||84fn[0] == EOF ||85fn[0] == '\t' ||86fn[0] == '%' ||87fn[0] == '\f' ||88fn[0] == '\r' ||89fn[0] == '\v'){90free(old_fn);91fn = NULL;92}9394if(fn != NULL)95strtok (fn, "%");96if(fn != NULL)97{98B->fn = calloc( 80 , sizeof(char) );99strcat( B->fn, TABLES);100/***********************101strcat( B->fn, TOPDIR "/lib/");102***********************/103strcat(B->fn, fn);104free ( fn );105}106/*------------------------------------------------------------*\107| Close input file |108\*------------------------------------------------------------*/109if ( infile != stdin )110fclose (infile);111112/* inserted tilman 7/5/97 */113if (file_name != NULL) free(file_name);114115}116/*{{{}}}*/117118119