1.4.4 (????/??/??)
* Show total number of games in progress below the list, useful if
there are more than fits on the screen.
+ * Use client-supplied window size again; try to detect broken
+ clients and force them to 80x24.
+ * Pass window size to watchers via inprogress file; show it on the
+ list.
1.4.3 (2004/02/28)
* Make ttyplay use the 'strip' value it remembered from last view.
char*
gen_inprogress_lock (pid_t pid, char* ttyrec_filename)
{
- char *lockfile = NULL, pidbuf[16];
+ char *lockfile = NULL, filebuf[80];
int fd;
size_t len;
struct flock fl = { 0 };
- snprintf (pidbuf, 16, "%d", pid);
+ snprintf (filebuf, sizeof(filebuf), "%d\n%d\n%d\n",
+ pid, win.ws_row, win.ws_col);
fl.l_type = F_WRLCK;
fl.l_whence = SEEK_SET;
if (fcntl (fd, F_SETLKW, &fl) == -1)
graceful_exit (68);
- write (fd, pidbuf, strlen (pidbuf));
+ write (fd, filebuf, strlen (filebuf));
return lockfile;
}
if (i + offset >= len)
break;
- mvprintw (7 + i, 1, "%c) %-15s %s %s (%ldm %lds idle)",
+ mvprintw (7 + i, 1, "%c) %-15s (%3dx%3d) %s %s (%ldm %lds idle)",
i + 97, games[i + offset]->name,
+ games[i + offset]->ws_col, games[i + offset]->ws_row,
games[i + offset]->date, games[i + offset]->time,
(time (&ctime) - games[i + offset]->idle_time) / 60,
(time (&ctime) - games[i + offset]->idle_time) % 60);
struct dg_game **
populate_games (int *l)
{
- int fd, len;
+ int fd, len, n;
DIR *pdir;
struct dirent *pdirent;
struct stat pstat;
- char fullname[130], ttyrecname[130];
- char *replacestr, *dir;
+ char fullname[130], ttyrecname[130], pidws[80];
+ char *replacestr, *dir, *p;
struct dg_game **games = NULL;
struct flock fl = { 0 };
size_t slen;
games[len]->idle_time = pstat.st_mtime;
+ n = read(fd, pidws, sizeof(pidws) - 1);
+ if (n > 0)
+ {
+ pidws[n] = '\0';
+ p = pidws;
+ }
+ else
+ p = "";
+ while (*p != '\0' && *p != '\n')
+ p++;
+ if (*p != '\0')
+ p++;
+ games[len]->ws_row = atoi(p);
+ while (*p != '\0' && *p != '\n')
+ p++;
+ if (*p != '\0')
+ p++;
+ games[len]->ws_col = atoi(p);
+ if (games[len]->ws_row < 4 || games[len]->ws_col < 4)
+ {
+ games[len]->ws_row = 24;
+ games[len]->ws_col = 80;
+ }
+
len++;
}
}