/[grub]/grub2/normal/main.c
ViewVC logotype

Diff of /grub2/normal/main.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.8 by okuji, Sun Feb 27 21:19:05 2005 UTC revision 1.9 by okuji, Tue Mar 8 01:01:06 2005 UTC
# Line 304  grub_normal_init_page (void) Line 304  grub_normal_init_page (void)
304                 PACKAGE_VERSION);                 PACKAGE_VERSION);
305  }  }
306    
307    /* Read the file command.lst for auto-loading.  */
308    static void
309    read_command_list (void)
310    {
311      const char *prefix;
312      
313      prefix = grub_env_get ("prefix");
314      if (prefix)
315        {
316          char *filename;
317    
318          filename = grub_malloc (grub_strlen (prefix) + sizeof ("/command.lst"));
319          if (filename)
320            {
321              grub_file_t file;
322              
323              grub_sprintf (filename, "%s/command.lst", prefix);
324              file = grub_file_open (filename);
325              if (file)
326                {
327                  char buf[80]; /* XXX arbitrary */
328    
329                  while (get_line (file, buf, sizeof (buf)))
330                    {
331                      char *p;
332                      grub_command_t cmd;
333                      
334                      if (! grub_isgraph (buf[0]))
335                        continue;
336    
337                      p = grub_strchr (buf, ':');
338                      if (! p)
339                        continue;
340    
341                      *p = '\0';
342                      while (*++p == ' ')
343                        ;
344    
345                      if (! grub_isgraph (*p))
346                        continue;
347    
348                      cmd = grub_register_command (buf, 0,
349                                                   GRUB_COMMAND_FLAG_NOT_LOADED,
350                                                   0, 0, 0);
351                      if (! cmd)
352                        continue;
353    
354                      cmd->module_name = grub_strdup (p);
355                      if (! cmd->module_name)
356                        grub_unregister_command (buf);
357                    }
358    
359                  grub_file_close (file);
360                }
361    
362              grub_free (filename);
363            }
364        }
365    
366      /* Ignore errors.  */
367      grub_errno = GRUB_ERR_NONE;
368    }
369    
370  /* Read the config file CONFIG and execute the menu interface or  /* Read the config file CONFIG and execute the menu interface or
371     the command-line interface.  */     the command-line interface.  */
372  void  void
# Line 319  grub_normal_execute (const char *config, Line 382  grub_normal_execute (const char *config,
382        grub_errno = GRUB_ERR_NONE;        grub_errno = GRUB_ERR_NONE;
383      }      }
384    
385      read_command_list ();
386      
387    if (menu)    if (menu)
388      {      {
389        grub_menu_run (menu, nested);        grub_menu_run (menu, nested);

Legend:
Removed from v.1.8  
changed lines
  Added in v.1.9

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26