gdbcont.c 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. /*
  2. * (C) Copyright 2000
  3. * Murray Jensen <Murray.Jensen@csiro.au>
  4. *
  5. * See file CREDITS for list of people who contributed to this
  6. * project.
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License as
  10. * published by the Free Software Foundation; either version 2 of
  11. * the License, or (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  21. * MA 02111-1307 USA
  22. */
  23. #include <stdio.h>
  24. #include <stdlib.h>
  25. #include <string.h>
  26. #include <unistd.h>
  27. #include "serial.h"
  28. #include "error.h"
  29. #include "remote.h"
  30. char *serialdev = "/dev/term/b";
  31. speed_t speed = B230400;
  32. int verbose = 0;
  33. int
  34. main(int ac, char **av)
  35. {
  36. int c, sfd;
  37. if ((pname = strrchr(av[0], '/')) == NULL)
  38. pname = av[0];
  39. else
  40. pname++;
  41. while ((c = getopt(ac, av, "b:p:v")) != EOF)
  42. switch (c) {
  43. case 'b':
  44. if ((speed = cvtspeed(optarg)) == B0)
  45. Error("can't decode baud rate specified in -b option");
  46. break;
  47. case 'p':
  48. serialdev = optarg;
  49. break;
  50. case 'v':
  51. verbose = 1;
  52. break;
  53. default:
  54. usage:
  55. fprintf(stderr, "Usage: %s [-b bps] [-p dev] [-v]\n", pname);
  56. exit(1);
  57. }
  58. if (optind != ac)
  59. goto usage;
  60. if (verbose)
  61. fprintf(stderr, "Opening serial port and sending continue...\n");
  62. if ((sfd = serialopen(serialdev, speed)) < 0)
  63. Perror("open of serial device '%s' failed", serialdev);
  64. remote_desc = sfd;
  65. remote_reset();
  66. remote_continue();
  67. if (serialclose(sfd) < 0)
  68. Perror("close of serial device '%s' failed", serialdev);
  69. if (verbose)
  70. fprintf(stderr, "Done.\n");
  71. return (0);
  72. }