aboutsummaryrefslogtreecommitdiffstats
path: root/src/term.c
diff options
context:
space:
mode:
authorDan Nicolaescu2010-07-12 21:47:45 -0700
committerDan Nicolaescu2010-07-12 21:47:45 -0700
commitb3ffc17c5dafe807981af3e0b72b3508d3b4fff4 (patch)
tree9ead3d845ae4b514f7330a27e335fbe443442dfd /src/term.c
parent0521f5806bfc9ad55488c26c9808f513b9384ff4 (diff)
downloademacs-b3ffc17c5dafe807981af3e0b72b3508d3b4fff4.tar.gz
emacs-b3ffc17c5dafe807981af3e0b72b3508d3b4fff4.zip
Convert maybe_fatal to standard C.
* src/lisp.h (verror): Declare. * src/eval.c (verror): New function containing the code from ... (error): ... this. Call verror. * src/term.c (vfatal): New function containing the code from ... (fatal): ... this. Call vfatal. (maybe_fatal): Convert to standard C, use variable number of arguments. Declare as non-return. (init_tty): Fix maybe_fatal call.
Diffstat (limited to 'src/term.c')
-rw-r--r--src/term.c42
1 files changed, 27 insertions, 15 deletions
diff --git a/src/term.c b/src/term.c
index 53879e57e5b..5ffd7416bbd 100644
--- a/src/term.c
+++ b/src/term.c
@@ -101,6 +101,10 @@ static void clear_tty_hooks (struct terminal *terminal);
101static void set_tty_hooks (struct terminal *terminal); 101static void set_tty_hooks (struct terminal *terminal);
102static void dissociate_if_controlling_tty (int fd); 102static void dissociate_if_controlling_tty (int fd);
103static void delete_tty (struct terminal *); 103static void delete_tty (struct terminal *);
104static void maybe_fatal (int must_succeed, struct terminal *terminal,
105 const char *str1, const char *str2, ...) NO_RETURN;
106static void vfatal (const char *str, va_list ap) NO_RETURN;
107
104 108
105#define OUTPUT(tty, a) \ 109#define OUTPUT(tty, a) \
106 emacs_tputs ((tty), a, \ 110 emacs_tputs ((tty), a, \
@@ -3375,8 +3379,6 @@ dissociate_if_controlling_tty (int fd)
3375#endif /* !DOS_NT */ 3379#endif /* !DOS_NT */
3376} 3380}
3377 3381
3378static void maybe_fatal();
3379
3380/* Create a termcap display on the tty device with the given name and 3382/* Create a termcap display on the tty device with the given name and
3381 type. 3383 type.
3382 3384
@@ -3748,7 +3750,7 @@ use the Bourne shell command `TERM=... export TERM' (C-shell:\n\
3748 3750
3749 if (FrameRows (tty) < 3 || FrameCols (tty) < 3) 3751 if (FrameRows (tty) < 3 || FrameCols (tty) < 3)
3750 maybe_fatal (must_succeed, terminal, 3752 maybe_fatal (must_succeed, terminal,
3751 "Screen size %dx%d is too small" 3753 "Screen size %dx%d is too small",
3752 "Screen size %dx%d is too small", 3754 "Screen size %dx%d is too small",
3753 FrameCols (tty), FrameRows (tty)); 3755 FrameCols (tty), FrameRows (tty));
3754 3756
@@ -3924,24 +3926,39 @@ use the Bourne shell command `TERM=... export TERM' (C-shell:\n\
3924 return terminal; 3926 return terminal;
3925} 3927}
3926 3928
3929
3930static void
3931vfatal (const char *str, va_list ap)
3932{
3933 fprintf (stderr, "emacs: ");
3934 vfprintf (stderr, str, ap);
3935 if (!(strlen (str) > 0 && str[strlen (str) - 1] == '\n'))
3936 fprintf (stderr, "\n");
3937 va_end (ap);
3938 fflush (stderr);
3939 exit (1);
3940}
3941
3942
3927/* Auxiliary error-handling function for init_tty. 3943/* Auxiliary error-handling function for init_tty.
3928 Delete TERMINAL, then call error or fatal with str1 or str2, 3944 Delete TERMINAL, then call error or fatal with str1 or str2,
3929 respectively, according to MUST_SUCCEED. */ 3945 respectively, according to MUST_SUCCEED. */
3930 3946
3931static void 3947static void
3932maybe_fatal (must_succeed, terminal, str1, str2, arg1, arg2) 3948maybe_fatal (int must_succeed, struct terminal *terminal,
3933 int must_succeed; 3949 const char *str1, const char *str2, ...)
3934 struct terminal *terminal;
3935 char *str1, *str2, *arg1, *arg2;
3936{ 3950{
3951 va_list ap;
3952 va_start (ap, str2);
3937 if (terminal) 3953 if (terminal)
3938 delete_tty (terminal); 3954 delete_tty (terminal);
3939 3955
3940 if (must_succeed) 3956 if (must_succeed)
3941 fatal (str2, arg1, arg2); 3957 vfatal (str2, ap);
3942 else 3958 else
3943 error (str1, arg1, arg2); 3959 verror (str1, ap);
3944 3960
3961 va_end (ap);
3945 abort (); 3962 abort ();
3946} 3963}
3947 3964
@@ -3950,13 +3967,8 @@ fatal (const char *str, ...)
3950{ 3967{
3951 va_list ap; 3968 va_list ap;
3952 va_start (ap, str); 3969 va_start (ap, str);
3953 fprintf (stderr, "emacs: "); 3970 vfatal (str, ap);
3954 vfprintf (stderr, str, ap);
3955 if (!(strlen (str) > 0 && str[strlen (str) - 1] == '\n'))
3956 fprintf (stderr, "\n");
3957 va_end (ap); 3971 va_end (ap);
3958 fflush (stderr);
3959 exit (1);
3960} 3972}
3961 3973
3962 3974