From owner-p4-projects@FreeBSD.ORG Wed May 26 21:15:38 2010 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id E2B6C1065673; Wed, 26 May 2010 21:15:37 +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 8EFA71065670 for ; Wed, 26 May 2010 21:15:37 +0000 (UTC) (envelope-from ivoras@FreeBSD.org) Received: from repoman.freebsd.org (unknown [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 3D5578FC0C for ; Wed, 26 May 2010 21:15:37 +0000 (UTC) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id o4QLFbCE019893 for ; Wed, 26 May 2010 21:15:37 GMT (envelope-from ivoras@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id o4QLFbRb019891 for perforce@freebsd.org; Wed, 26 May 2010 21:15:37 GMT (envelope-from ivoras@FreeBSD.org) Date: Wed, 26 May 2010 21:15:37 GMT Message-Id: <201005262115.o4QLFbRb019891@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to ivoras@FreeBSD.org using -f From: Ivan Voras To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 178837 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 May 2010 21:15:38 -0000 http://p4web.freebsd.org/@@178837?ac=10 Change 178837 by ivoras@betelgeuse on 2010/05/26 21:14:59 Skeleton for patch operations Affected files ... .. //depot/projects/soc2010/pkg_patch/src/patch/Makefile#3 edit .. //depot/projects/soc2010/pkg_patch/src/patch/hashjob.c#2 edit .. //depot/projects/soc2010/pkg_patch/src/patch/hashjob.h#2 edit .. //depot/projects/soc2010/pkg_patch/src/patch/main.c#3 edit .. //depot/projects/soc2010/pkg_patch/src/patch/mkpatch.c#1 add .. //depot/projects/soc2010/pkg_patch/src/patch/mkpatch.h#1 add .. //depot/projects/soc2010/pkg_patch/src/patch/pkg_patch.h#1 add Differences ... ==== //depot/projects/soc2010/pkg_patch/src/patch/Makefile#3 (text+ko) ==== @@ -3,11 +3,11 @@ .include PROG= pkg_patch -SRCS= main.c hashjob.c +SRCS= main.c mkpatch.c hashjob.c WARNS?= 4 WFORMAT?= 1 -LDADD= -lmd +LDADD= -lmd -pthread .include ==== //depot/projects/soc2010/pkg_patch/src/patch/hashjob.c#2 (text+ko) ==== ==== //depot/projects/soc2010/pkg_patch/src/patch/hashjob.h#2 (text+ko) ==== ==== //depot/projects/soc2010/pkg_patch/src/patch/main.c#3 (text+ko) ==== @@ -1,8 +1,6 @@ -/* +/*- + * Copyright 2010. Ivan Voras * - * FreeBSD install - a package for the installation and maintainance - * of non-core utilities. - * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -11,9 +9,10 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * - * Ivan Voras - * 21 May 2010 + */ +/* + * FreeBSD install - a package for the installation and maintainance + * of non-core utilities. * * This is the "binary patch" module. */ @@ -27,21 +26,74 @@ #include #include #include +#include +#include +#define PKG_PATCH_MAIN +#include "pkg_patch.h" +#include "mkpatch.h" -#include int argc; char **argv; +enum PP_OP patch_op = PP_NONE; + + +static void usage_short(void); +static void proc_args(void); + + +static void +usage_short() { + printf("usage: %s -m [flags] package_file_1 package_file_2\n", argv[0]); +} + + +static void +proc_args() { + int ch; + + while ((ch = getopt(argc, argv, "mh")) != -1) { + switch (ch) { + case 'm': + patch_op = PP_MKPATCH; + break; + case 'h': + usage_short(); + exit(0); + break; + default: + usage_short(); + exit(1); + } + } + argc -= optind; + argv += optind; +} + void cleanup(int __unused sig) { } + int main(int _argc, char **_argv) { argc = _argc; argv = _argv; + + proc_args(); + if (patch_op == PP_NONE) + errx(1, "No operation switch given"); + + switch (patch_op) { + case PP_MKPATCH: + perform_mkpatch(); + break; + default: + errx(1, "This should not happen - unknown patch_op"); + } + return (0); }