From owner-p4-projects@FreeBSD.ORG Tue Jun 16 06:05:22 2009 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 559B8106566B; Tue, 16 Jun 2009 06:05:22 +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 152D11065672 for ; Tue, 16 Jun 2009 06:05:22 +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 033898FC1D for ; Tue, 16 Jun 2009 06:05:22 +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 n5G65LpE098546 for ; Tue, 16 Jun 2009 06:05:21 GMT (envelope-from dforsyth@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id n5G65L6s098544 for perforce@freebsd.org; Tue, 16 Jun 2009 06:05:21 GMT (envelope-from dforsyth@FreeBSD.org) Date: Tue, 16 Jun 2009 06:05:21 GMT Message-Id: <200906160605.n5G65L6s098544@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 164482 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, 16 Jun 2009 06:05:23 -0000 http://perforce.freebsd.org/chv.cgi?CH=164482 Change 164482 by dforsyth@squirrel on 2009/06/16 06:04:24 Plist parse is working again (atleast the parts of it that are done). Affected files ... .. //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkg.c#19 edit .. //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkg_plist.c#11 edit .. //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkgdb_hierdb_pkgdb_sub.c#7 edit Differences ... ==== //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkg.c#19 (text+ko) ==== @@ -70,13 +70,21 @@ int pkg_set_comment(struct pkg *p, const char *comment) { + int c; + char *f; + if (p == NULL) arg_rage_quit(__func__, "Not a valid package.", RAGE_AT_CLIENT); - if (comment != NULL) + p->comment = NULL; + if (comment != NULL) { p->comment = strdup(comment); - else - p->comment = NULL; + /* Blot out trailing \n */ + c = (int)'\n'; + f = strrchr(p->comment, c); + if (f != NULL) + *f = '\0'; + } return (OK); } @@ -89,10 +97,13 @@ if (p == NULL) arg_rage_quit(__func__, "Not a valid package.", RAGE_AT_CLIENT); + /* if (contents != NULL) p->contents = strdup(contents); else p->contents = NULL; + */ + p->contents = contents; return (OK); } @@ -235,9 +246,6 @@ if (p == NULL) arg_rage_quit(__func__, "Not a valid package.", RAGE_AT_CLIENT); - - if (pf == NULL) - arg_rage_quit(__func__, "Not a valid package file.", RAGE_AT_CLIENT); pf = pkg_plist_pkg_file_list_next(&p->plist); @@ -264,7 +272,7 @@ * called on pkgs that are not explicitly created by the client. */ void -pkg_free(struct pkg *p) +pkg_delete(struct pkg *p) { if (p == NULL) arg_rage_quit(__func__, "Not a valid package.", RAGE_AT_CLIENT); ==== //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkg_plist.c#11 (text+ko) ==== @@ -86,11 +86,12 @@ /* This function will parse text and create a pkg_plist */ if (text == NULL) return (NOT_OK); - + + /* pl = pkg_plist_new(); if (pl == NULL) return (MEMORY_ERR); - + */ /* Not sure if this is how I still want to do this, but for now, hold * a copy of the text. */ textp = strdup(text); @@ -115,11 +116,13 @@ * easier to deal with different types of data. */ /* Consider a dirty flag for these lists? */ +#if 0 if (s != 0) { /* bad parse. */ /* free a bunch of stuff. */ return (NOT_OK); } +#endif textp = p + 1; } } @@ -280,7 +283,7 @@ { if (pl == NULL) return (NULL); - + return (pl->name); } ==== //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkgdb_hierdb_pkgdb_sub.c#7 (text+ko) ==== @@ -106,7 +106,7 @@ free(text); return (SUB_NO_FILE); /* Could be a lie, maybe check errno? */ } - text[sb.st_size] = '\0'; + text[sb.st_size] = '\0'; /* This is dumb. But I forgot how computers work and wrote this * function like a moron. So I'm stuck with it until I feel like