MCPcopy Create free account
hub / github.com/Singular/Singular / main

Function main

Singular/checklibs.c:280–471  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

278}
279
280int main(int argc, char** argv)
281{
282 int have_version=0;
283 int have_category=0;
284 int have_info=0;
285 unsigned char *p;
286
287 memset(proc,0,NUM_PROC*sizeof(char*));
288 memset(have_doc,0,NUM_PROC);
289 memset(have_example,0,NUM_PROC);
290 memset(proc_found,0,NUM_PROC);
291 if (argc==1)
292 {
293 f=stdin;
294 }
295 else
296 {
297 if (argc!=2) { printf("usage: %s lib-file\n",argv[0]); return 1;}
298 printf("\n CHECKING LIBRARY %s\n\n",argv[1]);
299 f=fopen(argv[1],"r");
300 if(f==NULL) { printf("cannot read %s\n",argv[1]); return 2; }
301 }
302
303 buf[0]='\0';
304 get_next(); header++;
305 if (strncmp(buf,"//",2)!=0) { printf("error: lib must start with //\n"); }
306 else { get_next(); header++; }
307 /* pass 1: check header */
308 while(1)
309 {
310 if ((p=strstr(buf,"version="))!=NULL)
311 {
312 unsigned char *pp=buf;
313 while (pp!=p)
314 {
315 if ((*pp!=' ')&&(*pp!='\t')) break;
316 pp++;
317 }
318 if (p=pp)
319 {
320 have_version++;
321 pp=p+8;
322 while((*pp)==' ') pp++;
323 /* syntax of version string: "version <filename> <version> <date> "
324 if (*pp)!='"')
325 printf("error: version string should ....");
326 */
327 }
328 }
329 if ((p=strstr(buf,"category="))!=NULL)
330 {
331 unsigned char *pp=buf;
332 while (pp!=p)
333 {
334 if ((*pp!=' ')&&(*pp!='\t')) break;
335 pp++;
336 }
337 if (p=pp) have_category++;

Callers

nothing calls this directly

Calls 3

get_nextFunction · 0.85
scan_infoFunction · 0.85
scan_proc_helpFunction · 0.85

Tested by

no test coverage detected