From owner-svn-soc-all@FreeBSD.ORG Sun Jul 14 10:28:36 2013 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 99B9A692 for ; Sun, 14 Jul 2013 10:28:36 +0000 (UTC) (envelope-from dpl@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) by mx1.freebsd.org (Postfix) with ESMTP id 8B4FDC4D for ; Sun, 14 Jul 2013 10:28:36 +0000 (UTC) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.14.7/8.14.7) with ESMTP id r6EASauD002983 for ; Sun, 14 Jul 2013 10:28:36 GMT (envelope-from dpl@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.14.7/8.14.6/Submit) id r6EASa1H002981 for svn-soc-all@FreeBSD.org; Sun, 14 Jul 2013 10:28:36 GMT (envelope-from dpl@FreeBSD.org) Date: Sun, 14 Jul 2013 10:28:36 GMT Message-Id: <201307141028.r6EASa1H002981@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to dpl@FreeBSD.org using -f From: dpl@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r254777 - soc2013/dpl/head/contrib/xz/src/xz MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Jul 2013 10:28:36 -0000 Author: dpl Date: Sun Jul 14 10:28:36 2013 New Revision: 254777 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=254777 Log: Changed to use file opener functions. Modified: soc2013/dpl/head/contrib/xz/src/xz/main.c Modified: soc2013/dpl/head/contrib/xz/src/xz/main.c ============================================================================== --- soc2013/dpl/head/contrib/xz/src/xz/main.c Sun Jul 14 07:58:10 2013 (r254776) +++ soc2013/dpl/head/contrib/xz/src/xz/main.c Sun Jul 14 10:28:36 2013 (r254777) @@ -207,10 +207,14 @@ if (opt_mode != MODE_LIST) signals_init(); + // Separate opening the files from list_file() and coder_run() + // We have to limit both functions with Capsicum. + file_pair * (*open)(const char **filename, int files) = opt_mode == MODE_LIST + ? &io_list_open : &io_coder_open; + // coder_run() handles compression, decompression, and testing. // list_file() is for --list. - // We have to limit both functions with Capsicum. - void (*run)(const char *filename) = opt_mode == MODE_LIST + void (*run)(const file_pair *pairs, int files) = opt_mode == MODE_LIST ? &list_file : &coder_run; // Process the files given on the command line. Note that if no names @@ -245,12 +249,12 @@ // handling the special case of stdin. args.arg_names[i] = (char *)stdin_filename; files++; - -/* // Do the actual compression/decompression.*/ -/* run(args.arg_names[i]);*/ } } + file_pair pairs[files] = open(args.arg_names, files); + cap_init(); + run(pairs, files); // If --files or --files0 was used, process the filenames from the // given file or stdin. Note that here we don't consider "-" to