home *** CD-ROM | disk | FTP | other *** search
/ PC Plus SuperCD (UK) 1999 May / pcp151c.iso / misc / src / install / hints.c < prev    next >
Encoding:
C/C++ Source or Header  |  1998-08-11  |  1.4 KB  |  60 lines

  1. #include <newt.h>
  2. #include <popt.h>
  3.  
  4. #include "hints.h"
  5. #include "intl.h"
  6. #include "kickstart.h"
  7. #include "lilo.h"
  8.  
  9. static void parseLilo(struct hints * hints) {
  10.     char * location = NULL;
  11.     int linear = 0;
  12.     char ** argv;
  13.     int argc, rc;
  14.     poptContext optCon;
  15.     struct poptOption ksOptions[] = {
  16.         { "append", '\0', POPT_ARG_STRING, &hints->bootloader.options, 0 },
  17. #ifdef __i386__
  18.         { "linear", '\0', 0, &linear, 0 },
  19.         { "location", '\0', POPT_ARG_STRING, 
  20.             &location, 0 },
  21. #endif
  22.         { 0, 0, 0, 0, 0 }
  23.     };
  24.  
  25.     hints->bootloader.options = NULL;
  26.  
  27.     if (!ksGetCommand(KS_CMD_LILO, NULL, &argc, &argv)) {
  28.     optCon = poptGetContext(NULL, argc, argv, ksOptions, 0);
  29.  
  30.     if ((rc = poptGetNextOpt(optCon)) < -1) {
  31.         newtWinMessage(_("lilo command"),  _("Ok"),
  32.                _("bad argument to kickstart lilo command %s: %s"),
  33.                poptBadOption(optCon, POPT_BADOPTION_NOALIAS), 
  34.                poptStrerror(rc));
  35.     }
  36.  
  37.     poptFreeContext(optCon);
  38.     }
  39.  
  40.     hints->bootloader.flags = LILO_USE_OPTIONS;
  41.  
  42.     if (!location || !strcmp(location, "mbr"))
  43.     hints->bootloader.flags |= LILO_ON_MBR;
  44.     else if (!strcmp(location, "partition"))
  45.     hints->bootloader.flags |= LILO_ON_PARTITION;
  46.     else if (!strcmp(location, "none")) {
  47.     hints->flags |= HINT_SKIPBOOTLOADER;
  48.     return;
  49.     }
  50.  
  51.     if (linear)
  52.     hints->bootloader.flags |= LILO_USE_LINEAR;
  53.  
  54.     return;
  55. }
  56.  
  57. void ksToHints(struct hints * hints) {
  58.     parseLilo(hints);
  59. }
  60.