X int cnt = W(esc_cnt); /* # of leading ESC #'s */
X int count; /* whatever */
X char font_buff[MAX_PATH]; /* space to store a path name */
X char coords[1024]; /* space for return value */
X register WINDOW *win2; /* generic window pntr */
X struct font *Get_font();
X
X if (cnt == 1) { /* info about spot */
X for(win2=active;win2!=(WINDOW *) 0;win2=win2->next)
X if (mousein(W(esc)[0],W(esc)[1],win2,1))
X break;
X if (win2 != (WINDOW *) 0)
X sprintf(coords,"%s %s %d %d\n",
X win->tty+strlen(win->tty)-2,
X win2->tty+strlen(win2->tty)-2,win2->num,win2->pid);
X else
X sprintf(coords,"\n");
X Write(W(to_fd),coords,strlen(coords));
X return;
X }
X
X#ifdef DEBUG
X dprintf(i)(stderr,"%s: getting info %d\r\n",W(tty),*W(esc));
X#endif
X switch (W(esc)[0]) {
X case G_TERMCAP: /* send termcap entry back to shell */
X {
X int lines = T_HIGH/FSIZE(high);
X int cols = T_WIDE/FSIZE(wide);
X sprintf(coords,"%s:am:li#%d:co#%d:bs:cl=^L:ce=\\E%c:cd=\\E%c:cm=\\E%%r%%d%c%%d%c:al=\\E%c:dl=\\E%c:ic=\\E%c:dc=\\E%c:im=:ta=^I:up=\\E%c:do=\\E%c:nd=\\E%c:ku=\\E[A:kd=\\E[B:kr=\\E[C:kl=\\E[D:so=\\E%c:se=\\E%c:vs=\\E%c:ve=\\E%c:\n",
X C_NAME,lines,cols,E_CLEAREOL,E_CLEAREOS,
X E_SEP1,E_CUP,E_ADDLINE,E_DELETELINE,E_ADDCHAR,E_DELETECHAR,
X E_UPLINE,E_DOWN,E_RIGHT,E_STANDOUT,E_STANDEND,
X E_VI,E_NOVI);
X }
X break;
X case G_WINSIZE: /* cols, lines */
X sprintf(coords,"%d %d\n", T_WIDE/FSIZE(wide),
X T_HIGH/FSIZE(high));
X break;
X case G_FONT: /* font wide, high, # */
X {
X register int id = W(font)->ident;
X sprintf(coords,"%d %d %d %s\n", FSIZE(wide),
X FSIZE(high),id,id>0?fontlist[id-1]:
X "default.fnt");
X }
X break;
X case G_CURSOR: /* x,y gx,gy cursor_type */
X sprintf(coords,"%d %d %d %d %d\n",
X W(x)/FSIZE(wide),
X W(y)/FSIZE(high)-1,
X W(gx), W(gy),
X W(curs_type));
X break;
X case G_TEXT: /* text region size: x,y,wide,high */
X sprintf(coords,"%d %d %d %d\n",
X W(text.x),W(text.y),W(text.wide),W(text.high));
X break;
X case G_MOUSE: /* mouse coordinates */
X sprintf(coords,"%d %d %d\n", mousex, mousey, RPT_BUTTON());
X break;
X case G_MOUSE2: /* massaged coordinates */
X if (W(flags)&W_ABSCOORDS)
X sprintf(coords, "%d %d %d\n", mousex-W(x0), mousey-W(y0),
X RPT_BUTTON());
X else
X sprintf(coords,"%d %d %d\n",
X (mousex-W(x0))*GMAX/BIT_WIDE(W(window)),
X (mousey-W(y0))*GMAX/BIT_HIGH(W(window)),
X RPT_BUTTON());
X break;
X case G_COORDS: /* window coords */
X sprintf(coords,"%d %d %d %d\n",W(x0),W(y0),
X WIDE,HIGH);
X break;
X case G_STATUS: /* window status */
X sprintf(coords,"%c\n",W(flags)&W_ACTIVE
X ? C_EXPOSED: C_OBSCURED);
X if (win == active)
X *coords = C_ACTIVE;
X break;
X case G_ALLMINE: /* window status for client windows */
X case G_ALL: /* complete window status */
X {
X register char status;
X *coords = '\0';
X for(win2=active;win2!=(WINDOW *) 0;win2=win2->next) {
X if (*W(esc)==G_ALLMINE && win2->main != W(main))
X continue;
X status = win2->flags&W_ACTIVE ? C_EXPOSED:C_OBSCURED;
X if (win2 == win)
X status += ('A'-'a');
X sprintf(coords+strlen(coords),"%d %d %d %d %s %d %c %d\n",
X win2->x0,
X win2->y0,
X win2->BIT_WIDE(border),
X win2->BIT_HIGH(border),
X win2->tty+strlen(win2->tty)-2,
X win2->num,
X status,
X win2->setid);
X Write(W(to_fd),coords,strlen(coords));
X *coords = '\0';
X }
X sprintf(coords+strlen(coords),"\n");
X }
X break;
X case G_NOTIFY: /* list windows with notify set */
X {
X register char *str;
X *coords = '\0';
X for(win2=active;win2!=(WINDOW *) 0;win2=win2->next) {
X#ifdef DEBUG
X dprintf(i)(stderr," checking %s\r\n",win2->tty);
X#endif
X if (IS_EVENT(win2,EVENT_NOTIFY) &&
X (str = win2->events[GET_EVENT(EVENT_NOTIFY)])) {
X sprintf(coords+strlen(coords),"%d.%d %d %s\n",
X win2->pid,win2->num,strlen(str),str);
X Write(W(to_fd),coords,strlen(coords));
X *coords = '\0';
X#ifdef DEBUG
X dprintf(i)(stderr," got %s\r\n",str);
X#endif
X }
X }
X sprintf(coords+strlen(coords),"\n");
X }
X break;
X case G_SYSTEM: /* system status */
X gethostname(coords,sizeof(coords));
X sprintf(coords+strlen(coords)," %d %d %d %d %d\n",
X BIT_WIDE(screen),
X BIT_HIGH(screen),
X SUM_BDR,
X DEPTH,
X BITS+1);
X break;
X case G_ID: /* client window id */
X for(count=0,win2=W(main);win2;win2=win2->alt)
X count++;
X sprintf(coords,"%d %d\n",W(num),count);
X break;
X case G_FLAGS: /* window flags */
X sprintf(coords,"%0x\n",W(flags));
X break;
X#ifdef OBSOLETE
X case G_ALLFONT: /* font information */
X {
X register struct font *temp;
X register int i;
X
X sprintf(coords,"%d %d",font->head.wide,
X font->head.high);
X for(i=0;i<MAXFONT;i++) {
X temp=Get_font(i);
X sprintf(coords+strlen(coords), " %d %d",
X temp->head.wide,
X temp->head.high);
X }
X strcat(coords,"\n");
X }
X break;
X#endif
X }
X if (strlen(coords))
X Write(W(to_fd),coords,strlen(coords));
X#ifdef DEBUG
X dprintf(i)(stderr," sending (%d) [%s]\r\n",
X strlen(coords),coords);
X#endif
X }
END_OF_FILE
# end of 'src/get_info.c'
fi
echo shar: End of archive 25 \(of 61\).
cp /dev/null ark25isdone
MISSING=""
for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 \