microcom-102-002-rename-variable-log.patch 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. diff -rdup microcom-1.02.speed/help.c microcom-1.02/help.c
  2. --- microcom-1.02.speed/help.c 2007-01-19 19:44:19.000000000 +0100
  3. +++ microcom-1.02/help.c 2007-01-19 19:48:20.000000000 +0100
  4. @@ -23,7 +23,7 @@ extern int crnl_mapping; //0 - no mappin
  5. extern int script; /* script active flag */
  6. extern char scr_name[MAX_SCRIPT_NAME]; /* default name of the script */
  7. extern char device[MAX_DEVICE_NAME]; /* serial device name */
  8. -extern int log; /* log active flag */
  9. +extern int log_active; /* log active flag */
  10. extern FILE* flog; /* log file */
  11. static int help_state = 0;
  12. @@ -85,7 +85,7 @@ static void help_escape(void) {
  13. write(STDOUT_FILENO, str1, strlen(str1));
  14. - if (log == 0)
  15. + if (log_active == 0)
  16. write(STDOUT_FILENO, " l - log on \n", 26);
  17. else
  18. write(STDOUT_FILENO, " l - log off \n", 26);
  19. @@ -156,11 +156,11 @@ static void help_send_escape(int fd, cha
  20. case 'q': /* quit help */
  21. break;
  22. case 'l': /* log on/off */
  23. - log = (log == 0)? 1: 0;
  24. - if (log) { /* open log file */
  25. + log_active = (log_active == 0)? 1: 0;
  26. + if (log_active) { /* open log file */
  27. if ((flog = fopen("microcom.log", "a")) == (FILE *)0) {
  28. write(STDOUT_FILENO, "Cannot open microcom.log \n", 26);
  29. - log = 0;
  30. + log_active = 0;
  31. }
  32. }
  33. else { /* cloase log file */
  34. diff -rdup microcom-1.02.speed/microcom.c microcom-1.02/microcom.c
  35. --- microcom-1.02.speed/microcom.c 2000-08-27 17:22:47.000000000 +0200
  36. +++ microcom-1.02/microcom.c 2007-01-19 19:48:37.000000000 +0100
  37. @@ -25,7 +25,7 @@ int crnl_mapping; //0 - no mapping, 1 ma
  38. int script = 0; /* script active flag */
  39. char scr_name[MAX_SCRIPT_NAME] = "script.scr"; /* default name of the script */
  40. char device[MAX_DEVICE_NAME]; /* serial device name */
  41. -int log = 0; /* log active flag */
  42. +int log_active = 0; /* log active flag */
  43. FILE* flog; /* log file */
  44. int pf = 0; /* port file descriptor */
  45. struct termios pots; /* old port termios settings to restore */
  46. @@ -106,7 +106,7 @@ void main_usage(int exitcode, char *str,
  47. /* restore original terminal settings on exit */
  48. void cleanup_termios(int signal) {
  49. /* cloase the log file first */
  50. - if (log) {
  51. + if (log_active) {
  52. fflush(flog);
  53. fclose(flog);
  54. }
  55. diff -rdup microcom-1.02.speed/mux.c microcom-1.02/mux.c
  56. --- microcom-1.02.speed/mux.c 2000-07-30 06:15:47.000000000 +0200
  57. +++ microcom-1.02/mux.c 2007-01-19 19:48:48.000000000 +0100
  58. @@ -24,7 +24,7 @@
  59. extern int script;
  60. extern char scr_name[];
  61. -extern int log;
  62. +extern int log_active;
  63. extern FILE* flog;
  64. void mux_clear_sflag(void) {
  65. @@ -71,7 +71,7 @@ void mux_loop(int pf) {
  66. i = read(pf, buf, BUFSIZE);
  67. if (i > 0) {
  68. write(STDOUT_FILENO, buf, i);
  69. - if (log)
  70. + if (log_active)
  71. fwrite(buf, 1, i, flog);
  72. if (script) {
  73. i = script_process(S_DCE, buf, i);