Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/libexec/rmail asprintf is easier



details:   https://anonhg.NetBSD.org/src/rev/e14c98fee2a8
branches:  trunk
changeset: 549384:e14c98fee2a8
user:      itojun <itojun%NetBSD.org@localhost>
date:      Sun Jul 13 12:00:55 2003 +0000

description:
asprintf is easier

diffstat:

 libexec/rmail/rmail.c |  7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diffs (29 lines):

diff -r 921aa238a5d3 -r e14c98fee2a8 libexec/rmail/rmail.c
--- a/libexec/rmail/rmail.c     Sun Jul 13 09:55:34 2003 +0000
+++ b/libexec/rmail/rmail.c     Sun Jul 13 12:00:55 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rmail.c,v 1.16 2003/04/05 17:45:11 perry Exp $ */
+/*     $NetBSD: rmail.c,v 1.17 2003/07/13 12:00:55 itojun Exp $        */
 
 /*
  * Copyright (c) 1988, 1993
@@ -40,7 +40,7 @@
 #if 0
 static char sccsid[] = "@(#)rmail.c    8.3 (Berkeley) 5/15/95";
 #else
-__RCSID("$NetBSD: rmail.c,v 1.16 2003/04/05 17:45:11 perry Exp $");
+__RCSID("$NetBSD: rmail.c,v 1.17 2003/07/13 12:00:55 itojun Exp $");
 #endif
 #endif /* not lint */
 
@@ -284,9 +284,8 @@
                if (strchr(*argv, ',') == NULL || strchr(*argv, '<') != NULL)
                        args[i++] = *argv;
                else {
-                       if ((args[i] = malloc(strlen(*argv) + 3)) == NULL)
+                       if (asprintf(&args[i++], "<%s>", *argv) < 0)
                                err(EX_TEMPFAIL, "Cannot malloc");
-                       sprintf (args [i++], "<%s>", *argv);
                }
                argv++;
        } 



Home | Main Index | Thread Index | Old Index