patch-xroach_c 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. $OpenBSD: patch-xroach_c,v 1.1 2007/10/26 21:19:17 ajacoutot Exp $
  2. --- xroach.c.orig Fri Jun 4 02:00:00 1993
  3. +++ xroach.c Fri Oct 26 23:11:46 2007
  4. @@ -77,7 +77,7 @@ int CalcRootVisible();
  5. int MarkHiddenRoaches();
  6. Pixel AllocNamedColor();
  7. -void
  8. +int
  9. main(ac, av)
  10. int ac;
  11. char *av[];
  12. @@ -96,26 +96,30 @@ char *av[];
  13. /*
  14. Process command line options.
  15. */
  16. - for (ax=1; ax<ac; ax++) {
  17. - arg = av[ax];
  18. + for (ax=1; ax<ac; ) {
  19. + arg = av[ax++];
  20. +
  21. + if (ax >= ac)
  22. + Usage();
  23. +
  24. if (strcmp(arg, "-display") == 0) {
  25. - display_name = av[++ax];
  26. + display_name = av[ax++];
  27. }
  28. else if (strcmp(arg, "-rc") == 0) {
  29. - roachColor = av[++ax];
  30. + roachColor = av[ax++];
  31. }
  32. else if (strcmp(arg, "-speed") == 0) {
  33. - roachSpeed = atof(av[++ax]);
  34. + roachSpeed = atof(av[ax++]);
  35. }
  36. else if (strcmp(arg, "-roaches") == 0) {
  37. - maxRoaches = strtol(av[++ax], (char **)NULL, 0);
  38. + maxRoaches = strtol(av[ax++], (char **)NULL, 0);
  39. }
  40. else {
  41. Usage();
  42. }
  43. }
  44. - srand((int)time((long *)NULL));
  45. + srand((int)time(NULL));
  46. /*
  47. Catch some signals so we can erase any visible roaches.
  48. @@ -212,6 +216,7 @@ char *av[];
  49. CoverRoot();
  50. XCloseDisplay(display);
  51. + return (0);
  52. }
  53. #define USEPRT(msg) fprintf(stderr, msg)