view lib-src/test-distrib.c @ 1989:b1c1ab20f810

Use the term `scroll bar', instead of `scrollbar'. * alloc.c, frame.c, frame.h, indent.c, keyboard.c, keyboard.h, lisp.h, term.c, termhooks.h, window.c, window.h, xdisp.c, xfns.c, xterm.c, xterm.h: Terminology changed. Don't generate switch-frame events by checking Vlast_event_frame; use a separate variable for that bookkeeping. In order to generate them properly, we may need to fiddle with it. * keyboard.c (internal_last_event_frame): New variable. (command_loop_1): Check internal_last_event_frame, not Vlast_event_frame. (read_char, kbd_buffer_store_event): Set both Vlast_event_frame and internal_last_event_frame. (kbd_buffer_get_event): Check internal_last_event_frame to decide whether to generate a switch-frame event. Set Vlast_event_frame after each event. (init_keyboard): Initialize both Vlast_event_frame and internal_last_event_frame. * keyboard.h (internal_last_event_frame): Add extern declaration for this. * frame.c (Vlast_event_frame): Remove external declaration for this. (Fselect_frame): Set internal_last_event_frame to Qnil to force a switch-frame event, not Vlast_event_frame; the latter is supposed to convey information to the user.
author Jim Blandy <jimb@redhat.com>
date Tue, 02 Mar 1993 08:14:57 +0000
parents 445291a2fb96
children 0da5b58e98ed
line wrap: on
line source

#include <stdio.h>

/* Break string in two parts to avoid buggy C compilers that ignore characters
   after nulls in strings.  */

char string1[] = "Testing distribution of nonprinting chars:\n\
Should be 0177: \177 Should be 0377: \377 Should be 0212: \212.\n\
Should be 0000: ";

char string2[] = ".\n\
This file is read by the `test-distribution' program.\n\
If you change it, you will make that program fail.\n";

char buf[300];
  
/* Like `read' but keeps trying until it gets SIZE bytes or reaches eof.  */
int
cool_read (fd, buf, size)
     int fd;
     char *buf;
     int size;
{
  int num, sofar = 0;

  while (1)
    {
      if ((num = read (fd, buf + sofar, size - sofar)) == 0)
	return sofar;
      else if (num < 0)
	return num;
      sofar += num;
    }
}

main ()
{
  int fd = open ("testfile", 0);

  if (fd < 0)
    {
      perror ("opening `testfile'");
      exit (2);
    }
  if (cool_read (fd, buf, sizeof string1) != sizeof string1 ||
      strcmp (buf, string1) ||
      cool_read (fd, buf, sizeof string2) != sizeof string2 - 1 ||
      strncmp (buf, string2, sizeof string2 - 1))
    {
      fprintf (stderr, "Data in file `testfile' has been damaged.\n\
Most likely this means that many nonprinting characters\n\
have been corrupted in the files of Emacs, and it will not work.\n");
      exit (2);
    }
  close (fd);
#ifdef VMS
  exit (1);			/* On VMS, success is 1.  */
#else
  exit (0);
#endif
}