#include <errno.h>
#include <stdint.h>
-#include <stdio.h>
#include <stdlib.h>
#include <limits.h> /* For CHAR_BIT. */
#include <signal.h> /* For SIGABRT, SIGDANGER. */
#include "ptr-bounds.h"
#include "puresize.h"
#include "sheap.h"
+#include "sysstdio.h"
#include "systime.h"
#include "character.h"
#include "buffer.h"
taking place, or the setjmp just didn't save the register. */
if (x == 1)
- fprintf (stderr, SETJMP_WILL_LIKELY_WORK);
+ fputs (SETJMP_WILL_LIKELY_WORK, stderr);
else
{
- fprintf (stderr, SETJMP_WILL_NOT_WORK);
+ fputs (SETJMP_WILL_NOT_WORK, stderr);
exit (1);
}
}
necessary. */
#include <config.h>
-#include <stdio.h>
#include "lisp.h"
#include "character.h"
#include "buffer.h"
#include "dispextern.h"
#include "region-cache.h"
+#include "sysstdio.h"
static bool bidi_initialized = 0;
if (bidi_cache_idx == 0)
{
- fprintf (stderr, "The cache is empty.\n");
+ fputs ("The cache is empty.\n", stderr);
return;
}
fprintf (stderr, "Total of %"pD"d state%s in cache:\n",
fputs ("ch ", stderr);
for (i = 0; i < bidi_cache_idx; i++)
fprintf (stderr, "%*c", ndigits, bidi_cache[i].ch);
- fputs ("\n", stderr);
- fputs ("lvl ", stderr);
+ fputs ("\nlvl ", stderr);
for (i = 0; i < bidi_cache_idx; i++)
fprintf (stderr, "%*d", ndigits, bidi_cache[i].resolved_level);
- fputs ("\n", stderr);
- fputs ("pos ", stderr);
+ fputs ("\npos ", stderr);
for (i = 0; i < bidi_cache_idx; i++)
fprintf (stderr, "%*"pD"d", ndigits, bidi_cache[i].charpos);
- fputs ("\n", stderr);
+ putc ('\n', stderr);
}
static unsigned
read_hex (FILE *fp, int lookahead, int *terminator, bool *overflow)
{
- int c = lookahead < 0 ? getc_unlocked (fp) : lookahead;
+ int c = lookahead < 0 ? getc (fp) : lookahead;
while (true)
{
if (c == '#')
do
- c = getc_unlocked (fp);
+ c = getc (fp);
while (0 <= c && c != '\n');
else if (c == '0')
{
- c = getc_unlocked (fp);
+ c = getc (fp);
if (c < 0 || c == 'x')
break;
}
if (c < 0)
break;
- c = getc_unlocked (fp);
+ c = getc (fp);
}
unsigned n = 0;
if (0 <= c)
while (true)
{
- c = getc_unlocked (fp);
+ c = getc (fp);
int digit = char_hexdigit (c);
if (digit < 0)
break;
cmputc (int c)
{
if (current_tty->termscript)
- putc_unlocked (c & 0177, current_tty->termscript);
- putc_unlocked (c & 0177, current_tty->output);
+ putc (c & 0177, current_tty->termscript);
+ putc (c & 0177, current_tty->output);
return c;
}
if (!MagicWrap (tty) || curY (tty) >= FrameRows (tty) - 1)
emacs_abort ();
if (tty->termscript)
- putc_unlocked ('\r', tty->termscript);
- putc_unlocked ('\r', tty->output);
+ putc ('\r', tty->termscript);
+ putc ('\r', tty->output);
if (tty->termscript)
- putc_unlocked ('\n', tty->termscript);
- putc_unlocked ('\n', tty->output);
+ putc ('\n', tty->termscript);
+ putc ('\n', tty->output);
curX (tty) = 0;
curY (tty)++;
}
p = tty->Wcm->cm_down, c = tty->Wcm->cc_down;
if (c == BIG) { /* caint get thar from here */
if (doit)
- printf ("OOPS");
+ fputs ("OOPS", stdout);
return c;
}
totalcost = c * deltay;
if (c == BIG) { /* caint get thar from here */
fail:
if (doit)
- printf ("OOPS");
+ fputs ("OOPS", stdout);
return BIG;
}
totalcost += c * deltax;
if (FRAME_TERMCAP_P (f) || FRAME_MSDOS_P (f))
{
if (FRAME_TTY (f)->termscript)
- fflush_unlocked (FRAME_TTY (f)->termscript);
+ fflush (FRAME_TTY (f)->termscript);
if (FRAME_TERMCAP_P (f))
- fflush_unlocked (FRAME_TTY (f)->output);
+ fflush (FRAME_TTY (f)->output);
}
/* Check window matrices for lost pointers. */
update_end (f);
if (FRAME_TTY (f)->termscript)
- fflush_unlocked (FRAME_TTY (f)->termscript);
- fflush_unlocked (FRAME_TTY (f)->output);
+ fflush (FRAME_TTY (f)->termscript);
+ fflush (FRAME_TTY (f)->output);
/* Check window matrices for lost pointers. */
#if GLYPH_DEBUG
#if 0
ptrdiff_t outq = __fpending (display_output);
if (outq > 900
|| (outq > 20 && ((i - 1) % preempt_count == 0)))
- fflush_unlocked (display_output);
+ fflush (display_output);
}
}
if (tty->termscript)
{
- fwrite_unlocked (SDATA (string), 1, SBYTES (string), tty->termscript);
- fflush_unlocked (tty->termscript);
+ fwrite (SDATA (string), 1, SBYTES (string), tty->termscript);
+ fflush (tty->termscript);
}
out = tty->output;
}
- fwrite_unlocked (SDATA (string), 1, SBYTES (string), out);
- fflush_unlocked (out);
+ fwrite (SDATA (string), 1, SBYTES (string), out);
+ fflush (out);
unblock_input ();
return Qnil;
}
if (!NILP (arg))
{
if (noninteractive)
- putchar_unlocked (07);
+ putchar (07);
else
ring_bell (XFRAME (selected_frame));
}
bitch_at_user (void)
{
if (noninteractive)
- putchar_unlocked (07);
+ putchar (07);
else if (!INTERACTIVE) /* Stop executing a keyboard macro. */
{
const char *msg
#endif
if (!terminal_type)
{
+ char const *msg
+ = "Please set the environment variable TERM; see 'tset'.\n";
#ifdef HAVE_WINDOW_SYSTEM
if (! inhibit_window_system)
- fprintf (stderr, "Please set the environment variable DISPLAY or TERM (see 'tset').\n");
- else
+ msg = ("Please set the environment variable DISPLAY or TERM; "
+ "see 'tset'.\n");
#endif /* HAVE_WINDOW_SYSTEM */
- fprintf (stderr, "Please set the environment variable TERM; see 'tset'.\n");
+ fputs (msg, stderr);
exit (1);
}
#include <stdarg.h>
#include <stddef.h>
#include <stdint.h>
-#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include "coding.h"
#include "keyboard.h"
#include "syssignal.h"
+#include "sysstdio.h"
#include "thread.h"
#include <intprops.h>
va_start (args, format);
vfprintf (stderr, format, args);
va_end (args);
- fputc ('\n', stderr);
+ putc ('\n', stderr);
fflush (NULL);
emacs_abort ();
}
tem2 = Fsymbol_value (intern_c_string ("emacs-copyright"));
if (!STRINGP (tem))
{
- fprintf (stderr, "Invalid value of 'emacs-version'\n");
+ fputs ("Invalid value of 'emacs-version'\n", stderr);
exit (1);
}
if (!STRINGP (tem2))
{
- fprintf (stderr, "Invalid value of 'emacs-copyright'\n");
+ fputs ("Invalid value of 'emacs-copyright'\n", stderr);
exit (1);
}
else
version = emacs_version;
copyright = emacs_copyright;
}
- printf ("%s %s\n", PACKAGE_NAME, version);
- printf ("%s\n", copyright);
- printf ("%s comes with ABSOLUTELY NO WARRANTY.\n", PACKAGE_NAME);
- printf ("You may redistribute copies of %s\n", PACKAGE_NAME);
- printf ("under the terms of the GNU General Public License.\n");
- printf ("For more information about these matters, ");
- printf ("see the file named COPYING.\n");
+ printf (("%s %s\n"
+ "%s\n"
+ "%s comes with ABSOLUTELY NO WARRANTY.\n"
+ "You may redistribute copies of %s\n"
+ "under the terms of the GNU General Public License.\n"
+ "For more information about these matters, "
+ "see the file named COPYING.\n"),
+ PACKAGE_NAME, version, copyright, PACKAGE_NAME, PACKAGE_NAME);
exit (0);
}
}
#endif /* HAVE_SETRLIMIT and RLIMIT_STACK and not CYGWIN */
- clearerr_unlocked (stdin);
+ clearerr (stdin);
emacs_backtrace (-1);
int i;
printf ("Usage: %s [OPTION-OR-FILENAME]...\n", argv[0]);
for (i = 0; i < ARRAYELTS (usage_message); i++)
- fputs_unlocked (usage_message[i], stdout);
+ fputs (usage_message[i], stdout);
exit (0);
}
before exiting. */
if (emacs_pipe (daemon_pipe) != 0)
{
- fprintf (stderr, "Cannot pipe!\n");
+ fputs ("Cannot pipe!\n", stderr);
exit (1);
}
} /* daemon_type == 2 */
int systemd_socket = sd_listen_fds (1);
if (systemd_socket > 1)
- fprintf (stderr,
- ("\n"
- "Warning: systemd passed more than one socket to Emacs.\n"
- "Try 'Accept=false' in the Emacs socket unit file.\n"));
+ fputs (("\n"
+ "Warning: systemd passed more than one socket to Emacs.\n"
+ "Try 'Accept=false' in the Emacs socket unit file.\n"),
+ stderr);
else if (systemd_socket == 1
&& (0 < sd_is_socket (SD_LISTEN_FDS_START,
AF_UNSPEC, SOCK_STREAM, 1)))
#endif /* HAVE_LIBSYSTEMD */
#ifdef USE_GTK
- fprintf (stderr, "\nWarning: due to a long standing Gtk+ bug\nhttps://gitlab.gnome.org/GNOME/gtk/issues/221\n\
+ fputs ("\nWarning: due to a long standing Gtk+ bug\nhttps://gitlab.gnome.org/GNOME/gtk/issues/221\n\
Emacs might crash when run in daemon mode and the X11 connection is unexpectedly lost.\n\
-Using an Emacs configured with --with-x-toolkit=lucid does not have this problem.\n");
+Using an Emacs configured with --with-x-toolkit=lucid does not have this problem.\n",
+ stderr);
#endif /* USE_GTK */
if (daemon_type == 2)
if (retval < 0)
{
- fprintf (stderr, "Error reading status from child\n");
+ fputs ("Error reading status from child\n", stderr);
exit (1);
}
else if (retval == 0)
{
- fprintf (stderr, "Error: server did not start correctly\n");
+ fputs ("Error: server did not start correctly\n", stderr);
exit (1);
}
if (! (0 <= fdStrlen && fdStrlen < sizeof fdStr))
{
- fprintf (stderr, "daemon: child name too long\n");
+ fputs ("daemon: child name too long\n", stderr);
exit (EXIT_CANNOT_INVOKE);
}
/* In exec'd: parse special dname into pipe and name info. */
if (!dname_arg || !*dname_arg || strnlen (dname_arg, 71) == 71
|| !strchr (dname_arg, '\n'))
- {
- fprintf (stderr, "emacs daemon: daemon name absent or too long\n");
- exit (EXIT_CANNOT_INVOKE);
- }
+ {
+ fputs ("emacs daemon: daemon name absent or too long\n",
+ stderr);
+ exit (EXIT_CANNOT_INVOKE);
+ }
dname_arg2[0] = '\0';
sscanf (dname_arg, "\n%d,%d\n%s", &(daemon_pipe[0]), &(daemon_pipe[1]),
dname_arg2);
exit (1);
}
#else /* MSDOS */
- fprintf (stderr, "This platform does not support daemon mode.\n");
+ fputs ("This platform does not support daemon mode.\n", stderr);
exit (1);
#endif /* MSDOS */
if (dname_arg)
# define MAX_HEAP_BSS_DIFF (1024 * 1024)
if (heap_bss_diff > MAX_HEAP_BSS_DIFF)
- {
- fprintf (stderr, "**************************************************\n");
- fprintf (stderr, "Warning: Your system has a gap between BSS and the\n");
- fprintf (stderr, ("heap (%"PRIuMAX" bytes). "
- "This usually means that exec-shield\n"),
- heap_bss_diff);
- fprintf (stderr, "or something similar is in effect. The dump may\n");
- fprintf (stderr, "fail because of this. See the section about\n");
- fprintf (stderr, "exec-shield in etc/PROBLEMS for more information.\n");
- fprintf (stderr, "**************************************************\n");
+ fprintf (stderr,
+ ("**************************************************\n"
+ "Warning: Your system has a gap between BSS and the\n"
+ "heap (%"PRIuMAX" bytes). This usually means that exec-shield\n"
+ "or something similar is in effect. The dump may\n"
+ "fail because of this. See the section about\n"
+ "exec-shield in etc/PROBLEMS for more information.\n"
+ "**************************************************\n"),
+ heap_bss_diff);
}
# endif
}
# endif
- fflush_unlocked (stdout);
+ fflush (stdout);
/* Tell malloc where start of impure now is. */
/* Also arrange for warnings when nearly out of space. */
# if !defined SYSTEM_MALLOC && !defined HYBRID_MALLOC && !defined WINDOWSNT
{
block_input ();
if (!NILP (BVAR (b, filename)))
- fwrite_unlocked (SDATA (BVAR (b, filename)), 1,
- SBYTES (BVAR (b, filename)), stream);
- putc_unlocked ('\n', stream);
- fwrite_unlocked (SDATA (BVAR (b, auto_save_file_name)), 1,
- SBYTES (BVAR (b, auto_save_file_name)), stream);
- putc_unlocked ('\n', stream);
+ fwrite (SDATA (BVAR (b, filename)), 1,
+ SBYTES (BVAR (b, filename)), stream);
+ putc ('\n', stream);
+ fwrite (SDATA (BVAR (b, auto_save_file_name)), 1,
+ SBYTES (BVAR (b, auto_save_file_name)), stream);
+ putc ('\n', stream);
unblock_input ();
}
binmode = NILP (mode) ? O_TEXT : O_BINARY;
if (fp != stdin)
- fflush_unlocked (fp);
+ fflush (fp);
return (set_binary_mode (fileno (fp), binmode) == O_BINARY) ? Qt : Qnil;
}
This can happen if the file grows as we read it. */
ptrdiff_t buflen = st.st_size;
buf = xmalloc (buflen + 1);
- if (fread_unlocked (buf, 1, buflen + 1, fp) == buflen)
+ if (fread (buf, 1, buflen + 1, fp) == buflen)
*size = buflen;
else
{
DeleteDC (new_img_dc);
DeleteObject (img->pixmap);
if (new_pixmap == 0)
- fprintf (stderr, "Failed to convert image to color.\n");
+ fputs ("Failed to convert image to color.\n", stderr);
else
img->pixmap = new_pixmap;
}
{
FILE *fp = png_get_io_ptr (png_ptr);
- if (fread_unlocked (data, 1, length, fp) < length)
+ if (fread (data, 1, length, fp) < length)
png_error (png_ptr, "Read error");
}
}
/* Check PNG signature. */
- if (fread_unlocked (sig, 1, sizeof sig, fp) != sizeof sig
+ if (fread (sig, 1, sizeof sig, fp) != sizeof sig
|| png_sig_cmp (sig, 0, sizeof sig))
{
fclose (fp);
{
ptrdiff_t bytes;
- bytes = fread_unlocked (src->buffer, 1, JPEG_STDIO_BUFFER_SIZE,
- src->file);
+ bytes = fread (src->buffer, 1, JPEG_STDIO_BUFFER_SIZE, src->file);
if (bytes > 0)
src->mgr.bytes_in_buffer = bytes;
else
if (FIXNUMP (c))
{
if (XUFIXNUM (c) < 0x100)
- putc_unlocked (XUFIXNUM (c), dribble);
+ putc (XUFIXNUM (c), dribble);
else
fprintf (dribble, " 0x%"pI"x", XUFIXNUM (c));
}
if (SYMBOLP (dribblee))
{
- putc_unlocked ('<', dribble);
- fwrite_unlocked (SDATA (SYMBOL_NAME (dribblee)), sizeof (char),
- SBYTES (SYMBOL_NAME (dribblee)),
- dribble);
- putc_unlocked ('>', dribble);
+ putc ('<', dribble);
+ fwrite (SDATA (SYMBOL_NAME (dribblee)), sizeof (char),
+ SBYTES (SYMBOL_NAME (dribblee)), dribble);
+ putc ('>', dribble);
}
}
- fflush_unlocked (dribble);
+ fflush (dribble);
unblock_input ();
}
}
detaching from the terminal. */
|| (IS_DAEMON && DAEMON_RUNNING))
{
- int c = getchar_unlocked ();
+ int c = getchar ();
XSETINT (obj, c);
*kbp = current_kboard;
return obj;
sigemptyset (&blocked);
sigaddset (&blocked, SIGINT);
pthread_sigmask (SIG_BLOCK, &blocked, 0);
- fflush_unlocked (stdout);
+ fflush (stdout);
}
reset_all_sys_modes ();
block_input ();
/* Interrupted reads have been observed while reading over the network. */
- while ((c = getc_unlocked (instream)) == EOF && errno == EINTR
- && ferror_unlocked (instream))
+ while ((c = getc (instream)) == EOF && errno == EINTR && ferror (instream))
{
unblock_input ();
maybe_quit ();
block_input ();
- clearerr_unlocked (instream);
+ clearerr (instream);
}
unblock_input ();
= c = infile->buf[--infile->lookahead];
block_input ();
for (; i < nskip && 0 <= c; i++)
- saved_doc_string[i] = c = getc_unlocked (instream);
+ saved_doc_string[i] = c = getc (instream);
unblock_input ();
saved_doc_string_length = i;
suppress_echo_on_tty (STDIN_FILENO);
}
- fwrite_unlocked (SDATA (prompt), 1, SBYTES (prompt), stdout);
- fflush_unlocked (stdout);
+ fwrite (SDATA (prompt), 1, SBYTES (prompt), stdout);
+ fflush (stdout);
val = Qnil;
size = 100;
len = 0;
line = xmalloc (size);
- while ((c = getchar_unlocked ()) != '\n' && c != '\r')
+ while ((c = getchar ()) != '\n' && c != '\r')
{
if (c == EOF)
{
else
{
if (hide_char)
- fprintf (stdout, "%c", hide_char);
+ putchar (hide_char);
if (len == size)
line = xpalloc (line, &size, 1, -1, sizeof *line);
line[len++] = c;
/* Reset tty. */
if (hide_char)
{
- fprintf (stdout, "\n");
+ putc ('\n', stdout);
if (etty_valid)
{
emacs_set_tty (STDIN_FILENO, &etty, 0);
if (NSFONT_TRACE)
{
- fprintf (stderr, "created font_entity:\n ");
+ fputs ("created font_entity:\n ", stderr);
debug_print (font_entity);
}
{
int i;
- fprintf (stderr, "Glyph string len = %d at (%d, %d) overhang (%d, %d),"
-"overlap = %d, bg_filled = %d:",
+ fprintf (stderr, ("Glyph string len = %d at (%d, %d) overhang (%d, %d),"
+ "overlap = %d, bg_filled = %d:"),
s->nchars, s->x, s->y, s->left_overhang, s->right_overhang,
s->row->overlapping_p, s->background_filled_p);
for (i =0; i<s->nchars; i++)
- {
- int c = s->first_glyph[i].u.ch;
- fprintf (stderr, "%c", c);
- }
- fprintf (stderr, "\n");
+ putc (s->first_glyph[i].u.ch, stderr);
+ putc ('\n', stderr);
}
static void syms_of_nsfont_for_pdumper (void);
#include "character.h"
#include "font.h"
#include "sysselect.h"
+#include "sysstdio.h"
#ifdef HAVE_NS
#ifdef __OBJC__
__FILE__, __LINE__, nstrace_num++, \
2*nstrace_depth, " | | | | | | | | | | | | | | | .."); \
fprintf (stderr, __VA_ARGS__); \
- fprintf (stderr, "\n"); \
+ putc ('\n', stderr); \
} \
} \
while(0)
if (*fp == NULL)
{
- fprintf (stderr, "Warning: ns_mouse_position () called with null *fp.\n");
+ fputs ("Warning: ns_mouse_position () called with null *fp.\n", stderr);
return;
}
if (type == NSEventTypeCursorUpdate && window == nil)
{
- fprintf (stderr, "Dropping external cursor update event.\n");
+ fputs ("Dropping external cursor update event.\n", stderr);
return;
}
https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/EventOverview/HandlingKeyEvents/HandlingKeyEvents.html. */
if (NS_KEYLOG && !processingCompose)
- fprintf (stderr, "keyDown: Begin compose sequence.\n");
+ fputs ("keyDown: Begin compose sequence.\n", stderr);
/* FIXME: interpretKeyEvents doesn’t seem to send insertText if ⌘ is
used as shift-like modifier, at least on El Capitan. Mask it
}
else
{
- fprintf (stderr, "Invalid data type in dragging pasteboard\n");
+ fputs ("Invalid data type in dragging pasteboard\n", stderr);
return NO;
}
#include <math.h>
#include <stdarg.h>
#include <stdint.h>
-#include <stdio.h>
#include <stdlib.h>
#include <sys/mman.h>
#include <sys/param.h>
#include "lisp.h"
#include "pdumper.h"
#include "window.h"
+#include "sysstdio.h"
#include "systime.h"
#include "thread.h"
#include "bignum.h"
fprintf (stderr, "%s: ", label);
for (int i = 0; i < 32; ++i)
fprintf (stderr, "%02x", (unsigned) xfingerprint[i]);
- fprintf (stderr, "\n");
+ putc ('\n', stderr);
}
/* Format of an Emacs portable dump file. All offsets are relative to
referrers = XCDR (referrers);
Lisp_Object repr = Fprin1_to_string (referrer, Qnil);
for (int i = 0; i < level; ++i)
- fputc (' ', stderr);
+ putc (' ', stderr);
fwrite (SDATA (repr), 1, SBYTES (repr), stderr);
- fputc ('\n', stderr);
+ putc ('\n', stderr);
print_paths_to_root_1 (ctx, referrer, level + 1);
}
}
dump_seek (ctx, 0);
dump_write (ctx, &ctx->header, sizeof (ctx->header));
- fprintf (stderr, "Dump complete\n");
fprintf (stderr,
- "Byte counts: header=%lu hot=%lu discardable=%lu cold=%lu\n",
+ ("Dump complete\n"
+ "Byte counts: header=%lu hot=%lu discardable=%lu cold=%lu\n"
+ "Reloc counts: hot=%u discardable=%u\n"),
(unsigned long) (header_end - header_start),
(unsigned long) (hot_end - hot_start),
(unsigned long) (discardable_end - ctx->header.discardable_start),
- (unsigned long) (cold_end - ctx->header.cold_start));
- fprintf (stderr, "Reloc counts: hot=%u discardable=%u\n",
+ (unsigned long) (cold_end - ctx->header.cold_start),
number_hot_relocations,
number_discardable_relocations);
{
if (ASCII_CHAR_P (ch))
{
- putc_unlocked (ch, stream);
+ putc (ch, stream);
#ifdef WINDOWSNT
/* Send the output to a debugger (nothing happens if there
isn't one). */
if (encode_p)
encoded_ch = code_convert_string_norecord (encoded_ch,
coding_system, true);
- fwrite_unlocked (SSDATA (encoded_ch), 1, SBYTES (encoded_ch), stream);
+ fwrite (SSDATA (encoded_ch), 1, SBYTES (encoded_ch), stream);
#ifdef WINDOWSNT
if (print_output_debug_flag && stream == stderr)
OutputDebugString (SSDATA (encoded_ch));
if (DISP_TABLE_P (Vstandard_display_table))
printchar_to_stream (ch, stdout);
else
- fwrite_unlocked (str, 1, len, stdout);
+ fwrite (str, 1, len, stdout);
noninteractive_need_newline = 1;
}
else
}
}
else
- fwrite_unlocked (ptr, 1, size_byte, stdout);
+ fwrite (ptr, 1, size_byte, stdout);
noninteractive_need_newline = 1;
}
report_file_error ("Cannot open debugging output stream", file);
}
- fflush_unlocked (stderr);
+ fflush (stderr);
if (dup2 (fd, STDERR_FILENO) < 0)
report_file_error ("dup2", file);
if (fd != stderr_dup)
debug_print (Lisp_Object arg)
{
Fprin1 (arg, Qexternal_debugging_output);
- fprintf (stderr, "\r\n");
+ fputs ("\r\n", stderr);
}
void safe_debug_print (Lisp_Object) EXTERNALLY_VISIBLE;
#ifdef REGEX_EMACS_DEBUG
/* Use standard I/O for debugging. */
-# include <stdio.h>
+# include "sysstdio.h"
static int regex_emacs_debug = -100000;
debug_putchar (int c)
{
if (c >= 32 && c <= 126)
- fputc (c, stderr);
+ putc (c, stderr);
else
{
unsigned int uc = c;
}
if (was_a_range)
{
- fprintf (stderr, "-");
+ debug_putchar ('-');
debug_putchar (i - 1);
}
}
}
- fputc ('\n', stderr);
+ putc ('\n', stderr);
}
if (start == NULL)
{
- fprintf (stderr, "(null)\n");
+ fputs ("(null)\n", stderr);
return;
}
switch ((re_opcode_t) *p++)
{
case no_op:
- fprintf (stderr, "/no_op");
+ fputs ("/no_op", stderr);
break;
case succeed:
- fprintf (stderr, "/succeed");
+ fputs ("/succeed", stderr);
break;
case exactn:
fprintf (stderr, "/exactn/%d", mcnt);
do
{
- fprintf (stderr, "/");
+ debug_putchar ('/');
debug_putchar (*p++);
}
while (--mcnt);
break;
case anychar:
- fprintf (stderr, "/anychar");
+ fputs ("/anychar", stderr);
break;
case charset:
(re_opcode_t) *(p - 1) == charset_not ? "^" : "");
if (p + *p >= pend)
- fprintf (stderr, " !extends past end of pattern! ");
+ fputs (" !extends past end of pattern! ", stderr);
for (c = 0; c < 256; c++)
if (c / 8 < length
/* Are we starting a range? */
if (last + 1 == c && ! in_range)
{
- fprintf (stderr, "-");
+ debug_putchar ('-');
in_range = true;
}
/* Have we broken a range? */
if (in_range)
debug_putchar (last);
- fprintf (stderr, "]");
+ debug_putchar (']');
p += 1 + length;
if (has_range_table)
{
int count;
- fprintf (stderr, "has-range-table");
+ fputs ("has-range-table", stderr);
/* ??? Should print the range table; for now, just skip it. */
p += 2; /* skip range table bits */
break;
case begline:
- fprintf (stderr, "/begline");
+ fputs ("/begline", stderr);
break;
case endline:
- fprintf (stderr, "/endline");
+ fputs ("/endline", stderr);
break;
case on_failure_jump:
break;
case wordbound:
- fprintf (stderr, "/wordbound");
+ fputs ("/wordbound", stderr);
break;
case notwordbound:
- fprintf (stderr, "/notwordbound");
+ fputs ("/notwordbound", stderr);
break;
case wordbeg:
- fprintf (stderr, "/wordbeg");
+ fputs ("/wordbeg", stderr);
break;
case wordend:
- fprintf (stderr, "/wordend");
+ fputs ("/wordend", stderr);
break;
case symbeg:
- fprintf (stderr, "/symbeg");
+ fputs ("/symbeg", stderr);
break;
case symend:
- fprintf (stderr, "/symend");
+ fputs ("/symend", stderr);
break;
case syntaxspec:
- fprintf (stderr, "/syntaxspec");
+ fputs ("/syntaxspec", stderr);
mcnt = *p++;
fprintf (stderr, "/%d", mcnt);
break;
case notsyntaxspec:
- fprintf (stderr, "/notsyntaxspec");
+ fputs ("/notsyntaxspec", stderr);
mcnt = *p++;
fprintf (stderr, "/%d", mcnt);
break;
case at_dot:
- fprintf (stderr, "/at_dot");
+ fputs ("/at_dot", stderr);
break;
case categoryspec:
- fprintf (stderr, "/categoryspec");
+ fputs ("/categoryspec", stderr);
mcnt = *p++;
fprintf (stderr, "/%d", mcnt);
break;
case notcategoryspec:
- fprintf (stderr, "/notcategoryspec");
+ fputs ("/notcategoryspec", stderr);
mcnt = *p++;
fprintf (stderr, "/%d", mcnt);
break;
case begbuf:
- fprintf (stderr, "/begbuf");
+ fputs ("/begbuf", stderr);
break;
case endbuf:
- fprintf (stderr, "/endbuf");
+ fputs ("/endbuf", stderr);
break;
default:
fprintf (stderr, "?%d", *(p-1));
}
- fprintf (stderr, "\n");
+ putc ('\n', stderr);
}
fprintf (stderr, "%td:\tend of pattern.\n", p - start);
if (bufp->fastmap_accurate && bufp->fastmap)
{
- fprintf (stderr, "fastmap: ");
+ fputs ("fastmap: ", stderr);
print_fastmap (bufp->fastmap);
}
fprintf (stderr, "re_nsub: %td\t", bufp->re_nsub);
fprintf (stderr, "regs_alloc: %d\t", bufp->regs_allocated);
fprintf (stderr, "can_be_null: %d\n", bufp->can_be_null);
- fflush (stderr);
/* Perhaps we should print the translate table? */
}
re_char *string2, ptrdiff_t size2)
{
if (where == NULL)
- fprintf (stderr, "(null)");
+ fputs ("(null)", stderr);
else
{
int i;
{
for (ptrdiff_t debug_count = 0; debug_count < size; debug_count++)
debug_putchar (pattern[debug_count]);
- fputc ('\n', stderr);
+ putc ('\n', stderr);
}
#endif
{
if (noninteractive)
{
- fflush_unlocked (stdout);
+ fflush (stdout);
return;
}
if (!tty_out->term_initted)
tty_turn_off_insert (tty_out);
for (int i = cursorX (tty_out); i < FrameCols (tty_out) - 1; i++)
- fputc_unlocked (' ', tty_out->output);
+ putc (' ', tty_out->output);
}
cmgoto (tty_out, FrameRows (tty_out) - 1, 0);
- fflush_unlocked (tty_out->output);
+ fflush (tty_out->output);
if (tty_out->terminal->reset_terminal_modes_hook)
tty_out->terminal->reset_terminal_modes_hook (tty_out->terminal);
/* Do not close stderr if addresses are being sanitized, as the
sanitizer might report to stderr after this function is invoked. */
if (ADDRESS_SANITIZER
- ? fflush_unlocked (stderr) != 0 || ferror (stderr)
+ ? fflush (stderr) != 0 || ferror (stderr)
: close_stream (stderr) != 0)
_exit (EXIT_FAILURE);
}
char minor[25]; /* 2 32-bit numbers + dash */
char *endp;
- for (; !feof_unlocked (fdev) && !ferror_unlocked (fdev); name[0] = 0)
+ for (; !feof (fdev) && !ferror (fdev); name[0] = 0)
{
if (fscanf (fdev, "%*s %s %u %s %*s\n", name, &major, minor) >= 3
&& major == MAJOR (rdev))
break;
case 0:
- while ((c = getc_unlocked (fmem)) != EOF && c != '\n')
+ while ((c = getc (fmem)) != EOF && c != '\n')
continue;
done = c == EOF;
break;
#include <fcntl.h>
#include <stdio.h>
+#include "unlocked-io.h"
extern FILE *emacs_fopen (char const *, char const *);
extern void close_output_streams (void);
# define FOPEN_TEXT ""
#endif
-/* These are compatible with unlocked-io.h, if both files are included. */
-#if !HAVE_DECL_CLEARERR_UNLOCKED
-# define clearerr_unlocked(x) clearerr (x)
-#endif
-#if !HAVE_DECL_FEOF_UNLOCKED
-# define feof_unlocked(x) feof (x)
-#endif
-#if !HAVE_DECL_FERROR_UNLOCKED
-# define ferror_unlocked(x) ferror (x)
-#endif
-#if !HAVE_DECL_FFLUSH_UNLOCKED
-# define fflush_unlocked(x) fflush (x)
-#endif
-#if !HAVE_DECL_FGETS_UNLOCKED
-# define fgets_unlocked(x,y,z) fgets (x,y,z)
-#endif
-#if !HAVE_DECL_FPUTC_UNLOCKED
-# define fputc_unlocked(x,y) fputc (x,y)
-#endif
-#if !HAVE_DECL_FPUTS_UNLOCKED
-# define fputs_unlocked(x,y) fputs (x,y)
-#endif
-#if !HAVE_DECL_FREAD_UNLOCKED
-# define fread_unlocked(w,x,y,z) fread (w,x,y,z)
-#endif
-#if !HAVE_DECL_FWRITE_UNLOCKED
-# define fwrite_unlocked(w,x,y,z) fwrite (w,x,y,z)
-#endif
-#if !HAVE_DECL_GETC_UNLOCKED
-# define getc_unlocked(x) getc (x)
-#endif
-#if !HAVE_DECL_GETCHAR_UNLOCKED
-# define getchar_unlocked() getchar ()
-#endif
-#if !HAVE_DECL_PUTC_UNLOCKED
-# define putc_unlocked(x,y) putc (x,y)
-#endif
-#if !HAVE_DECL_PUTCHAR_UNLOCKED
-# define putchar_unlocked(x) putchar (x)
-#endif
-
#endif /* EMACS_SYSSTDIO_H */
OUTPUT (tty, (tty->TS_visible_bell && visible_bell
? tty->TS_visible_bell
: tty->TS_bell));
- fflush_unlocked (tty->output);
+ fflush (tty->output);
}
}
Lisp_Object string = XCAR (extra_codes);
if (STRINGP (string))
{
- fwrite_unlocked (SDATA (string), 1, SBYTES (string), tty->output);
+ fwrite (SDATA (string), 1, SBYTES (string), tty->output);
if (tty->termscript)
- fwrite_unlocked (SDATA (string), 1, SBYTES (string),
- tty->termscript);
+ fwrite (SDATA (string), 1, SBYTES (string), tty->termscript);
}
}
}
OUTPUT_IF (tty, tty->TS_keypad_mode);
losecursor (tty);
tty_send_additional_strings (terminal, Qtty_mode_set_strings);
- fflush_unlocked (tty->output);
+ fflush (tty->output);
}
}
/* Output raw CR so kernel can track the cursor hpos. */
current_tty = tty;
cmputc ('\r');
- fflush_unlocked (tty->output);
+ fflush (tty->output);
}
}
tty_show_cursor (tty);
tty_turn_off_insert (tty);
tty_background_highlight (tty);
- fflush_unlocked (tty->output);
+ fflush (tty->output);
}
/* The implementation of set_terminal_window for termcap frames. */
for (i = curX (tty); i < first_unused_hpos; i++)
{
if (tty->termscript)
- fputc_unlocked (' ', tty->termscript);
- fputc_unlocked (' ', tty->output);
+ putc (' ', tty->termscript);
+ putc (' ', tty->output);
}
cmplus (tty, first_unused_hpos - curX (tty));
}
if (coding->produced > 0)
{
block_input ();
- fwrite_unlocked (conversion_buffer, 1, coding->produced, tty->output);
- clearerr_unlocked (tty->output);
+ fwrite (conversion_buffer, 1, coding->produced, tty->output);
+ clearerr (tty->output);
if (tty->termscript)
- fwrite_unlocked (conversion_buffer, 1, coding->produced,
- tty->termscript);
+ fwrite (conversion_buffer, 1, coding->produced, tty->termscript);
unblock_input ();
}
string += n;
if (coding->produced > 0)
{
block_input ();
- fwrite_unlocked (conversion_buffer, 1, coding->produced, tty->output);
- clearerr_unlocked (tty->output);
+ fwrite (conversion_buffer, 1, coding->produced, tty->output);
+ clearerr (tty->output);
if (tty->termscript)
- fwrite_unlocked (conversion_buffer, 1, coding->produced,
- tty->termscript);
+ fwrite (conversion_buffer, 1, coding->produced, tty->termscript);
unblock_input ();
}
if (coding->produced > 0)
{
block_input ();
- fwrite_unlocked (conversion_buffer, 1, coding->produced, tty->output);
- clearerr_unlocked (tty->output);
+ fwrite (conversion_buffer, 1, coding->produced, tty->output);
+ clearerr (tty->output);
if (tty->termscript)
- fwrite_unlocked (conversion_buffer, 1, coding->produced,
- tty->termscript);
+ fwrite (conversion_buffer, 1, coding->produced, tty->termscript);
unblock_input ();
}
which calls tty_show_cursor. Re-hide it, so it doesn't show
through the menus. */
tty_hide_cursor (tty);
- fflush_unlocked (tty->output);
+ fflush (tty->output);
}
sf->mouse_moved = 0;
while (statecount--)
free_saved_screen (state[statecount].screen_behind);
tty_show_cursor (tty); /* Turn cursor back on. */
- fflush_unlocked (tty->output);
+ fflush (tty->output);
/* Clean up any mouse events that are waiting inside Emacs event queue.
These events are likely to be generated before the menu was even
static void
vfatal (const char *str, va_list ap)
{
- fprintf (stderr, "emacs: ");
+ fputs ("emacs: ", stderr);
vfprintf (stderr, str, ap);
if (! (str[0] && str[strlen (str) - 1] == '\n'))
- fprintf (stderr, "\n");
+ putc ('\n', stderr);
exit (1);
}
#include <config.h>
#include "unexec.h"
#include "lisp.h"
+#include "sysstdio.h"
-#include <stdio.h>
#include <fcntl.h>
#include <errno.h>
#include <a.out.h>
if (hdr->a_magic != EXEC_MAGIC && hdr->a_magic != SHARE_MAGIC
&& hdr->a_magic != DEMAND_MAGIC)
{
- fprintf (stderr, "a.out file doesn't have valid magic number\n");
+ fputs ("a.out file doesn't have valid magic number\n", stderr);
exit (1);
}
#include "unexec.h"
#include "lisp.h"
+#include "sysstdio.h"
#include <errno.h>
-#include <stdio.h>
#include <fcntl.h>
#include <stdarg.h>
#include <stdint.h>
va_list ap;
va_start (ap, format);
- fprintf (stderr, "unexec: ");
+ fputs ("unexec: ", stderr);
vfprintf (stderr, format, ap);
- fprintf (stderr, "\n");
+ putc ('\n', stderr);
va_end (ap);
exit (1);
}
#include <config.h>
#include "widget.h"
-#include <stdio.h>
#include <stdlib.h>
#include "lisp.h"
+#include "sysstdio.h"
#include "xterm.h"
#include "frame.h"
if (!ew->emacs_frame.frame)
{
- fprintf (stderr,
- "can't create an emacs frame widget without a frame\n");
+ fputs ("can't create an emacs frame widget without a frame\n", stderr);
exit (1);
}
buffer_posn_from_coords in dispnew.c for how this is handled. */
#include <config.h>
-#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
#include <math.h>
#include "atimer.h"
#include "composite.h"
#include "keyboard.h"
+#include "sysstdio.h"
#include "systime.h"
#include "frame.h"
#include "window.h"
if (noninteractive_need_newline)
{
noninteractive_need_newline = false;
- fputc ('\n', stderr);
+ putc ('\n', stderr);
}
if (STRINGP (m))
{
else
s = m;
- /* We want to write this out with a single fwrite call so that
+ /* We want to write this out with a single call so that
output doesn't interleave with other processes writing to
stderr at the same time. */
{
}
}
else if (!cursor_in_echo_area)
- fputc ('\n', stderr);
-
- fflush (stderr);
+ putc ('\n', stderr);
}
/* The non-logging version of message3.
if (m)
{
if (noninteractive_need_newline)
- fputc ('\n', stderr);
+ putc ('\n', stderr);
noninteractive_need_newline = false;
vfprintf (stderr, m, ap);
if (!cursor_in_echo_area)
- fputc ('\n', stderr);
+ putc ('\n', stderr);
fflush (stderr);
}
}
{
if (glyphs != 1)
{
- fprintf (stderr, "Row Start End Used oE><\\CTZFesm X Y W H V A P\n");
- fprintf (stderr, "==============================================================================\n");
-
+ fputs (("Row Start End Used oE><\\CTZFesm X Y W H V A P\n"
+ "==============================================================================\n"),
+ stderr);
fprintf (stderr, "%3d %9"pD"d %9"pD"d %4d %1.1d%1.1d%1.1d%1.1d\
%1.1d%1.1d%1.1d%1.1d%1.1d%1.1d%1.1d%1.1d %4d %4d %4d %4d %4d %4d %4d\n",
vpos,
++glyph_end;
if (glyph < glyph_end)
- fprintf (stderr, " Glyph# Type Pos O W Code C Face LR\n");
+ fputs (" Glyph# Type Pos O W Code C Face LR\n",
+ stderr);
for (; glyph < glyph_end; ++glyph)
dump_glyph (row, glyph, area);
BUF_PT (buffer), BUF_BEGV (buffer), BUF_ZV (buffer));
fprintf (stderr, "Cursor x = %d, y = %d, hpos = %d, vpos = %d\n",
w->cursor.x, w->cursor.y, w->cursor.hpos, w->cursor.vpos);
- fprintf (stderr, "=============================================\n");
+ fputs ("=============================================\n", stderr);
dump_glyph_matrix (w->current_matrix,
TYPE_RANGED_FIXNUMP (int, glyphs) ? XFIXNUM (glyphs) : 0);
return Qnil;
if (f->current_matrix)
dump_glyph_matrix (f->current_matrix, 1);
else
- fprintf (stderr, "*** This frame doesn't have a frame glyph matrix ***\n");
+ fputs ("*** This frame doesn't have a frame glyph matrix ***\n", stderr);
return Qnil;
}
void
dump_glyph_string (struct glyph_string *s)
{
- fprintf (stderr, "glyph string\n");
+ fputs ("glyph string\n", stderr);
fprintf (stderr, " x, y, w, h = %d, %d, %d, %d\n",
s->x, s->y, s->width, s->height);
fprintf (stderr, " ybase = %d\n", s->ybase);
{
int i, n;
- fputc ('\n', stderr);
+ putc ('\n', stderr);
for (i = n = 0; i < ARRAYELTS (color_count); ++i)
if (color_count[i])
{
fprintf (stderr, "%3d: %5d", i, color_count[i]);
++n;
- if (n % 5 == 0)
- fputc ('\n', stderr);
- else
- fputc ('\t', stderr);
+ putc (n % 5 == 0 ? '\n' : '\t', stderr);
}
if (n % 5 != 0)
- fputc ('\n', stderr);
+ putc ('\n', stderr);
return Qnil;
}
int red, green, blue;
int num;
- while (fgets_unlocked (buf, sizeof (buf), fp) != NULL) {
+ while (fgets (buf, sizeof (buf), fp) != NULL)
if (sscanf (buf, "%d %d %d %n", &red, &green, &blue, &num) == 3)
{
#ifdef HAVE_NTGUI
cmap = Fcons (Fcons (make_string (name, len), make_fixnum (color)),
cmap);
}
- }
fclose (fp);
}
unblock_input ();
{
int i;
- fprintf (stderr, "font selection order: ");
+ fputs ("font selection order: ", stderr);
for (i = 0; i < ARRAYELTS (font_sort_order); ++i)
fprintf (stderr, "%d ", font_sort_order[i]);
- fprintf (stderr, "\n");
+ putc ('\n', stderr);
- fprintf (stderr, "alternative fonts: ");
+ fputs ("alternative fonts: ", stderr);
debug_print (Vface_alternative_font_family_alist);
- fprintf (stderr, "\n");
+ putc ('\n', stderr);
for (i = 0; i < FRAME_FACE_CACHE (SELECTED_FRAME ())->used; ++i)
Fdump_face (make_fixnum (i));
#include <config.h>
#include <limits.h>
-#include <stdio.h> /* TRACE_SELECTION needs this. */
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#include "xterm.h" /* for all of the X includes */
#include "frame.h" /* Need this to get the X window of selected_frame */
#include "blockinput.h"
+#include "sysstdio.h" /* TRACE_SELECTION needs this. */
#include "termhooks.h"
#include "keyboard.h"
#include "pdumper.h"
static Lisp_Object
x_clipboard_manager_error_2 (Lisp_Object err)
{
- fprintf (stderr, "Error saving to X clipboard manager.\n\
-If the problem persists, set '%s' \
-to nil.\n", "x-select-enable-clipboard-manager");
+ fputs (("Error saving to X clipboard manager.\n"
+ "If the problem persists,"
+ " set 'x-select-enable-clipboard-manager' to nil.\n"),
+ stderr);
return Qnil;
}
/* Xt features made by Fred Pierresteguy. */
#include <config.h>
-#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "lisp.h"
#include "blockinput.h"
+#include "sysstdio.h"
/* This may include sys/types.h, and that somehow loses
if this is not done before the other system files. */
#if THREADS_ENABLED
/* This must be called before any other Xlib routines. */
if (XInitThreads () == 0)
- fprintf (stderr,
- "Warning: An error occurred initializing X11 thread support!\n");
+ fputs ("Warning: An error occurred initializing X11 thread support!\n",
+ stderr);
#endif
#ifdef USE_X_TOOLKIT
#include "frame.h"
#include "keyboard.h"
#include "gtkutil.h"
+#include "sysstdio.h"
#include <webkit2/webkit2.h>
#include <JavaScriptCore/JavaScript.h>
struct xwidget *xw = XXWIDGET (xwidget); \
if (!xw->widget_osr || !WEBKIT_IS_WEB_VIEW (xw->widget_osr)) \
{ \
- printf ("ERROR xw->widget_osr does not hold a webkit instance\n"); \
+ fputs ("ERROR xw->widget_osr does not hold a webkit instance\n", \
+ stdout); \
return Qnil; \
}