From owner-p4-projects@FreeBSD.ORG Tue Jun 2 05:38:58 2009 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 745F31065674; Tue, 2 Jun 2009 05:38:58 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 31567106564A for ; Tue, 2 Jun 2009 05:38:57 +0000 (UTC) (envelope-from dforsyth@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id DE9868FC12 for ; Tue, 2 Jun 2009 05:38:57 +0000 (UTC) (envelope-from dforsyth@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id n525cvTg042488 for ; Tue, 2 Jun 2009 05:38:57 GMT (envelope-from dforsyth@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id n525cvHG042484 for perforce@freebsd.org; Tue, 2 Jun 2009 05:38:57 GMT (envelope-from dforsyth@FreeBSD.org) Date: Tue, 2 Jun 2009 05:38:57 GMT Message-Id: <200906020538.n525cvHG042484@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to dforsyth@FreeBSD.org using -f From: David Forsythe To: Perforce Change Reviews Cc: Subject: PERFORCE change 163333 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Jun 2009 05:38:59 -0000 http://perforce.freebsd.org/chv.cgi?CH=163333 Change 163333 by dforsyth@squirrel on 2009/06/02 05:38:46 Blotted out the newline from read comments. pkg_info prints names and comments, though with poor formatting. Affected files ... .. //depot/projects/soc2009/dforsyth_libpkg/info/main.c#3 edit .. //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkg.c#4 edit .. //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkgdb.c#5 edit Differences ... ==== //depot/projects/soc2009/dforsyth_libpkg/info/main.c#3 (text+ko) ==== @@ -56,7 +56,7 @@ void usage(int exit_val) { - printf("If you don't know how to use me, then you shouldn't be...\n"); + fprintf(stderr, "%s", "If you don't know how to use me, then you shouldn't be...\n"); exit(exit_val); } ==== //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkg.c#4 (text+ko) ==== @@ -36,7 +36,8 @@ struct pkg * pkg_set_comment(struct pkg *p, const char *comment) { - int l; + int c; + char *f; if (p == NULL) return (p); @@ -52,6 +53,13 @@ /* Something bad happened... I should probably let people know * about it... */ } + + /* Blot out a trailing '\n'. */ + c = (int) '\n'; + f = strrchr(p->comment, c); + if (f != NULL) + *f = '\0'; + return (p); } ==== //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkgdb.c#5 (text+ko) ==== @@ -231,6 +231,7 @@ } /* reuse s */ s = read(fd, text, sb.st_size); + close(fd); if (s < 0) { free(text); return (NULL); @@ -247,6 +248,7 @@ pkgdb_pkg_list_init(struct pkgdb *db) { if (db == NULL) return; + TAILQ_INIT(&db->p_head); }