diff options
| author | Paul Eggert | 2012-07-11 15:44:07 -0700 |
|---|---|---|
| committer | Paul Eggert | 2012-07-11 15:44:07 -0700 |
| commit | c214e35e489145bd3a8ab7a353671f947368a7ae (patch) | |
| tree | 89544a4e7b9a87d7fefe61f7e2ea53be31a2dbdb /lib-src | |
| parent | 63e47e0749c2e27f76a03167562e4204e2d555f0 (diff) | |
| download | emacs-c214e35e489145bd3a8ab7a353671f947368a7ae.tar.gz emacs-c214e35e489145bd3a8ab7a353671f947368a7ae.zip | |
Port 'movemail' again to Solaris and similar hosts.
See Susan Cragin's report in
<http://lists.gnu.org/archive/html/emacs-devel/2012-07/msg00199.html>.
* movemail.c (xmalloc): Also define if !DISABLE_DIRECT_ACCESS &&
!MAIL_USE_MMDF && !MAIL_USE_SYSTEM_LOCK. Move up, so it doesn't
need a forward declaration.
(main): Rewrite to avoid no-longer-present function 'concat', if
!DISABLE_DIRECT_ACCESS && !MAIL_USE_MMDF && !MAIL_USE_SYSTEM_LOCK.
Diffstat (limited to 'lib-src')
| -rw-r--r-- | lib-src/ChangeLog | 9 | ||||
| -rw-r--r-- | lib-src/movemail.c | 40 |
2 files changed, 30 insertions, 19 deletions
diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog index ce4afdfec1e..28f3403b369 100644 --- a/lib-src/ChangeLog +++ b/lib-src/ChangeLog | |||
| @@ -1,5 +1,14 @@ | |||
| 1 | 2012-07-11 Paul Eggert <eggert@cs.ucla.edu> | 1 | 2012-07-11 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 2 | ||
| 3 | Port 'movemail' again to Solaris and similar hosts. | ||
| 4 | See Susan Cragin's report in | ||
| 5 | <http://lists.gnu.org/archive/html/emacs-devel/2012-07/msg00199.html>. | ||
| 6 | * movemail.c (xmalloc): Also define if !DISABLE_DIRECT_ACCESS && | ||
| 7 | !MAIL_USE_MMDF && !MAIL_USE_SYSTEM_LOCK. Move up, so it doesn't | ||
| 8 | need a forward declaration. | ||
| 9 | (main): Rewrite to avoid no-longer-present function 'concat', if | ||
| 10 | !DISABLE_DIRECT_ACCESS && !MAIL_USE_MMDF && !MAIL_USE_SYSTEM_LOCK. | ||
| 11 | |||
| 3 | Assume strerror. | 12 | Assume strerror. |
| 4 | * emacsclient.c, movemail.c, update-game-score.c (strerror) | 13 | * emacsclient.c, movemail.c, update-game-score.c (strerror) |
| 5 | [!HAVE_STRERROR]: Remove. | 14 | [!HAVE_STRERROR]: Remove. |
diff --git a/lib-src/movemail.c b/lib-src/movemail.c index aa5fd989a6d..fb2111fd621 100644 --- a/lib-src/movemail.c +++ b/lib-src/movemail.c | |||
| @@ -137,9 +137,6 @@ static _Noreturn void fatal (const char *s1, const char *s2, const char *s3); | |||
| 137 | static void error (const char *s1, const char *s2, const char *s3); | 137 | static void error (const char *s1, const char *s2, const char *s3); |
| 138 | static _Noreturn void pfatal_with_name (char *name); | 138 | static _Noreturn void pfatal_with_name (char *name); |
| 139 | static _Noreturn void pfatal_and_delete (char *name); | 139 | static _Noreturn void pfatal_and_delete (char *name); |
| 140 | #ifdef MAIL_USE_MAILLOCK | ||
| 141 | static void *xmalloc (size_t size); | ||
| 142 | #endif | ||
| 143 | #ifdef MAIL_USE_POP | 140 | #ifdef MAIL_USE_POP |
| 144 | static int popmail (char *mailbox, char *outfile, int preserve, char *password, int reverse_order); | 141 | static int popmail (char *mailbox, char *outfile, int preserve, char *password, int reverse_order); |
| 145 | static int pop_retr (popserver server, int msgno, FILE *arg); | 142 | static int pop_retr (popserver server, int msgno, FILE *arg); |
| @@ -148,6 +145,21 @@ static int mbx_delimit_begin (FILE *mbf); | |||
| 148 | static int mbx_delimit_end (FILE *mbf); | 145 | static int mbx_delimit_end (FILE *mbf); |
| 149 | #endif | 146 | #endif |
| 150 | 147 | ||
| 148 | #if (MAIL_USE_MAILLOCK \ | ||
| 149 | || (!defined DISABLE_DIRECT_ACCESS && !defined MAIL_USE_MMDF \ | ||
| 150 | && !defined MAIL_USE_SYSTEM_LOCK)) | ||
| 151 | /* Like malloc but get fatal error if memory is exhausted. */ | ||
| 152 | |||
| 153 | static void * | ||
| 154 | xmalloc (size_t size) | ||
| 155 | { | ||
| 156 | void *result = malloc (size); | ||
| 157 | if (!result) | ||
| 158 | fatal ("virtual memory exhausted", 0, 0); | ||
| 159 | return result; | ||
| 160 | } | ||
| 161 | #endif | ||
| 162 | |||
| 151 | /* Nonzero means this is name of a lock file to delete on fatal error. */ | 163 | /* Nonzero means this is name of a lock file to delete on fatal error. */ |
| 152 | static char *delete_lockname; | 164 | static char *delete_lockname; |
| 153 | 165 | ||
| @@ -165,7 +177,7 @@ main (int argc, char **argv) | |||
| 165 | int tem; | 177 | int tem; |
| 166 | char *lockname; | 178 | char *lockname; |
| 167 | char *tempname; | 179 | char *tempname; |
| 168 | size_t inname_dirlen; | 180 | size_t inname_len, inname_dirlen; |
| 169 | int desc; | 181 | int desc; |
| 170 | #endif /* not MAIL_USE_SYSTEM_LOCK */ | 182 | #endif /* not MAIL_USE_SYSTEM_LOCK */ |
| 171 | 183 | ||
| @@ -293,8 +305,11 @@ main (int argc, char **argv) | |||
| 293 | should define MAIL_USE_SYSTEM_LOCK but does not, send a bug report | 305 | should define MAIL_USE_SYSTEM_LOCK but does not, send a bug report |
| 294 | to bug-gnu-emacs@prep.ai.mit.edu so we can fix it. */ | 306 | to bug-gnu-emacs@prep.ai.mit.edu so we can fix it. */ |
| 295 | 307 | ||
| 296 | lockname = concat (inname, ".lock", ""); | 308 | inname_len = strlen (inname); |
| 297 | for (inname_dirlen = strlen (inname); | 309 | lockname = xmalloc (inname_len + sizeof ".lock"); |
| 310 | strcpy (lockname, inname); | ||
| 311 | strcpy (lockname + inname_len, ".lock"); | ||
| 312 | for (inname_dirlen = inname_len; | ||
| 298 | inname_dirlen && !IS_DIRECTORY_SEP (inname[inname_dirlen - 1]); | 313 | inname_dirlen && !IS_DIRECTORY_SEP (inname[inname_dirlen - 1]); |
| 299 | inname_dirlen--) | 314 | inname_dirlen--) |
| 300 | continue; | 315 | continue; |
| @@ -640,19 +655,6 @@ pfatal_and_delete (char *name) | |||
| 640 | unlink (name); | 655 | unlink (name); |
| 641 | fatal ("%s for %s", s, name); | 656 | fatal ("%s for %s", s, name); |
| 642 | } | 657 | } |
| 643 | |||
| 644 | #ifdef MAIL_USE_MAILLOCK | ||
| 645 | /* Like malloc but get fatal error if memory is exhausted. */ | ||
| 646 | |||
| 647 | static void * | ||
| 648 | xmalloc (size_t size) | ||
| 649 | { | ||
| 650 | void *result = malloc (size); | ||
| 651 | if (!result) | ||
| 652 | fatal ("virtual memory exhausted", 0, 0); | ||
| 653 | return result; | ||
| 654 | } | ||
| 655 | #endif | ||
| 656 | 658 | ||
| 657 | /* This is the guts of the interface to the Post Office Protocol. */ | 659 | /* This is the guts of the interface to the Post Office Protocol. */ |
| 658 | 660 | ||