Mercurial > hg > xemacs-beta
view lib-src/b2m.c @ 4932:8b63e21b0436
fix compile issues with gcc 4
-------------------- ChangeLog entries follow: --------------------
ChangeLog addition:
2010-01-24 Ben Wing <ben@xemacs.org>
* aclocal.m4 (XE_SHLIB_STUFF):
Use -export-all-symbols instead of -export-dynamic on PE targets
(Cygwin and MinGW).
* configure.ac (XE_EXPAND_VARIABLE):
* configure.ac (TAB):
Create variable XEMACS_CC_GPP to check whether we're running g++.
Don't just check for an executable called `g++' -- it might be
called g++-4 or whatever. Instead, check for either named `g++*'
or claiming to be g++ when called with --version. Rewrite code do
use the variable.
Add -fno-strict-aliasing to optimization flags when GCC and
optimized, and in all cases with g++, since under these circumstances
strict aliasing is otherwise assumed, and XEmacs can't easily be
made to respect its restrictions.
* configure: Regenerate.
lib-src/ChangeLog addition:
2010-01-24 Ben Wing <ben@xemacs.org>
* fakemail.c (args_size):
* fakemail.c (parse_header):
* ootags.c (C_entries):
Fix warnings about possible use of uninitialized vars.
lwlib/ChangeLog addition:
2010-01-24 Ben Wing <ben@xemacs.org>
* xlwgauge.c (GaugeResize):
* xlwgauge.c (GaugeSize):
Fix warnings about possible use of uninitialized vars.
modules/ChangeLog addition:
2010-01-24 Ben Wing <ben@xemacs.org>
* postgresql/postgresql.c (CHECK_LIVE_CONNECTION):
* postgresql/postgresql.c (print_pgconn):
* postgresql/postgresql.c (Fpq_connectdb):
* postgresql/postgresql.c (Fpq_connect_start):
* postgresql/postgresql.c (Fpq_exec):
* postgresql/postgresql.c (Fpq_get_result):
Fix g++ 4.3 complaints about implicit conversions of string
literals (const char *) to char *.
src/ChangeLog addition:
2010-01-24 Ben Wing <ben@xemacs.org>
* chartab.c (decode_char_table_range):
* extents.c (extent_fragment_update):
* objects-msw.c (initialize_font_instance):
* process.c (Fgetenv):
* redisplay-output.c (get_next_display_block):
Fix warnings about possible use of uninitialized vars.
* compiler.h:
* compiler.h (REGISTER):
* event-stream.c (is_scrollbar_event):
* window.c (window_scrollbar_width):
* window.c (window_scrollbar_height):
* window.c (window_left_window_gutter_width):
* window.c (window_right_window_gutter_width):
Add USED_IF_SCROLLBARS. Use it to fix warnings about unused
vars when --with-scrollbars=no.
* config.h.in:
Change comment to explain better why DECLARE_INLINE_HEADER
is needed.
* dialog-msw.c:
* emacs.c (SHEBANG_EXE_PROGNAME_LENGTH):
* emacs.c (main_1):
* event-msw.c (struct mswin_message_debug):
* event-msw.c (debug_output_mswin_message):
* font-mgr.c:
* font-mgr.c (Ffc_config_filename):
* glyphs-msw.c (struct):
* glyphs-msw.c (bitmap_table):
* glyphs-x.c (update_widget_face):
* intl-win32.c (struct lang_to_string):
* intl-win32.c (lang_to_string_table):
* nas.c:
* objects-xlike-inc.c:
* objects-xlike-inc.c (xft_find_charset_font):
* syswindows.h:
* win32.c (mswindows_output_last_error):
Fix g++ 4.3 complaints about implicit conversions of string
literals (const char *) to char *.
* lisp.h:
G++ 4.3 needs #include <limits> to avoid errors about min/max.
* lisp.h (disabled_assert_with_message):
Use disabled_assert* whenever asserts are disabled. Rewrite
disabled_assert* to avoid complaints about unused vars by
pretending to use the vars but casting them to (void).
Remove code that defined assert() weirdly if DEBUG_XEMACS but
not USE_ASSERTIONS -- configure sets USE_ASSERTIONS automatically
when DEBUG_XEMACS, and if the user has forced it off, then
so be it.
* lisp.h (SYMBOL_KEYWORD):
Put some of the combined `extern Lisp_Object's back under
the file they are declared in. Cosmetic fix.
* number.h:
Remove `extern Lisp_Object' decls that duplicate lisp.h,
since they have different C vs. C++ linkage.
author | Ben Wing <ben@xemacs.org> |
---|---|
date | Sun, 24 Jan 2010 22:04:58 -0600 |
parents | abe6d1db359e |
children | 061f4f90f874 |
line wrap: on
line source
/* * b2m - a filter for Babyl -> Unix mail files * * usage: b2m < babyl > mailbox * * I find this useful whenever I have to use a * system which - shock horror! - doesn't run * Gnu emacs. At least now I can read all my * Gnumacs Babyl format mail files! * * it's not much but it's free! * * Ed Wilkinson * E.Wilkinson@massey.ac.nz * Mon Nov 7 15:54:06 PDT 1988 */ /* Made conformant to the GNU coding standards January, 1995 by Francesco Potorti` <pot@cnuce.cnr.it>. */ #ifdef HAVE_CONFIG_H #include <config.h> /* On some systems, Emacs defines static as nothing for the sake of unexec. We don't want that here since we don't use unexec. */ #undef static #endif #include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> #include <sys/types.h> #ifdef WIN32_NATIVE #include <fcntl.h> #endif #undef TRUE #define TRUE 1 #undef FALSE #define FALSE 0 /* Exit codes for success and failure. */ #ifdef VMS #define GOOD 1 #define BAD 0 #else #define GOOD 0 #define BAD 1 #endif #define streq(s,t) (strcmp (s, t) == 0) #define strneq(s,t,n) (strncmp (s, t, n) == 0) typedef int logical; /* * A `struct linebuffer' is a structure which holds a line of text. * `readline' reads a line from a stream into a linebuffer and works * regardless of the length of the line. */ struct linebuffer { long size; char *buffer; }; static long *xmalloc (unsigned int); static long *xrealloc (void *, unsigned int); static char *concat (char *s1, char *s2, char *s3); static long readline (struct linebuffer *, FILE *); static void fatal (char *); /* * xnew -- allocate storage. SYNOPSIS: Type *xnew (int n, Type); */ #define xnew(n, Type) ((Type *) xmalloc ((n) * sizeof (Type))) char *progname; int main (int argc, char *argv[]) { logical labels_saved, printing, header; time_t ltoday; char *labels = NULL, *p, *today; struct linebuffer data; #ifdef WIN32_NATIVE _fmode = O_BINARY; /* all of files are treated as binary files */ if (!isatty (fileno (stdout))) setmode (fileno (stdout), O_BINARY); if (!isatty (fileno (stdin))) setmode (fileno (stdin), O_BINARY); #endif progname = argv[0]; if (argc != 1) { fprintf (stderr, "Usage: %s <babylmailbox >unixmailbox\n", progname); exit (GOOD); } labels_saved = printing = header = FALSE; ltoday = time (0); today = ctime (<oday); data.size = 200; data.buffer = xnew (200, char); if (readline (&data, stdin) == 0 || !strneq (data.buffer, "BABYL OPTIONS:", 14)) fatal ("standard input is not a Babyl mailfile."); while (readline (&data, stdin) > 0) { if (streq (data.buffer, "*** EOOH ***") && !printing) { printing = header = TRUE; printf ("From \"Babyl to mail by %s\" %s", progname, today); continue; } if (data.buffer[0] == '\037') { if (data.buffer[1] == '\0') continue; else if (data.buffer[1] == '\f') { /* Save labels. */ readline (&data, stdin); p = strtok (data.buffer, " ,\r\n\t"); labels = "X-Babyl-Labels: "; while ((p = strtok (NULL, " ,\r\n\t"))) labels = concat (labels, p, ", "); p = &labels[strlen (labels) - 2]; if (*p == ',') *p = '\0'; printing = header = FALSE; labels_saved = TRUE; continue; } } if ((data.buffer[0] == '\0') && header) { header = FALSE; if (labels_saved) puts (labels); } if (printing) puts (data.buffer); } return 0; } /* * Return a newly-allocated string whose contents * concatenate those of s1, s2, s3. */ static char * concat (char *s1, char *s2, char *s3) { int len1 = strlen (s1), len2 = strlen (s2), len3 = strlen (s3); char *result = xnew (len1 + len2 + len3 + 1, char); strcpy (result, s1); strcpy (result + len1, s2); strcpy (result + len1 + len2, s3); result[len1 + len2 + len3] = '\0'; return result; } /* * Read a line of text from `stream' into `linebuffer'. * Return the number of characters read from `stream', * which is the length of the line including the newline, if any. */ static long readline (struct linebuffer *linebuffer, FILE *stream) { char *buffer = linebuffer->buffer; register char *p = linebuffer->buffer; register char *pend; int chars_deleted; pend = p + linebuffer->size; /* Separate to avoid 386/IX compiler bug. */ while (1) { register int c = getc (stream); if (p == pend) { linebuffer->size *= 2; buffer = (char *) xrealloc (buffer, linebuffer->size); p += buffer - linebuffer->buffer; pend = buffer + linebuffer->size; linebuffer->buffer = buffer; } if (c == EOF) { chars_deleted = 0; break; } if (c == '\n') { if (p[-1] == '\r' && p > buffer) { *--p = '\0'; chars_deleted = 2; } else { *p = '\0'; chars_deleted = 1; } break; } *p++ = c; } return (p - buffer + chars_deleted); } /* * Like malloc but get fatal error if memory is exhausted. */ static long * xmalloc (unsigned int size) { long *result = (long *) malloc (size); if (result == NULL) fatal ("virtual memory exhausted"); return result; } static long * xrealloc (void *ptr, unsigned int size) { long *result = (long *) realloc (ptr, size); if (result == NULL) fatal ("virtual memory exhausted"); return result; } static void fatal (char *message) { fprintf (stderr, "%s: %s\n", progname, message); exit (BAD); }