Changeset c04b94 in git for Singular/misc.cc


Ignore:
Timestamp:
Dec 6, 1999, 5:07:00 PM (24 years ago)
Author:
Olaf Bachmann <obachman@…>
Branches:
(u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', '38dfc5131670d387a89455159ed1e071997eec94')
Children:
e612312190d9035d6258e7dd6bac20871a42d807
Parents:
4a553b8ad97e5927df9e168f04952d3d3c4d855c
Message:
* example on kernel commands implemented


git-svn-id: file:///usr/local/Singular/svn/trunk@3959 2c84dea3-7e68-4137-9b89-c4e89433aadc
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Singular/misc.cc

    r4a553b rc04b94  
    232232    }
    233233  }
    234   Werror("%s not found",str);
     234  else
     235  {
     236    char sing_file[MAXPATHLEN];
     237    FILE *fd;
     238    sprintf(sing_file, "%s/%s.sing", feResource('m', 0), s);
     239    fd = feFopen(sing_file, "r");
     240    if (fd != NULL)
     241    {
     242     
     243      int old_echo = si_echo;
     244      int length, got;
     245      char* s;
     246     
     247      fseek(fd, 0, SEEK_END);
     248      length = ftell(fd);
     249      fseek(fd, 0, SEEK_SET);
     250      s = (char*) AllocL((length+20)*sizeof(char));
     251      got = fread(s, sizeof(char), length, fd);
     252      fclose(fd);
     253      if (got != length)
     254      {
     255        Werror("Error while reading file %s", sing_file);
     256        FreeL(s);
     257      }
     258      else
     259      {
     260        s[length] = '\0';
     261        strcat(s, "\n;return();\n\n");
     262        si_echo = 2;
     263        iiEStart(s, NULL);
     264        si_echo = old_echo;
     265      }
     266    }
     267    else
     268    {
     269      Werror("no example for %s", str);
     270    }
     271  }
    235272}
    236273
Note: See TracChangeset for help on using the changeset viewer.