ttynaming.c 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. /*+-------------------------------------------------------------------------
  2. ttynaming.c - direct/modem tty name management
  3. wht@wht.net
  4. Defined functions:
  5. direct_tty(tty)
  6. modem_tty(tty)
  7. For now, meaningful only on SCO. In the future, perhaps, we'll
  8. manage an installation-dependent table of what line names refer
  9. to the same device and which are modem, direct, etc.
  10. These modules mean even less with the advent of ODT3 and 32v5
  11. --------------------------------------------------------------------------*/
  12. /*+:EDITS:*/
  13. /*:04-26-2000-11:16-wht@bob-RELEASE 4.42 */
  14. /*:01-24-1997-02:38-wht@yuriatin-SOURCE RELEASE 4.00 */
  15. /*:09-11-1996-20:01-wht@yuriatin-3.48-major telnet,curses,structural overhaul */
  16. /*:08-20-1996-12:39-wht@kepler-locale/ctype fixes from ache@nagual.ru */
  17. /*:11-23-1995-11:20-wht@kepler-source control 3.37 for tsx-11 */
  18. /*:11-14-1995-10:23-wht@kepler-3.37.80-source control point: SOCKETS */
  19. /*:06-13-1995-20:40-wht@n4hgf-was returning address of auto stack temp! */
  20. /*:05-04-1994-04:40-wht@n4hgf-ECU release 3.30 */
  21. /*:09-10-1992-14:00-wht@n4hgf-ECU release 3.20 */
  22. /*:08-22-1992-15:39-wht@n4hgf-ECU release 3.20 BETA */
  23. /*:08-21-1992-13:39-wht@n4hgf-rewire direct/modem device use */
  24. /*:08-21-1992-04:47-wht@n4hgf-creation */
  25. #include "ecu.h"
  26. /*+-------------------------------------------------------------------------
  27. direct_tty(tty) - make non-modem line out of SCO ttyname
  28. --------------------------------------------------------------------------*/
  29. #ifdef NEED_TTY_NAME_CONVERSION
  30. char *
  31. direct_tty(tty)
  32. char *tty;
  33. {
  34. static char stat_tty[64];
  35. int itmp;
  36. strncpy(stat_tty, tty, sizeof(stat_tty));
  37. stat_tty[sizeof(stat_tty) - 1] = 0;
  38. if ((itmp = strlen(stat_tty)) > 2)
  39. {
  40. itmp--;
  41. if (
  42. #if 0
  43. isdigit((uchar) stat_tty[itmp - 1]) &&
  44. #endif
  45. isupper((uchar) stat_tty[itmp])
  46. )
  47. {
  48. stat_tty[itmp] = tolower((uchar) stat_tty[itmp]);
  49. }
  50. }
  51. return (stat_tty);
  52. } /* end of direct_tty */
  53. #endif /* NEED_TTY_NAME_CONVERSION */
  54. /*+-------------------------------------------------------------------------
  55. modem_tty(tty) - make modem line out of SCO ttyname
  56. --------------------------------------------------------------------------*/
  57. #ifdef NEED_TTY_NAME_CONVERSION
  58. char *
  59. modem_tty(tty)
  60. char *tty;
  61. {
  62. static char stat_tty[64];
  63. int itmp;
  64. strncpy(stat_tty, tty, sizeof(stat_tty));
  65. stat_tty[sizeof(stat_tty) - 1] = 0;
  66. if ((itmp = strlen(stat_tty)) > 2)
  67. {
  68. itmp--;
  69. if (
  70. #if 0
  71. isdigit((uchar) stat_tty[itmp - 1]) &&
  72. #endif
  73. islower((uchar) stat_tty[itmp])
  74. )
  75. {
  76. stat_tty[itmp] = toupper((uchar) stat_tty[itmp]);
  77. }
  78. }
  79. return (stat_tty);
  80. } /* end of modem_tty */
  81. #endif /* NEED_TTY_NAME_CONVERSION */
  82. /* vi: set tabstop=4 shiftwidth=4: */
  83. /* end of ttynaming.c */