| 428 | */ |
| 429 | |
| 430 | void singular_example(char *str) |
| 431 | { |
| 432 | assume(str!=NULL); |
| 433 | char *s=str; |
| 434 | while (*s==' ') s++; |
| 435 | char *ss=s; |
| 436 | while (*ss!='\0') ss++; |
| 437 | while (*ss<=' ') |
| 438 | { |
| 439 | *ss='\0'; |
| 440 | ss--; |
| 441 | } |
| 442 | idhdl h=IDROOT->get_level(s,0); |
| 443 | if ((h!=NULL) && (IDTYP(h)==PROC_CMD)) |
| 444 | { |
| 445 | char *lib=iiGetLibName(IDPROC(h)); |
| 446 | if((lib!=NULL)&&(*lib!='\0')) |
| 447 | { |
| 448 | Print("// proc %s from lib %s\n",s,lib); |
| 449 | s=iiGetLibProcBuffer(IDPROC(h), 2); |
| 450 | if (s!=NULL) |
| 451 | { |
| 452 | if (strlen(s)>5) |
| 453 | { |
| 454 | iiEStart(s,IDPROC(h)); |
| 455 | omFree((ADDRESS)s); |
| 456 | return; |
| 457 | } |
| 458 | else omFree((ADDRESS)s); |
| 459 | } |
| 460 | } |
| 461 | } |
| 462 | else |
| 463 | { |
| 464 | char sing_file[MAXPATHLEN]; |
| 465 | FILE *fd=NULL; |
| 466 | char *res_m=feResource('m', 0); |
| 467 | if (res_m!=NULL) |
| 468 | { |
| 469 | snprintf(sing_file,MAXPATHLEN, "%s/%s.sing", res_m, s); |
| 470 | fd = feFopen(sing_file, "r"); |
| 471 | } |
| 472 | if (fd != NULL) |
| 473 | { |
| 474 | |
| 475 | int old_echo = si_echo; |
| 476 | int length, got; |
| 477 | char* s; |
| 478 | |
| 479 | fseek(fd, 0, SEEK_END); |
| 480 | length = ftell(fd); |
| 481 | fseek(fd, 0, SEEK_SET); |
| 482 | s = (char*) omAlloc((length+20)*sizeof(char)); |
| 483 | got = fread(s, sizeof(char), length, fd); |
| 484 | fclose(fd); |
| 485 | if (got != length) |
| 486 | { |
| 487 | Werror("Error while reading file %s", sing_file); |
no test coverage detected