src/protocols/zephyr/ZLocations.c

changeset 10897
98867eee9779
parent 10867
b39f9b646d6c
child 11105
842fa517e08c
equal deleted inserted replaced
10896:b773b241e233 10897:98867eee9779
95 host[sizeof(host) - 1] = '\0'; 95 host[sizeof(host) - 1] = '\0';
96 } 96 }
97 #ifndef X_DISPLAY_MISSING 97 #ifndef X_DISPLAY_MISSING
98 if ((display = getenv("DISPLAY")) && *display) { 98 if ((display = getenv("DISPLAY")) && *display) {
99 (void) strncpy(mytty, display, sizeof(mytty)); 99 (void) strncpy(mytty, display, sizeof(mytty));
100 mytty[sizeof(mytty)-1] = '\0';
101 } else { 100 } else {
102 #endif 101 #endif
103 #ifdef WIN32 102 #ifdef WIN32
104 strcpy(mytty,"WinGaim"); 103 strncpy(mytty, "WinGaim", sizeof(mytty));
105 #else 104 #else
106 ttyp = ttyname(0); 105 ttyp = ttyname(0);
107 if (ttyp && *ttyp) { 106 if (ttyp && *ttyp) {
108 p = strchr(ttyp + 1, '/'); 107 p = strchr(ttyp + 1, '/');
109 strcpy(mytty, (p) ? p + 1 : ttyp); 108 strcpy(mytty, (p) ? p + 1 : ttyp);
110 } else { 109 } else {
111 strcpy(mytty, "unknown"); 110 strncpy(mytty, "unknown", sizeof(mytty));
112 } 111 }
113 #endif 112 #endif
113 mytty[sizeof(mytty)-1] = '\0';
114 #ifndef X_DISPLAY_MISSING 114 #ifndef X_DISPLAY_MISSING
115 } 115 }
116 #endif 116 #endif
117 reenter = 1; 117 reenter = 1;
118 } 118 }

mercurial