Mercurial > emacs
comparison lib-src/movemail.c @ 5524:f14a0fe979d9
(get_errmsg, pfatal_with_name, pfatal_and_delete): Call strerror instead of
using sys_errlist.
author | Roland McGrath <roland@gnu.org> |
---|---|
date | Sat, 08 Jan 1994 21:50:14 +0000 |
parents | 726a3dc867a6 |
children | 9c86c71e879d |
comparison
equal
deleted
inserted
replaced
5523:84fcbbd80e3d | 5524:f14a0fe979d9 |
---|---|
1 /* movemail foo bar -- move file foo to file bar, | 1 /* movemail foo bar -- move file foo to file bar, |
2 locking file foo the way /bin/mail respects. | 2 locking file foo the way /bin/mail respects. |
3 Copyright (C) 1986, 1992, 1993 Free Software Foundation, Inc. | 3 Copyright (C) 1986, 1992, 1993, 1994 Free Software Foundation, Inc. |
4 | 4 |
5 This file is part of GNU Emacs. | 5 This file is part of GNU Emacs. |
6 | 6 |
7 GNU Emacs is free software; you can redistribute it and/or modify | 7 GNU Emacs is free software; you can redistribute it and/or modify |
8 it under the terms of the GNU General Public License as published by | 8 it under the terms of the GNU General Public License as published by |
9 the Free Software Foundation; either version 1, or (at your option) | 9 the Free Software Foundation; either version 2, or (at your option) |
10 any later version. | 10 any later version. |
11 | 11 |
12 GNU Emacs is distributed in the hope that it will be useful, | 12 GNU Emacs is distributed in the hope that it will be useful, |
13 but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
349 } | 349 } |
350 | 350 |
351 pfatal_with_name (name) | 351 pfatal_with_name (name) |
352 char *name; | 352 char *name; |
353 { | 353 { |
354 extern int errno, sys_nerr; | 354 extern int errno; |
355 extern char *sys_errlist[]; | 355 extern char *strerror (); |
356 char *s; | 356 char *s; |
357 | 357 |
358 if (errno < sys_nerr) | 358 s = concat ("", strerror (errno), " for %s"); |
359 s = concat ("", sys_errlist[errno], " for %s"); | |
360 else | |
361 s = "cannot open %s"; | |
362 fatal (s, name); | 359 fatal (s, name); |
363 } | 360 } |
364 | 361 |
365 pfatal_and_delete (name) | 362 pfatal_and_delete (name) |
366 char *name; | 363 char *name; |
367 { | 364 { |
368 extern int errno, sys_nerr; | 365 extern int errno; |
369 extern char *sys_errlist[]; | 366 extern char *strerror (); |
370 char *s; | 367 char *s; |
371 | 368 |
372 if (errno < sys_nerr) | 369 s = concat ("", strerror (errno), " for %s"); |
373 s = concat ("", sys_errlist[errno], " for %s"); | |
374 else | |
375 s = "cannot open %s"; | |
376 | |
377 unlink (name); | 370 unlink (name); |
378 fatal (s, name); | 371 fatal (s, name); |
379 } | 372 } |
380 | 373 |
381 /* Return a newly-allocated string whose contents concatenate those of s1, s2, s3. */ | 374 /* Return a newly-allocated string whose contents concatenate those of s1, s2, s3. */ |
733 } | 726 } |
734 | 727 |
735 char * | 728 char * |
736 get_errmsg () | 729 get_errmsg () |
737 { | 730 { |
738 extern int errno, sys_nerr; | 731 extern int errno; |
739 extern char *sys_errlist[]; | 732 extern char *strerror (); |
740 char *s; | 733 return strerror (errno); |
741 | |
742 if (errno < sys_nerr) | |
743 s = sys_errlist[errno]; | |
744 else | |
745 s = "unknown error"; | |
746 return (s); | |
747 } | 734 } |
748 | 735 |
749 putline (buf, err, f) | 736 putline (buf, err, f) |
750 char *buf; | 737 char *buf; |
751 char *err; | 738 char *err; |