Date: Tue, 2 Jun 2009 05:38:57 GMT From: David Forsythe <dforsyth@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 163333 for review Message-ID: <200906020538.n525cvHG042484@repoman.freebsd.org>
index | next in thread | raw e-mail
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); }help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200906020538.n525cvHG042484>
