Changeset 69331f in git for Singular/fehelp.cc
- Timestamp:
- Feb 25, 2009, 6:36:32 PM (15 years ago)
- Branches:
- (u'spielwiese', '8e0ad00ce244dfd0756200662572aef8402f13d5')
- Children:
- 3060a73242c56484e4c175cb564cf06f7a959d2e
- Parents:
- 14db39c727ddf950b7c8c1919e53b77d77771923
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/fehelp.cc
r14db39 r69331f 4 4 /* 5 5 * ABSTRACT: help system 6 * versin $Id: fehelp.cc,v 1.5 4 2008-09-25 10:20:37Singular Exp $6 * versin $Id: fehelp.cc,v 1.55 2009-02-25 17:36:32 Singular Exp $ 7 7 */ 8 8 … … 127 127 BOOLEAN key_is_regexp = (strchr(str, '*') != NULL); 128 128 heEntry_s hentry; 129 memset(&hentry,0,sizeof(hentry)); 129 130 char* idxfile = feResource('x' /*"IdxFile"*/); 130 131 131 132 // Try exact match of help string with key in index 132 if (!key_is_regexp && idxfile != NULL&& heKey2Entry(idxfile, str, &hentry))133 if (!key_is_regexp && (idxfile != NULL) && heKey2Entry(idxfile, str, &hentry)) 133 134 { 134 135 heBrowserHelp(&hentry); … … 860 861 { 861 862 Warn("Displaying help in browser '%s'.", heCurrentHelpBrowser->browser); 862 if (strcmp(heCurrentHelpBrowser->browser, "netscape") == 0 &&863 feResource('h', 0) == NULL)864 {865 Warn("Using URL '%s'.", feResource('u', 0));866 }863 //if (strcmp(heCurrentHelpBrowser->browser, "netscape") == 0 && 864 // feResource('h', 0) == NULL) 865 //{ 866 // Warn("Using URL '%s'.", feResource('u', 0)); 867 //} 867 868 Warn("Use 'system(\"--browser\", <browser>);' to change browser,"); 868 869 char* browsers = StringSetS("where <browser> can be: "); … … 891 892 { 892 893 if (heHelpBrowsers[br].required==NULL) return TRUE; 894 Print("req:%s\n",heHelpBrowsers[br].required); 893 895 const char *p=heHelpBrowsers[br].required; 894 896 while (*p>'\0') … … 1164 1166 1165 1167 /*************************************************/ 1166 static int show(unsigned long offset, FILE *help,char *close)1168 static int show(unsigned long offset, char *close) 1167 1169 { char buffer[BUF_LEN+1]; 1168 1170 int lines = 0; 1169 1170 if( help== NULL) 1171 1172 1171 FILE * help; 1172 1173 if( (help = fopen(feResource('i'), "rb")) == NULL) 1174 return HELP_NOT_OPEN; 1173 1175 1174 1176 fseek(help, (long)(offset+1), (int)0); 1175 while( !feof(help)1176 && *fgets(buffer, BUF_LEN, help) != EOF1177 && buffer[0] != FIN_INDEX)1177 while( (!feof(help)) 1178 && (*fgets(buffer, BUF_LEN, help) != EOF) 1179 && (buffer[0] != FIN_INDEX)) 1178 1180 { 1179 1181 printf("%s", buffer); … … 1199 1201 getchar(); 1200 1202 } 1203 fclose(help); 1201 1204 return HELP_OK; 1202 1205 } … … 1204 1207 /*************************************************/ 1205 1208 static int singular_manual(char *str) 1206 { FILE *index=NULL ,*help=NULL;1209 { FILE *index=NULL; 1207 1210 unsigned long offset; 1208 1211 char *p,close; … … 1211 1214 Index[IDX_LEN+1], 1212 1215 String[IDX_LEN+1]; 1216 Print("HELP >>%s>>\n",str); 1213 1217 1214 1218 if( (index = fopen(feResource('i'), "rb")) == NULL) … … 1228 1232 1229 1233 while(!feof(index) 1230 && fgets(buffer, BUF_LEN, index) != (char *)01231 && buffer[0] != FIN_INDEX);1234 && (fgets(buffer, BUF_LEN, index) != (char *)0) 1235 && (buffer[0] != FIN_INDEX)); 1232 1236 1233 1237 while(!feof(index)) … … 1239 1243 if( strstr(Index, String)!=NULL) 1240 1244 { 1241 done++; (void)show(offset, help,&close);1245 done++; (void)show(offset, &close); 1242 1246 } 1243 1247 Index[0]='\0'; … … 1246 1250 } 1247 1251 if (index != NULL) (void)fclose(index); 1248 if (help != NULL) (void)fclose(help);1249 1252 if(! done) 1250 1253 {
Note: See TracChangeset
for help on using the changeset viewer.