You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

main.c.patch 1.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. --- main.c Mon Nov 5 18:58:30 2001
  2. +++ main.c.new Thu Nov 15 01:45:12 2001
  3. @@ -149,21 +151,49 @@
  4. static unsigned short ipchksum(unsigned short *ip, int len);
  5. static unsigned short udpchksum(struct iphdr *packet);
  6. +
  7. +#if defined(ASK_BOOT) && ASK_BOOT > 0 && (ANS_DEFAULT == ANS_AUTO)
  8. +/*
  9. + * Read Installed Hard Disk Count from BIOS memory at 0:0475
  10. + */
  11. +static int hdsk_cnt(void)
  12. +{
  13. + int retv;
  14. + __asm__ __volatile__(
  15. + "xorw %%ax,%%ax\n\t"
  16. + "movb 0x475,%%al\n"
  17. + : "=a" (retv)
  18. + : /* no inputs */
  19. + : "ax", "cc", "memory"
  20. + );
  21. + return(retv);
  22. +}
  23. +#endif /* ASK_BOOT && ANS_AUTO */
  24. +
  25. +
  26. static inline void ask_boot(void)
  27. {
  28. #if defined(ASK_BOOT) && ASK_BOOT > 0
  29. while(1) {
  30. - int c;
  31. + int c, deflt;
  32. unsigned long time;
  33. +#if defined(ASK_BOOT) && ASK_BOOT > 0 && (ANS_DEFAULT == ANS_AUTO)
  34. + if (hdsk_cnt() != 0)
  35. + deflt = ANS_LOCAL;
  36. + else
  37. + deflt = ANS_NETWORK;
  38. +#else
  39. + deflt = ANS_DEFAULT;
  40. +#endif
  41. printf(ASK_PROMPT);
  42. for (time = currticks() + ASK_BOOT*TICKS_PER_SEC; !iskey(); )
  43. if (currticks() > time) {
  44. - c = ANS_DEFAULT;
  45. + c = deflt;
  46. goto done;
  47. }
  48. c = getchar();
  49. if ((c >= 'a') && (c <= 'z')) c &= 0x5F;
  50. - if (c == '\n') c = ANS_DEFAULT;
  51. + if (c == '\n') c = deflt;
  52. done:
  53. if ((c >= ' ') && (c <= '~')) putchar(c);
  54. putchar('\n');