Changeset bb9659 in git


Ignore:
Timestamp:
Jul 21, 2014, 11:16:26 AM (10 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
638c230a7830a70d265a617a0f2f2fa0505f2ec0
Parents:
31d40c145242ddd7da4100d5cad7ccb19297b6ad
Message:
fix: help: builtin, info
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Singular/fehelp.cc

    r31d40c rbb9659  
    501501        }
    502502        if (c == EOF) goto Failure;
     503        if (hentry->node[0]=='\0')
     504          strcpy(hentry->node,hentry->key);
    503505
    504506        // get url
    505         hentry->node[i] = '\0';
     507        //hentry->node[i] = '\0';
    506508        i = 0;
    507509        while ((c = getc(fd)) != '\t' && c != EOF)
     
    11451147  Warn("information on Singular running under Emacs, type C-h m.");
    11461148}
    1147 static int singular_manual(char *str);
     1149static int singular_manual(char *str, BOOLEAN isIndexEntry);
    11481150static void heBuiltinHelp(heEntry hentry, int /*br*/)
    11491151{
    1150   char* node = omStrDup(hentry != NULL && *(hentry->node) != '\0' ?
    1151                        hentry->node : "Top");
    1152   singular_manual(node);
     1152  char* node = omStrDup(hentry != NULL && *(hentry->key) != '\0' ?
     1153                       hentry->key : "Top");
     1154  singular_manual(node,(hentry != NULL) && (hentry->url!=NULL));
    11531155  omFree(node);
    11541156}
     
    12141216
    12151217/*************************************************/
    1216 static int singular_manual(char *str)
     1218static int singular_manual(char *str, BOOLEAN isIndexEntry)
    12171219{ FILE *index=NULL;
    12181220  unsigned long offset;
     
    12291231  }
    12301232
    1231   for(p=str; *p; p++) *p = tolow(*p);/* */
    1232   do
    1233   {
    1234     p--;
    1235   }
    1236   while ((p != str) && (*p<=' '));
    1237   p++;
    1238   *p='\0';
    1239   (void)sprintf(String, " %s ", str);
     1233  if (!isIndexEntry)
     1234  {
     1235    for(p=str; *p; p++) *p = tolow(*p);/* */
     1236    do
     1237    {
     1238      p--;
     1239    }
     1240    while ((p != str) && (*p<=' '));
     1241    p++;
     1242    *p='\0';
     1243    (void)sprintf(String, " %s ", str);
     1244  }
     1245  else
     1246  {
     1247    (void)sprintf(String, " %s", str);
     1248  }
    12401249
    12411250  while(!feof(index)
     
    12451254  while(!feof(index))
    12461255  {
    1247     // char* dummy=fgets(buffer, BUF_LEN, index); /* */
    1248     (void)si_sscanf(buffer, "Node:%[^\177]\177%ld\n", Index, &offset);
    1249     for(p=Index; *p; p++) *p = tolow(*p);/* */
    1250     (void)strcat(Index, " ");
    1251     if( strstr(Index, String)!=NULL)
     1256    if (fgets(buffer, BUF_LEN, index)==NULL) break; /*fill buffer */
     1257    if (si_sscanf(buffer, "Node:%[^\177]\177%ld\n", Index, &offset)!=2)
     1258      continue;
     1259    if (!isIndexEntry)
     1260    {
     1261      for(p=Index; *p; p++) *p = tolow(*p);/* */
     1262      (void)strcat(Index, " ");
     1263      if( strstr(Index, String)!=NULL)
     1264      {
     1265        done++; (void)show(offset, &close);
     1266      }
     1267    }
     1268    else if( strcmp(Index, String)==0)
    12521269    {
    12531270      done++; (void)show(offset, &close);
     1271      break;
    12541272    }
    12551273    Index[0]='\0';
     
    12581276  }
    12591277  if (index != NULL) (void)fclose(index);
    1260   if(! done)
     1278  if(done==0)
    12611279  {
    12621280    Warn("`%s` not found",String);
Note: See TracChangeset for help on using the changeset viewer.