diff options
Diffstat (limited to 'lib-src')
| -rw-r--r-- | lib-src/ChangeLog | 45 | ||||
| -rw-r--r-- | lib-src/Makefile.in | 13 | ||||
| -rw-r--r-- | lib-src/b2m.c | 318 | ||||
| -rw-r--r-- | lib-src/b2m.pl | 158 | ||||
| -rw-r--r-- | lib-src/emacsclient.c | 55 | ||||
| -rw-r--r-- | lib-src/make-docfile.c | 5 | ||||
| -rw-r--r-- | lib-src/makefile.w32-in | 11 | ||||
| -rw-r--r-- | lib-src/movemail.c | 7 | ||||
| -rw-r--r-- | lib-src/sorted-doc.c | 2 | ||||
| -rw-r--r-- | lib-src/test-distrib.c | 5 |
10 files changed, 96 insertions, 523 deletions
diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog index 2c386257c10..0f24b234972 100644 --- a/lib-src/ChangeLog +++ b/lib-src/ChangeLog | |||
| @@ -1,3 +1,48 @@ | |||
| 1 | 2010-10-10 Dan Nicolaescu <dann@ics.uci.edu> | ||
| 2 | |||
| 3 | * Makefile.in (PROFILING_LDFLAGS): Remove, not needed. | ||
| 4 | |||
| 5 | 2010-10-09 Glenn Morris <rgm@gnu.org> | ||
| 6 | |||
| 7 | * b2m.c, b2m.pl: Remove files. | ||
| 8 | * Makefile.in (INSTALLABLES): Remove b2m. | ||
| 9 | * makefile.w32-in ($(BLD)/b2m.$(O)): Remove. | ||
| 10 | |||
| 11 | 2010-10-08 Glenn Morris <rgm@gnu.org> | ||
| 12 | |||
| 13 | * emacsclient.c (set_local_socket) [DARWIN_OS]: Try as a fall-back | ||
| 14 | DARWIN_USER_TEMP_DIR. (Bug#3992) | ||
| 15 | |||
| 16 | 2010-10-03 Dan Nicolaescu <dann@ics.uci.edu> | ||
| 17 | |||
| 18 | * test-distrib.c (cool_read): | ||
| 19 | * movemail.c (main, concat): | ||
| 20 | * make-docfile.c (scan_file, write_c_args): | ||
| 21 | * emacsclient.c (get_server_config): Fix -Wconversion warning. | ||
| 22 | (egetenv): Move conditional definition earlier. | ||
| 23 | (progname): Use const. | ||
| 24 | * sorted-doc.c (xstrdup): Use const. | ||
| 25 | |||
| 26 | * Makefile.in: Remove ^L, old makes choke on it. | ||
| 27 | |||
| 28 | 2010-10-02 Wolfgang Schnerring <wosc@wosc.de> (tiny change) | ||
| 29 | |||
| 30 | * emacsclient.c (main): Return EXIT_FAILURE if Emacs sends us an | ||
| 31 | error string (Bug#6963). | ||
| 32 | |||
| 33 | 2010-10-02 Juanma Barranquero <lekktu@gmail.com> | ||
| 34 | |||
| 35 | * makefile.w32-in (tags): Remove target. | ||
| 36 | |||
| 37 | 2010-10-01 Eli Zaretskii <eliz@gnu.org> | ||
| 38 | |||
| 39 | * makefile.w32-in (tags, TAGS): New targets. | ||
| 40 | |||
| 41 | 2010-09-30 Juanma Barranquero <lekktu@gmail.com> | ||
| 42 | |||
| 43 | * emacsclient.c (get_server_config): Don't read Emacs pid from | ||
| 44 | the authentication file. | ||
| 45 | |||
| 1 | 2010-09-29 Juanma Barranquero <lekktu@gmail.com> | 46 | 2010-09-29 Juanma Barranquero <lekktu@gmail.com> |
| 2 | 47 | ||
| 3 | * makefile.w32-in (../src/config.h): Remove target, it is stale. | 48 | * makefile.w32-in (../src/config.h): Remove target, it is stale. |
diff --git a/lib-src/Makefile.in b/lib-src/Makefile.in index 9ad3c65afad..b90b19b69b6 100644 --- a/lib-src/Makefile.in +++ b/lib-src/Makefile.in | |||
| @@ -1,6 +1,7 @@ | |||
| 1 | # Makefile for lib-src subdirectory in GNU Emacs. | 1 | # Makefile for lib-src subdirectory in GNU Emacs. |
| 2 | # Copyright (C) 1985, 1987, 1988, 1993, 1994, 2001, 2002, 2003, 2004, | 2 | # Copyright (C) 1985, 1987, 1988, 1993, 1994, 2001, 2002, 2003, 2004, |
| 3 | # 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. | 3 | # 2005, 2006, 2007, 2008, 2009, 2010 |
| 4 | # Free Software Foundation, Inc. | ||
| 4 | 5 | ||
| 5 | # This file is part of GNU Emacs. | 6 | # This file is part of GNU Emacs. |
| 6 | 7 | ||
| @@ -38,7 +39,6 @@ C_SWITCH_SYSTEM=@C_SWITCH_SYSTEM@ | |||
| 38 | C_SWITCH_MACHINE=@C_SWITCH_MACHINE@ | 39 | C_SWITCH_MACHINE=@C_SWITCH_MACHINE@ |
| 39 | C_WARNINGS_SWITCH = @C_WARNINGS_SWITCH@ | 40 | C_WARNINGS_SWITCH = @C_WARNINGS_SWITCH@ |
| 40 | PROFILING_CFLAGS = @PROFILING_CFLAGS@ | 41 | PROFILING_CFLAGS = @PROFILING_CFLAGS@ |
| 41 | PROFILING_LDFLAGS = @PROFILING_LDFLAGS@ | ||
| 42 | 42 | ||
| 43 | # Program name transformation. | 43 | # Program name transformation. |
| 44 | TRANSFORM = @program_transform_name@ | 44 | TRANSFORM = @program_transform_name@ |
| @@ -111,7 +111,7 @@ INSTALL_STRIP = | |||
| 111 | 111 | ||
| 112 | # Things that a user might actually run, which should be installed in bindir. | 112 | # Things that a user might actually run, which should be installed in bindir. |
| 113 | INSTALLABLES = etags${EXEEXT} ctags${EXEEXT} emacsclient${EXEEXT} \ | 113 | INSTALLABLES = etags${EXEEXT} ctags${EXEEXT} emacsclient${EXEEXT} \ |
| 114 | b2m${EXEEXT} ebrowse${EXEEXT} | 114 | ebrowse${EXEEXT} |
| 115 | 115 | ||
| 116 | INSTALLABLE_SCRIPTS = rcs-checkin grep-changelog | 116 | INSTALLABLE_SCRIPTS = rcs-checkin grep-changelog |
| 117 | STAMP_INST_SCRIPTS = stamp-rcs-checkin stamp-grep-changelog | 117 | STAMP_INST_SCRIPTS = stamp-rcs-checkin stamp-grep-changelog |
| @@ -172,12 +172,11 @@ BASE_CFLAGS = $(C_SWITCH_SYSTEM) $(C_SWITCH_MACHINE) ${C_WARNINGS_SWITCH} \ | |||
| 172 | -DHAVE_CONFIG_H -I. -I../src -I${srcdir} -I${srcdir}/../src | 172 | -DHAVE_CONFIG_H -I. -I../src -I${srcdir} -I${srcdir}/../src |
| 173 | 173 | ||
| 174 | ALL_CFLAGS = ${BASE_CFLAGS} ${PROFILING_CFLAGS} ${LDFLAGS} ${CPPFLAGS} ${CFLAGS} | 174 | ALL_CFLAGS = ${BASE_CFLAGS} ${PROFILING_CFLAGS} ${LDFLAGS} ${CPPFLAGS} ${CFLAGS} |
| 175 | LINK_CFLAGS = ${BASE_CFLAGS} ${PROFILING_LDFLAGS} ${LDFLAGS} ${CFLAGS} | 175 | LINK_CFLAGS = ${BASE_CFLAGS} ${LDFLAGS} ${CFLAGS} |
| 176 | CPP_CFLAGS = ${BASE_CFLAGS} ${PROFILING_CFLAGS} ${CPPFLAGS} ${CFLAGS} | 176 | CPP_CFLAGS = ${BASE_CFLAGS} ${PROFILING_CFLAGS} ${CPPFLAGS} ${CFLAGS} |
| 177 | 177 | ||
| 178 | LOADLIBES=$(LIBS_SYSTEM) | 178 | LOADLIBES=$(LIBS_SYSTEM) |
| 179 | 179 | ||
| 180 | |||
| 181 | ## This is the default compilation command. | 180 | ## This is the default compilation command. |
| 182 | ## But we should never rely on it, because some make version failed to | 181 | ## But we should never rely on it, because some make version failed to |
| 183 | ## find it for getopt.o. | 182 | ## find it for getopt.o. |
| @@ -360,10 +359,6 @@ digest-doc${EXEEXT}: ${srcdir}/digest-doc.c | |||
| 360 | sorted-doc${EXEEXT}: ${srcdir}/sorted-doc.c | 359 | sorted-doc${EXEEXT}: ${srcdir}/sorted-doc.c |
| 361 | $(CC) ${ALL_CFLAGS} ${srcdir}/sorted-doc.c $(LOADLIBES) -o sorted-doc | 360 | $(CC) ${ALL_CFLAGS} ${srcdir}/sorted-doc.c $(LOADLIBES) -o sorted-doc |
| 362 | 361 | ||
| 363 | b2m${EXEEXT}: ${srcdir}/b2m.c ../src/config.h $(GETOPTDEPS) | ||
| 364 | $(CC) ${ALL_CFLAGS} ${srcdir}/b2m.c -DVERSION="\"${version}\"" \ | ||
| 365 | $(GETOPTOBJS) $(LOADLIBES) -o b2m | ||
| 366 | |||
| 367 | movemail${EXEEXT}: movemail.o pop.o $(GETOPTDEPS) | 362 | movemail${EXEEXT}: movemail.o pop.o $(GETOPTDEPS) |
| 368 | $(CC) ${LINK_CFLAGS} ${MOVE_FLAGS} movemail.o pop.o \ | 363 | $(CC) ${LINK_CFLAGS} ${MOVE_FLAGS} movemail.o pop.o \ |
| 369 | $(GETOPTOBJS) $(LOADLIBES) $(LIBS_MOVE) -o movemail | 364 | $(GETOPTOBJS) $(LOADLIBES) $(LIBS_MOVE) -o movemail |
diff --git a/lib-src/b2m.c b/lib-src/b2m.c deleted file mode 100644 index 803d75e233c..00000000000 --- a/lib-src/b2m.c +++ /dev/null | |||
| @@ -1,318 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * b2m - a filter for Babyl -> Unix mail files | ||
| 3 | * The copyright on this file has been disclaimed. | ||
| 4 | * | ||
| 5 | * usage: b2m < babyl > mailbox | ||
| 6 | * | ||
| 7 | * I find this useful whenever I have to use a | ||
| 8 | * system which - shock horror! - doesn't run | ||
| 9 | * GNU Emacs. At least now I can read all my | ||
| 10 | * GNU Emacs Babyl format mail files! | ||
| 11 | * | ||
| 12 | * it's not much but it's free! | ||
| 13 | * | ||
| 14 | * Ed Wilkinson | ||
| 15 | * E.Wilkinson@massey.ac.nz | ||
| 16 | * Mon Nov 7 15:54:06 PDT 1988 | ||
| 17 | */ | ||
| 18 | |||
| 19 | /* Made conformant to the GNU coding standards January, 1995 | ||
| 20 | by Francesco Potorti` <pot@cnuce.cnr.it>. */ | ||
| 21 | |||
| 22 | #ifdef HAVE_CONFIG_H | ||
| 23 | #include <config.h> | ||
| 24 | /* On some systems, Emacs defines static as nothing for the sake | ||
| 25 | of unexec. We don't want that here since we don't use unexec. */ | ||
| 26 | #undef static | ||
| 27 | #endif | ||
| 28 | |||
| 29 | #include <stdio.h> | ||
| 30 | #include <time.h> | ||
| 31 | #include <sys/types.h> | ||
| 32 | #include <getopt.h> | ||
| 33 | #ifdef MSDOS | ||
| 34 | #include <fcntl.h> | ||
| 35 | #endif | ||
| 36 | |||
| 37 | #undef TRUE | ||
| 38 | #define TRUE 1 | ||
| 39 | #undef FALSE | ||
| 40 | #define FALSE 0 | ||
| 41 | |||
| 42 | #define streq(s,t) (strcmp (s, t) == 0) | ||
| 43 | #define strneq(s,t,n) (strncmp (s, t, n) == 0) | ||
| 44 | |||
| 45 | typedef int logical; | ||
| 46 | |||
| 47 | #define TM_YEAR_BASE 1900 | ||
| 48 | |||
| 49 | /* Nonzero if TM_YEAR is a struct tm's tm_year value that causes | ||
| 50 | asctime to have well-defined behavior. */ | ||
| 51 | #ifndef TM_YEAR_IN_ASCTIME_RANGE | ||
| 52 | # define TM_YEAR_IN_ASCTIME_RANGE(tm_year) \ | ||
| 53 | (1000 - TM_YEAR_BASE <= (tm_year) && (tm_year) <= 9999 - TM_YEAR_BASE) | ||
| 54 | #endif | ||
| 55 | |||
| 56 | /* | ||
| 57 | * A `struct linebuffer' is a structure which holds a line of text. | ||
| 58 | * `readline' reads a line from a stream into a linebuffer and works | ||
| 59 | * regardless of the length of the line. | ||
| 60 | */ | ||
| 61 | struct linebuffer | ||
| 62 | { | ||
| 63 | long size; | ||
| 64 | char *buffer; | ||
| 65 | }; | ||
| 66 | |||
| 67 | extern char *strtok(char *, const char *); | ||
| 68 | |||
| 69 | long *xmalloc (unsigned int size); | ||
| 70 | long *xrealloc (char *ptr, unsigned int size); | ||
| 71 | char *concat (const char *s1, const char *s2, const char *s3); | ||
| 72 | long readline (struct linebuffer *linebuffer, register FILE *stream); | ||
| 73 | void fatal (const char *message) NO_RETURN; | ||
| 74 | |||
| 75 | /* | ||
| 76 | * xnew -- allocate storage. SYNOPSIS: Type *xnew (int n, Type); | ||
| 77 | */ | ||
| 78 | #define xnew(n, Type) ((Type *) xmalloc ((n) * sizeof (Type))) | ||
| 79 | |||
| 80 | |||
| 81 | |||
| 82 | char *progname; | ||
| 83 | |||
| 84 | struct option longopts[] = | ||
| 85 | { | ||
| 86 | { "help", no_argument, NULL, 'h' }, | ||
| 87 | { "version", no_argument, NULL, 'V' }, | ||
| 88 | { 0 } | ||
| 89 | }; | ||
| 90 | |||
| 91 | extern int optind; | ||
| 92 | |||
| 93 | int | ||
| 94 | main (int argc, char **argv) | ||
| 95 | { | ||
| 96 | logical labels_saved, printing, header, first, last_was_blank_line; | ||
| 97 | time_t ltoday; | ||
| 98 | struct tm *tm; | ||
| 99 | char *labels, *p, *today; | ||
| 100 | struct linebuffer data; | ||
| 101 | |||
| 102 | #ifdef MSDOS | ||
| 103 | _fmode = O_BINARY; /* all of files are treated as binary files */ | ||
| 104 | #if __DJGPP__ > 1 | ||
| 105 | if (!isatty (fileno (stdout))) | ||
| 106 | setmode (fileno (stdout), O_BINARY); | ||
| 107 | if (!isatty (fileno (stdin))) | ||
| 108 | setmode (fileno (stdin), O_BINARY); | ||
| 109 | #else /* not __DJGPP__ > 1 */ | ||
| 110 | (stdout)->_flag &= ~_IOTEXT; | ||
| 111 | (stdin)->_flag &= ~_IOTEXT; | ||
| 112 | #endif /* not __DJGPP__ > 1 */ | ||
| 113 | #endif | ||
| 114 | progname = argv[0]; | ||
| 115 | |||
| 116 | while (1) | ||
| 117 | { | ||
| 118 | int opt = getopt_long (argc, argv, "hV", longopts, 0); | ||
| 119 | if (opt == EOF) | ||
| 120 | break; | ||
| 121 | |||
| 122 | switch (opt) | ||
| 123 | { | ||
| 124 | case 'V': | ||
| 125 | printf ("%s (GNU Emacs %s)\n", "b2m", VERSION); | ||
| 126 | puts ("b2m is in the public domain."); | ||
| 127 | exit (EXIT_SUCCESS); | ||
| 128 | |||
| 129 | case 'h': | ||
| 130 | fprintf (stderr, "Usage: %s <babylmailbox >unixmailbox\n", progname); | ||
| 131 | exit (EXIT_SUCCESS); | ||
| 132 | } | ||
| 133 | } | ||
| 134 | |||
| 135 | if (optind != argc) | ||
| 136 | { | ||
| 137 | fprintf (stderr, "Usage: %s <babylmailbox >unixmailbox\n", progname); | ||
| 138 | exit (EXIT_SUCCESS); | ||
| 139 | } | ||
| 140 | |||
| 141 | labels_saved = printing = header = last_was_blank_line = FALSE; | ||
| 142 | first = TRUE; | ||
| 143 | ltoday = time (0); | ||
| 144 | /* Convert to a string, checking for out-of-range time stamps. | ||
| 145 | Don't use 'ctime', as that might dump core if the hardware clock | ||
| 146 | is set to a bizarre value. */ | ||
| 147 | tm = localtime (<oday); | ||
| 148 | if (! (tm && TM_YEAR_IN_ASCTIME_RANGE (tm->tm_year) | ||
| 149 | && (today = asctime (tm)))) | ||
| 150 | fatal ("current time is out of range"); | ||
| 151 | data.size = 200; | ||
| 152 | data.buffer = xnew (200, char); | ||
| 153 | |||
| 154 | if (readline (&data, stdin) == 0 | ||
| 155 | || !strneq (data.buffer, "BABYL OPTIONS:", 14)) | ||
| 156 | fatal ("standard input is not a Babyl mailfile."); | ||
| 157 | |||
| 158 | while (readline (&data, stdin) > 0) | ||
| 159 | { | ||
| 160 | if (streq (data.buffer, "*** EOOH ***") && !printing) | ||
| 161 | { | ||
| 162 | printing = header = TRUE; | ||
| 163 | printf ("From \"Babyl to mail by %s\" %s", progname, today); | ||
| 164 | continue; | ||
| 165 | } | ||
| 166 | |||
| 167 | if (data.buffer[0] == '\037') | ||
| 168 | { | ||
| 169 | if (data.buffer[1] == '\0') | ||
| 170 | continue; | ||
| 171 | else if (data.buffer[1] == '\f') | ||
| 172 | { | ||
| 173 | static char babyl[] = "X-Babyl-Labels: "; | ||
| 174 | if (first) | ||
| 175 | first = FALSE; | ||
| 176 | else if (! last_was_blank_line) | ||
| 177 | puts(""); | ||
| 178 | /* Save labels. */ | ||
| 179 | readline (&data, stdin); | ||
| 180 | p = strtok (data.buffer, " ,\r\n\t"); | ||
| 181 | labels = babyl; | ||
| 182 | |||
| 183 | while ((p = strtok (NULL, " ,\r\n\t"))) | ||
| 184 | labels = concat (labels, p, ", "); | ||
| 185 | |||
| 186 | p = &labels[strlen (labels) - 2]; | ||
| 187 | if (*p == ',') | ||
| 188 | *p = '\0'; | ||
| 189 | printing = header = FALSE; | ||
| 190 | labels_saved = TRUE; | ||
| 191 | continue; | ||
| 192 | } | ||
| 193 | } | ||
| 194 | |||
| 195 | if ((data.buffer[0] == '\0') && header) | ||
| 196 | { | ||
| 197 | header = FALSE; | ||
| 198 | if (labels_saved) | ||
| 199 | puts (labels); | ||
| 200 | } | ||
| 201 | |||
| 202 | if (printing) | ||
| 203 | { | ||
| 204 | puts (data.buffer); | ||
| 205 | if (data.buffer[0] == '\0') | ||
| 206 | last_was_blank_line = TRUE; | ||
| 207 | else | ||
| 208 | last_was_blank_line = FALSE; | ||
| 209 | } | ||
| 210 | } | ||
| 211 | |||
| 212 | return EXIT_SUCCESS; | ||
| 213 | } | ||
| 214 | |||
| 215 | |||
| 216 | |||
| 217 | /* | ||
| 218 | * Return a newly-allocated string whose contents | ||
| 219 | * concatenate those of s1, s2, s3. | ||
| 220 | */ | ||
| 221 | char * | ||
| 222 | concat (const char *s1, const char *s2, const char *s3) | ||
| 223 | { | ||
| 224 | int len1 = strlen (s1), len2 = strlen (s2), len3 = strlen (s3); | ||
| 225 | char *result = xnew (len1 + len2 + len3 + 1, char); | ||
| 226 | |||
| 227 | strcpy (result, s1); | ||
| 228 | strcpy (result + len1, s2); | ||
| 229 | strcpy (result + len1 + len2, s3); | ||
| 230 | result[len1 + len2 + len3] = '\0'; | ||
| 231 | |||
| 232 | return result; | ||
| 233 | } | ||
| 234 | |||
| 235 | /* | ||
| 236 | * Read a line of text from `stream' into `linebuffer'. | ||
| 237 | * Return the number of characters read from `stream', | ||
| 238 | * which is the length of the line including the newline, if any. | ||
| 239 | */ | ||
| 240 | long | ||
| 241 | readline (struct linebuffer *linebuffer, register FILE *stream) | ||
| 242 | { | ||
| 243 | char *buffer = linebuffer->buffer; | ||
| 244 | register char *p = linebuffer->buffer; | ||
| 245 | register char *pend; | ||
| 246 | int chars_deleted; | ||
| 247 | |||
| 248 | pend = p + linebuffer->size; /* Separate to avoid 386/IX compiler bug. */ | ||
| 249 | |||
| 250 | while (1) | ||
| 251 | { | ||
| 252 | register int c = getc (stream); | ||
| 253 | if (p == pend) | ||
| 254 | { | ||
| 255 | linebuffer->size *= 2; | ||
| 256 | buffer = (char *) xrealloc (buffer, linebuffer->size); | ||
| 257 | p += buffer - linebuffer->buffer; | ||
| 258 | pend = buffer + linebuffer->size; | ||
| 259 | linebuffer->buffer = buffer; | ||
| 260 | } | ||
| 261 | if (c == EOF) | ||
| 262 | { | ||
| 263 | *p = '\0'; | ||
| 264 | chars_deleted = 0; | ||
| 265 | break; | ||
| 266 | } | ||
| 267 | if (c == '\n') | ||
| 268 | { | ||
| 269 | if (p > buffer && p[-1] == '\r') | ||
| 270 | { | ||
| 271 | *--p = '\0'; | ||
| 272 | chars_deleted = 2; | ||
| 273 | } | ||
| 274 | else | ||
| 275 | { | ||
| 276 | *p = '\0'; | ||
| 277 | chars_deleted = 1; | ||
| 278 | } | ||
| 279 | break; | ||
| 280 | } | ||
| 281 | *p++ = c; | ||
| 282 | } | ||
| 283 | |||
| 284 | return (p - buffer + chars_deleted); | ||
| 285 | } | ||
| 286 | |||
| 287 | /* | ||
| 288 | * Like malloc but get fatal error if memory is exhausted. | ||
| 289 | */ | ||
| 290 | long * | ||
| 291 | xmalloc (unsigned int size) | ||
| 292 | { | ||
| 293 | long *result = (long *) malloc (size); | ||
| 294 | if (result == NULL) | ||
| 295 | fatal ("virtual memory exhausted"); | ||
| 296 | return result; | ||
| 297 | } | ||
| 298 | |||
| 299 | long * | ||
| 300 | xrealloc (char *ptr, unsigned int size) | ||
| 301 | { | ||
| 302 | long *result = (long *) realloc (ptr, size); | ||
| 303 | if (result == NULL) | ||
| 304 | fatal ("virtual memory exhausted"); | ||
| 305 | return result; | ||
| 306 | } | ||
| 307 | |||
| 308 | void | ||
| 309 | fatal (const char *message) | ||
| 310 | { | ||
| 311 | fprintf (stderr, "%s: %s\n", progname, message); | ||
| 312 | exit (EXIT_FAILURE); | ||
| 313 | } | ||
| 314 | |||
| 315 | /* arch-tag: 5a3ad2af-a802-408f-83cc-e7cf5e98653e | ||
| 316 | (do not change this comment) */ | ||
| 317 | |||
| 318 | /* b2m.c ends here */ | ||
diff --git a/lib-src/b2m.pl b/lib-src/b2m.pl deleted file mode 100644 index d3c47f61545..00000000000 --- a/lib-src/b2m.pl +++ /dev/null | |||
| @@ -1,158 +0,0 @@ | |||
| 1 | #!/usr/bin/perl | ||
| 2 | |||
| 3 | # b2m.pl - Script to convert a Babyl file to an mbox file | ||
| 4 | |||
| 5 | # Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 | ||
| 6 | # Free Software Foundation, Inc. | ||
| 7 | |||
| 8 | # Maintainer: Jonathan Kamens <jik@kamens.brookline.ma.us> | ||
| 9 | |||
| 10 | # This program is free software: you can redistribute it and/or modify | ||
| 11 | # it under the terms of the GNU General Public License as published by | ||
| 12 | # the Free Software Foundation, either version 3 of the License, or | ||
| 13 | # (at your option) any later version. | ||
| 14 | |||
| 15 | # This program is distributed in the hope that it will be useful, | ||
| 16 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 17 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 18 | # GNU General Public License for more details. | ||
| 19 | |||
| 20 | # You should have received a copy of the GNU General Public License | ||
| 21 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 22 | |||
| 23 | |||
| 24 | # Requires CPAN modules: MailTools (for Mail::Address), TimeDate (for | ||
| 25 | # Date::Parse). | ||
| 26 | |||
| 27 | use warnings; | ||
| 28 | use strict; | ||
| 29 | use File::Basename; | ||
| 30 | use Getopt::Long; | ||
| 31 | use Mail::Address; | ||
| 32 | use Date::Parse; | ||
| 33 | |||
| 34 | my($whoami) = basename $0; | ||
| 35 | my($version) = '$Revision$'; | ||
| 36 | my($usage) = "Usage: $whoami [--help] [--version] [--[no]full-headers] [Babyl-file] | ||
| 37 | \tBy default, full headers are printed.\n"; | ||
| 38 | |||
| 39 | my($opt_help, $opt_version); | ||
| 40 | my($opt_full_headers) = 1; | ||
| 41 | |||
| 42 | die $usage if (! GetOptions( | ||
| 43 | 'help' => \$opt_help, | ||
| 44 | 'version' => \$opt_version, | ||
| 45 | 'full-headers!' => \$opt_full_headers, | ||
| 46 | )); | ||
| 47 | |||
| 48 | if ($opt_help) { | ||
| 49 | print $usage; | ||
| 50 | exit; | ||
| 51 | } | ||
| 52 | elsif ($opt_version) { | ||
| 53 | print "$whoami version: $version\n"; | ||
| 54 | exit; | ||
| 55 | } | ||
| 56 | |||
| 57 | die $usage if (@ARGV > 1); | ||
| 58 | |||
| 59 | $/ = "\n\037"; | ||
| 60 | |||
| 61 | if (<> !~ /^BABYL OPTIONS:/) { | ||
| 62 | die "$whoami: $ARGV is not a Babyl file\n$usage"; | ||
| 63 | } | ||
| 64 | |||
| 65 | while (<>) { | ||
| 66 | my($msg_num) = $. - 1; | ||
| 67 | my($labels, $pruned, $full_header, $header); | ||
| 68 | my($from_line, $from_addr); | ||
| 69 | my($time); | ||
| 70 | |||
| 71 | # This will strip the initial form feed, any whitespace that may | ||
| 72 | # be following it, and then a newline | ||
| 73 | s/^\s+//; | ||
| 74 | # This will strip the ^_ off of the end of the message | ||
| 75 | s/\037$//; | ||
| 76 | |||
| 77 | if (! s/(.*)\n//) { | ||
| 78 | malformatted: | ||
| 79 | warn "$whoami: message $msg_num in $ARGV is malformatted\n"; | ||
| 80 | next; | ||
| 81 | } | ||
| 82 | $labels = $1; | ||
| 83 | |||
| 84 | # Strip the integer indicating whether the header is pruned | ||
| 85 | $labels =~ s/^(\d+)[,\s]*//; | ||
| 86 | $pruned = $1; | ||
| 87 | |||
| 88 | s/(?:((?:.+\n)+)\n*)?\*\*\* EOOH \*\*\*\n+// || goto malformatted; | ||
| 89 | $full_header = $1; | ||
| 90 | |||
| 91 | if (s/((?:.+\n)+)\n+//) { | ||
| 92 | $header = $1; | ||
| 93 | } | ||
| 94 | else { | ||
| 95 | # Message has no body | ||
| 96 | $header = $_; | ||
| 97 | $_ = ''; | ||
| 98 | } | ||
| 99 | |||
| 100 | # "$pruned eq '0'" is different from "! $pruned". We want to make | ||
| 101 | # sure that we found a valid label line which explicitly indicated | ||
| 102 | # that the header was not pruned. | ||
| 103 | if ((! $full_header) || ($pruned eq '0')) { | ||
| 104 | $full_header = $header; | ||
| 105 | } | ||
| 106 | |||
| 107 | # End message with two newlines (some mbox parsers require a blank | ||
| 108 | # line before the next "From " line). | ||
| 109 | s/\s+$/\n\n/; | ||
| 110 | |||
| 111 | # Quote "^From " | ||
| 112 | s/(^|\n)From /$1>From /g; | ||
| 113 | |||
| 114 | # Strip extra commas and whitespace from the end | ||
| 115 | $labels =~ s/[,\s]+$//; | ||
| 116 | # Now collapse extra commas and whitespace in the remaining label string | ||
| 117 | $labels =~ s/[,\s]+/, /g; | ||
| 118 | |||
| 119 | foreach my $rmail_header qw(summary-line x-coding-system) { | ||
| 120 | $full_header =~ s/(^|\n)$rmail_header:.*\n/$1/i; | ||
| 121 | } | ||
| 122 | |||
| 123 | if ($full_header =~ s/(^|\n)mail-from:\s*(From .*)\n/$1/i) { | ||
| 124 | ($from_line = $2) =~ s/\s*$/\n/; | ||
| 125 | } | ||
| 126 | else { | ||
| 127 | foreach my $addr_header qw(return-path from really-from sender) { | ||
| 128 | if ($full_header =~ /(?:^|\n)$addr_header:\s*(.*\n(?:\B.*\n)*)/i) { | ||
| 129 | my($addr) = Mail::Address->parse($1); | ||
| 130 | $from_addr = $addr->address($addr); | ||
| 131 | last; | ||
| 132 | } | ||
| 133 | } | ||
| 134 | |||
| 135 | if (! $from_addr) { | ||
| 136 | $from_addr = "Babyl_to_mail_by_$whoami\@localhost"; | ||
| 137 | } | ||
| 138 | |||
| 139 | if ($full_header =~ /(?:^|\n)date:\s*(\S.*\S)/i) { | ||
| 140 | $time = str2time($1); | ||
| 141 | } | ||
| 142 | |||
| 143 | if (! $time) { | ||
| 144 | # No Date header or we failed to parse it | ||
| 145 | $time = time; | ||
| 146 | } | ||
| 147 | |||
| 148 | $from_line = "From " . $from_addr . " " . localtime($time) . "\n"; | ||
| 149 | } | ||
| 150 | |||
| 151 | print($from_line, ($opt_full_headers ? $full_header : $header), | ||
| 152 | ($labels ? "X-Babyl-Labels: $labels\n" : ""), "\n", | ||
| 153 | $_) || die "$whoami: error writing to stdout: $!\n"; | ||
| 154 | } | ||
| 155 | |||
| 156 | close(STDOUT) || die "$whoami: Error closing stdout: $!\n"; | ||
| 157 | |||
| 158 | # arch-tag: 8c7c8ab0-721c-46d7-ba3e-139801240aa8 | ||
diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c index 1f96c481129..b60b2661805 100644 --- a/lib-src/emacsclient.c +++ b/lib-src/emacsclient.c | |||
| @@ -39,6 +39,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 39 | # define CLOSE_SOCKET closesocket | 39 | # define CLOSE_SOCKET closesocket |
| 40 | # define INITIALIZE() (initialize_sockets ()) | 40 | # define INITIALIZE() (initialize_sockets ()) |
| 41 | 41 | ||
| 42 | char *w32_getenv (char *); | ||
| 43 | #define egetenv(VAR) w32_getenv(VAR) | ||
| 44 | |||
| 42 | #else /* !WINDOWSNT */ | 45 | #else /* !WINDOWSNT */ |
| 43 | 46 | ||
| 44 | # include "syswait.h" | 47 | # include "syswait.h" |
| @@ -62,6 +65,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 62 | # define WCONTINUED 8 | 65 | # define WCONTINUED 8 |
| 63 | # endif | 66 | # endif |
| 64 | 67 | ||
| 68 | #define egetenv(VAR) getenv(VAR) | ||
| 69 | |||
| 65 | #endif /* !WINDOWSNT */ | 70 | #endif /* !WINDOWSNT */ |
| 66 | 71 | ||
| 67 | #undef signal | 72 | #undef signal |
| @@ -86,13 +91,6 @@ char *getenv (const char *), *getwd (char *); | |||
| 86 | char *(getcwd) (char *, size_t); | 91 | char *(getcwd) (char *, size_t); |
| 87 | #endif | 92 | #endif |
| 88 | 93 | ||
| 89 | #ifdef WINDOWSNT | ||
| 90 | char *w32_getenv (char *); | ||
| 91 | #define egetenv(VAR) w32_getenv(VAR) | ||
| 92 | #else | ||
| 93 | #define egetenv(VAR) getenv(VAR) | ||
| 94 | #endif | ||
| 95 | |||
| 96 | #ifndef VERSION | 94 | #ifndef VERSION |
| 97 | #define VERSION "unspecified" | 95 | #define VERSION "unspecified" |
| 98 | #endif | 96 | #endif |
| @@ -119,7 +117,7 @@ char *w32_getenv (char *); | |||
| 119 | 117 | ||
| 120 | 118 | ||
| 121 | /* Name used to invoke this program. */ | 119 | /* Name used to invoke this program. */ |
| 122 | char *progname; | 120 | const char *progname; |
| 123 | 121 | ||
| 124 | /* The second argument to main. */ | 122 | /* The second argument to main. */ |
| 125 | char **main_argv; | 123 | char **main_argv; |
| @@ -752,7 +750,7 @@ send_to_emacs (HSOCKET s, const char *data) | |||
| 752 | { | 750 | { |
| 753 | while (data) | 751 | while (data) |
| 754 | { | 752 | { |
| 755 | int dlen = strlen (data); | 753 | size_t dlen = strlen (data); |
| 756 | if (dlen + sblen >= SEND_BUFFER_SIZE) | 754 | if (dlen + sblen >= SEND_BUFFER_SIZE) |
| 757 | { | 755 | { |
| 758 | int part = SEND_BUFFER_SIZE - sblen; | 756 | int part = SEND_BUFFER_SIZE - sblen; |
| @@ -910,14 +908,13 @@ initialize_sockets (void) | |||
| 910 | 908 | ||
| 911 | /* | 909 | /* |
| 912 | * Read the information needed to set up a TCP comm channel with | 910 | * Read the information needed to set up a TCP comm channel with |
| 913 | * the Emacs server: host, port, pid and authentication string. | 911 | * the Emacs server: host, port, and authentication string. |
| 914 | */ | 912 | */ |
| 915 | int | 913 | int |
| 916 | get_server_config (struct sockaddr_in *server, char *authentication) | 914 | get_server_config (struct sockaddr_in *server, char *authentication) |
| 917 | { | 915 | { |
| 918 | char dotted[32]; | 916 | char dotted[32]; |
| 919 | char *port; | 917 | char *port; |
| 920 | char *pid; | ||
| 921 | FILE *config = NULL; | 918 | FILE *config = NULL; |
| 922 | 919 | ||
| 923 | if (file_name_absolute_p (server_file)) | 920 | if (file_name_absolute_p (server_file)) |
| @@ -948,12 +945,8 @@ get_server_config (struct sockaddr_in *server, char *authentication) | |||
| 948 | return FALSE; | 945 | return FALSE; |
| 949 | 946 | ||
| 950 | if (fgets (dotted, sizeof dotted, config) | 947 | if (fgets (dotted, sizeof dotted, config) |
| 951 | && (port = strchr (dotted, ':')) | 948 | && (port = strchr (dotted, ':'))) |
| 952 | && (pid = strchr (port, ' '))) | 949 | *port++ = '\0'; |
| 953 | { | ||
| 954 | *port++ = '\0'; | ||
| 955 | *pid++ = '\0'; | ||
| 956 | } | ||
| 957 | else | 950 | else |
| 958 | { | 951 | { |
| 959 | message (TRUE, "%s: invalid configuration info\n", progname); | 952 | message (TRUE, "%s: invalid configuration info\n", progname); |
| @@ -972,8 +965,6 @@ get_server_config (struct sockaddr_in *server, char *authentication) | |||
| 972 | 965 | ||
| 973 | fclose (config); | 966 | fclose (config); |
| 974 | 967 | ||
| 975 | emacs_pid = atoi (pid); | ||
| 976 | |||
| 977 | return TRUE; | 968 | return TRUE; |
| 978 | } | 969 | } |
| 979 | 970 | ||
| @@ -1232,7 +1223,18 @@ set_local_socket (void) | |||
| 1232 | { | 1223 | { |
| 1233 | tmpdir = egetenv ("TMPDIR"); | 1224 | tmpdir = egetenv ("TMPDIR"); |
| 1234 | if (!tmpdir) | 1225 | if (!tmpdir) |
| 1235 | tmpdir = "/tmp"; | 1226 | { |
| 1227 | #ifdef DARWIN_OS | ||
| 1228 | size_t n = confstr (_CS_DARWIN_USER_TEMP_DIR, NULL, (size_t) 0); | ||
| 1229 | if (n > 0) | ||
| 1230 | { | ||
| 1231 | tmpdir = alloca (n); | ||
| 1232 | confstr (_CS_DARWIN_USER_TEMP_DIR, tmpdir, n); | ||
| 1233 | } | ||
| 1234 | else | ||
| 1235 | #endif | ||
| 1236 | tmpdir = "/tmp"; | ||
| 1237 | } | ||
| 1236 | socket_name = alloca (strlen (tmpdir) + strlen (server_name) | 1238 | socket_name = alloca (strlen (tmpdir) + strlen (server_name) |
| 1237 | + EXTRA_SPACE); | 1239 | + EXTRA_SPACE); |
| 1238 | sprintf (socket_name, "%s/emacs%d/%s", | 1240 | sprintf (socket_name, "%s/emacs%d/%s", |
| @@ -1506,6 +1508,7 @@ main (int argc, char **argv) | |||
| 1506 | char *cwd, *str; | 1508 | char *cwd, *str; |
| 1507 | char string[BUFSIZ+1]; | 1509 | char string[BUFSIZ+1]; |
| 1508 | int null_socket_name, null_server_file, start_daemon_if_needed; | 1510 | int null_socket_name, null_server_file, start_daemon_if_needed; |
| 1511 | int exit_status = EXIT_SUCCESS; | ||
| 1509 | 1512 | ||
| 1510 | main_argv = argv; | 1513 | main_argv = argv; |
| 1511 | progname = argv[0]; | 1514 | progname = argv[0]; |
| @@ -1705,7 +1708,8 @@ main (int argc, char **argv) | |||
| 1705 | fsync (1); | 1708 | fsync (1); |
| 1706 | 1709 | ||
| 1707 | /* Now, wait for an answer and print any messages. */ | 1710 | /* Now, wait for an answer and print any messages. */ |
| 1708 | while ((rl = recv (emacs_socket, string, BUFSIZ, 0)) > 0) | 1711 | while (exit_status == EXIT_SUCCESS |
| 1712 | && (rl = recv (emacs_socket, string, BUFSIZ, 0)) > 0) | ||
| 1709 | { | 1713 | { |
| 1710 | char *p; | 1714 | char *p; |
| 1711 | string[rl] = '\0'; | 1715 | string[rl] = '\0'; |
| @@ -1744,6 +1748,7 @@ main (int argc, char **argv) | |||
| 1744 | printf ("\n"); | 1748 | printf ("\n"); |
| 1745 | fprintf (stderr, "*ERROR*: %s", str); | 1749 | fprintf (stderr, "*ERROR*: %s", str); |
| 1746 | needlf = str[0] == '\0' ? needlf : str[strlen (str) - 1] != '\n'; | 1750 | needlf = str[0] == '\0' ? needlf : str[strlen (str) - 1] != '\n'; |
| 1751 | exit_status = EXIT_FAILURE; | ||
| 1747 | } | 1752 | } |
| 1748 | #ifdef SIGSTOP | 1753 | #ifdef SIGSTOP |
| 1749 | else if (strprefix ("-suspend ", string)) | 1754 | else if (strprefix ("-suspend ", string)) |
| @@ -1761,7 +1766,8 @@ main (int argc, char **argv) | |||
| 1761 | if (needlf) | 1766 | if (needlf) |
| 1762 | printf ("\n"); | 1767 | printf ("\n"); |
| 1763 | printf ("*ERROR*: Unknown message: %s", string); | 1768 | printf ("*ERROR*: Unknown message: %s", string); |
| 1764 | needlf = string[0] == '\0' ? needlf : string[strlen (string) - 1] != '\n'; | 1769 | needlf = string[0] |
| 1770 | == '\0' ? needlf : string[strlen (string) - 1] != '\n'; | ||
| 1765 | } | 1771 | } |
| 1766 | } | 1772 | } |
| 1767 | 1773 | ||
| @@ -1770,8 +1776,11 @@ main (int argc, char **argv) | |||
| 1770 | fflush (stdout); | 1776 | fflush (stdout); |
| 1771 | fsync (1); | 1777 | fsync (1); |
| 1772 | 1778 | ||
| 1779 | if (rl < 0) | ||
| 1780 | exit_status = EXIT_FAILURE; | ||
| 1781 | |||
| 1773 | CLOSE_SOCKET (emacs_socket); | 1782 | CLOSE_SOCKET (emacs_socket); |
| 1774 | return EXIT_SUCCESS; | 1783 | return exit_status; |
| 1775 | } | 1784 | } |
| 1776 | 1785 | ||
| 1777 | #endif /* HAVE_SOCKETS && HAVE_INET_SOCKETS */ | 1786 | #endif /* HAVE_SOCKETS && HAVE_INET_SOCKETS */ |
diff --git a/lib-src/make-docfile.c b/lib-src/make-docfile.c index 4824731672b..e2dc99214d2 100644 --- a/lib-src/make-docfile.c +++ b/lib-src/make-docfile.c | |||
| @@ -204,7 +204,8 @@ put_filename (char *filename) | |||
| 204 | int | 204 | int |
| 205 | scan_file (char *filename) | 205 | scan_file (char *filename) |
| 206 | { | 206 | { |
| 207 | int len = strlen (filename); | 207 | |
| 208 | size_t len = strlen (filename); | ||
| 208 | 209 | ||
| 209 | put_filename (filename); | 210 | put_filename (filename); |
| 210 | if (len > 4 && !strcmp (filename + len - 4, ".elc")) | 211 | if (len > 4 && !strcmp (filename + len - 4, ".elc")) |
| @@ -442,7 +443,7 @@ write_c_args (FILE *out, char *func, char *buf, int minargs, int maxargs) | |||
| 442 | register char *p; | 443 | register char *p; |
| 443 | int in_ident = 0; | 444 | int in_ident = 0; |
| 444 | char *ident_start; | 445 | char *ident_start; |
| 445 | int ident_length = 0; | 446 | size_t ident_length = 0; |
| 446 | 447 | ||
| 447 | fprintf (out, "(fn"); | 448 | fprintf (out, "(fn"); |
| 448 | 449 | ||
diff --git a/lib-src/makefile.w32-in b/lib-src/makefile.w32-in index 552dd1349fc..25fb499cf3b 100644 --- a/lib-src/makefile.w32-in +++ b/lib-src/makefile.w32-in | |||
| @@ -378,6 +378,11 @@ cleanall: clean | |||
| 378 | getopt.h: getopt_.h | 378 | getopt.h: getopt_.h |
| 379 | $(CP) $(ALL_DEPS) $@ | 379 | $(CP) $(ALL_DEPS) $@ |
| 380 | 380 | ||
| 381 | ### TAGS ### | ||
| 382 | |||
| 383 | TAGS: $(BLD)/etags.exe *.c *.h | ||
| 384 | $(BLD)/etags.exe *.c *.h | ||
| 385 | |||
| 381 | ### DEPENDENCIES ### | 386 | ### DEPENDENCIES ### |
| 382 | 387 | ||
| 383 | EMACS_ROOT = .. | 388 | EMACS_ROOT = .. |
| @@ -390,12 +395,6 @@ $(BLD)/alloca.$(O) : \ | |||
| 390 | $(EMACS_ROOT)/src/config.h \ | 395 | $(EMACS_ROOT)/src/config.h \ |
| 391 | $(EMACS_ROOT)/src/blockinput.h | 396 | $(EMACS_ROOT)/src/blockinput.h |
| 392 | 397 | ||
| 393 | $(BLD)/b2m.$(O) : \ | ||
| 394 | $(SRC)/b2m.c \ | ||
| 395 | $(EMACS_ROOT)/src/s/ms-w32.h \ | ||
| 396 | $(EMACS_ROOT)/src/m/intel386.h \ | ||
| 397 | $(EMACS_ROOT)/lib-src/../src/config.h | ||
| 398 | |||
| 399 | $(BLD)/ctags.$(O) : \ | 398 | $(BLD)/ctags.$(O) : \ |
| 400 | $(SRC)/ctags.c \ | 399 | $(SRC)/ctags.c \ |
| 401 | $(EMACS_ROOT)/nt/inc/sys/param.h \ | 400 | $(EMACS_ROOT)/nt/inc/sys/param.h \ |
diff --git a/lib-src/movemail.c b/lib-src/movemail.c index 4ccdc93688c..f300942427e 100644 --- a/lib-src/movemail.c +++ b/lib-src/movemail.c | |||
| @@ -169,7 +169,7 @@ main (int argc, char **argv) | |||
| 169 | { | 169 | { |
| 170 | char *inname, *outname; | 170 | char *inname, *outname; |
| 171 | int indesc, outdesc; | 171 | int indesc, outdesc; |
| 172 | int nread; | 172 | ssize_t nread; |
| 173 | int status; | 173 | int status; |
| 174 | int c, preserve_mail = 0; | 174 | int c, preserve_mail = 0; |
| 175 | 175 | ||
| @@ -551,8 +551,7 @@ main (int argc, char **argv) | |||
| 551 | string-comparing the two paths, because one or both of them might | 551 | string-comparing the two paths, because one or both of them might |
| 552 | be symbolic links pointing to some other directory. */ | 552 | be symbolic links pointing to some other directory. */ |
| 553 | static char * | 553 | static char * |
| 554 | mail_spool_name (inname) | 554 | mail_spool_name (char *inname) |
| 555 | char *inname; | ||
| 556 | { | 555 | { |
| 557 | struct stat stat1, stat2; | 556 | struct stat stat1, stat2; |
| 558 | char *indir, *fname; | 557 | char *indir, *fname; |
| @@ -632,7 +631,7 @@ pfatal_and_delete (char *name) | |||
| 632 | static char * | 631 | static char * |
| 633 | concat (const char *s1, const char *s2, const char *s3) | 632 | concat (const char *s1, const char *s2, const char *s3) |
| 634 | { | 633 | { |
| 635 | int len1 = strlen (s1), len2 = strlen (s2), len3 = strlen (s3); | 634 | size_t len1 = strlen (s1), len2 = strlen (s2), len3 = strlen (s3); |
| 636 | char *result = (char *) xmalloc (len1 + len2 + len3 + 1); | 635 | char *result = (char *) xmalloc (len1 + len2 + len3 + 1); |
| 637 | 636 | ||
| 638 | strcpy (result, s1); | 637 | strcpy (result, s1); |
diff --git a/lib-src/sorted-doc.c b/lib-src/sorted-doc.c index db3f3029532..4fe830e4013 100644 --- a/lib-src/sorted-doc.c +++ b/lib-src/sorted-doc.c | |||
| @@ -93,7 +93,7 @@ xmalloc (int size) | |||
| 93 | } | 93 | } |
| 94 | 94 | ||
| 95 | char * | 95 | char * |
| 96 | xstrdup (char *str) | 96 | xstrdup (const char *str) |
| 97 | { | 97 | { |
| 98 | char *buf = xmalloc (strlen (str) + 1); | 98 | char *buf = xmalloc (strlen (str) + 1); |
| 99 | (void) strcpy (buf, str); | 99 | (void) strcpy (buf, str); |
diff --git a/lib-src/test-distrib.c b/lib-src/test-distrib.c index 880bd115882..1487c2bab57 100644 --- a/lib-src/test-distrib.c +++ b/lib-src/test-distrib.c | |||
| @@ -52,9 +52,10 @@ char buf[300]; | |||
| 52 | 52 | ||
| 53 | /* Like `read' but keeps trying until it gets SIZE bytes or reaches eof. */ | 53 | /* Like `read' but keeps trying until it gets SIZE bytes or reaches eof. */ |
| 54 | int | 54 | int |
| 55 | cool_read (int fd, char *buf, int size) | 55 | cool_read (int fd, char *buf, size_t size) |
| 56 | { | 56 | { |
| 57 | int num, sofar = 0; | 57 | ssize_t num; |
| 58 | size_t sofar = 0; | ||
| 58 | 59 | ||
| 59 | while (1) | 60 | while (1) |
| 60 | { | 61 | { |