5 #include <polylib/polylib.h>
7 /****************************************************/
8 /* Read_ParamNames() : */
9 /* Reads FILE *in for the parameter names */
10 /* if in==NULL or not enough parameters on input, */
11 /* use default names */
12 /* returns an n-array of strings */
13 /****************************************************/
14 const char **Read_ParamNames(FILE *in
,int m
)
18 char s
[1024],param
[32];
24 f
= (fgets(s
, 1024, in
)!=NULL
);
25 while (f
&& (*s
=='#' || *s
=='\n'));
27 param_name
= (char **)malloc(m
*sizeof(char *));
40 if(s
[c
]=='\n' || s
[c
]==0)
45 /* Not enough parameters on input, end */
49 param_name
[i
] = (char *)malloc( (j
+1)*sizeof(char) );
50 strcpy(param_name
[i
],param
);
54 /* Not enough parameters on input : use default names */
57 param_name
[i
] = (char *) malloc(2*sizeof(char));
58 sprintf(param_name
[i
], "%c", PCHAR
+i
+1);
61 return (const char**)param_name
;
62 } /* Read_ParamNames */
64 void Free_ParamNames(const char **params
, int m
)
67 free((char *)params
[m
]);