/**
* TTYSessionInfo queries environment variables and the tty window size for
- * the session information. The username is taken from
- * getpwuid(geteuid()).pw_name, language is taken from LANG, and text window
- * size from ioctl(TIOCGWINSIZ).
+ * the session information. The username is taken from user.name, language
+ * is taken from user.language, and text window size from 'stty size'.
*/
public final class TTYSessionInfo implements SessionInfo {
String line = in.readLine();
if ((line != null) && (line.length() > 0)) {
StringTokenizer tokenizer = new StringTokenizer(line);
- windowHeight = Integer.parseInt(tokenizer.nextToken());
- windowWidth = Integer.parseInt(tokenizer.nextToken());
+ int rc = Integer.parseInt(tokenizer.nextToken());
+ if (rc > 0) {
+ windowHeight = rc;
+ }
+ rc = Integer.parseInt(tokenizer.nextToken());
+ if (rc > 0) {
+ windowWidth = rc;
+ }
}
while (true) {
BufferedReader err = new BufferedReader(