# include "Ximage.h"
# define SCAN \
  status = read (sock, buffer, 16); \
  buffer[16] = 0; \
  sscanf (buffer, "%*s %d", &Nbytes); \
  status = read (sock, buffer, Nbytes); \
  buffer[status] = 0; /* make the string easy to parse */ \
  (DEBUG) && fprintf (stderr, "buffer: <%s>\n", buffer); \


int Resize () {
 
  int i, status, Nbytes;
  unsigned int NX, NY;
  char buffer[128];

  SCAN;
  sscanf (buffer, "%d %d", &NX, &NY);

  if ((graphic.dx == NX) && (graphic.dy == NY)) 
    return (TRUE);

  graphic.dx = MAX(NX, 50); 
  graphic.dy = MAX(NY, 50); 

  XResizeWindow (graphic.display, graphic.window, NX, NY);

  for (i = 0; i < Nsection; i++) {
    PositionPicture (&section[i]);
  }

  XClearWindow (graphic.display, graphic.window);
  Refresh (1);

  return (TRUE);
}
