Module Name: othersrc Committed By: dholland Date: Fri May 24 00:40:25 UTC 2013
Added Files: othersrc/external/bsd/bikeshed: Makefile othersrc/external/bsd/bikeshed/bin: Makefile othersrc/external/bsd/bikeshed/dist: README othersrc/external/bsd/bikeshed/dist/doc: bs.1 othersrc/external/bsd/bikeshed/dist/src: main.c Log Message: As named by riastradh@ last week To generate a diff of this commit: cvs rdiff -u -r0 -r1.1 othersrc/external/bsd/bikeshed/Makefile cvs rdiff -u -r0 -r1.1 othersrc/external/bsd/bikeshed/bin/Makefile cvs rdiff -u -r0 -r1.1 othersrc/external/bsd/bikeshed/dist/README cvs rdiff -u -r0 -r1.1 othersrc/external/bsd/bikeshed/dist/doc/bs.1 cvs rdiff -u -r0 -r1.1 othersrc/external/bsd/bikeshed/dist/src/main.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Added files: Index: othersrc/external/bsd/bikeshed/Makefile diff -u /dev/null othersrc/external/bsd/bikeshed/Makefile:1.1 --- /dev/null Fri May 24 00:40:25 2013 +++ othersrc/external/bsd/bikeshed/Makefile Fri May 24 00:40:24 2013 @@ -0,0 +1,5 @@ +# $NetBSD: Makefile,v 1.1 2013/05/24 00:40:24 dholland Exp $ + +SUBDIR=bin + +.include <bsd.subdir.mk> Index: othersrc/external/bsd/bikeshed/bin/Makefile diff -u /dev/null othersrc/external/bsd/bikeshed/bin/Makefile:1.1 --- /dev/null Fri May 24 00:40:25 2013 +++ othersrc/external/bsd/bikeshed/bin/Makefile Fri May 24 00:40:24 2013 @@ -0,0 +1,15 @@ +# $NetBSD: Makefile,v 1.1 2013/05/24 00:40:24 dholland Exp $ + +BINDIR=/usr/bin + +PROG=bs +MAN=bs.1 +SRCS=main.c + +WARNS=5 + +DIST=${.CURDIR}/../dist +CPPFLAGS+=-I${DIST} +.PATH: ${DIST}/src ${DIST}/doc + +.include <bsd.prog.mk> Index: othersrc/external/bsd/bikeshed/dist/README diff -u /dev/null othersrc/external/bsd/bikeshed/dist/README:1.1 --- /dev/null Fri May 24 00:40:25 2013 +++ othersrc/external/bsd/bikeshed/dist/README Fri May 24 00:40:25 2013 @@ -0,0 +1,12 @@ +"bikeshed" is a full-tree version control system. + +Flagship features include: + - centralized design supporting disconnected operation + - no compare-by-hash + - sequential version numbering + - written in C without depending on external libraries + - reasonably fast + - scalable to large trees with deep histories + - provides provenance tracking for commits + - modern schema with lightweight branching and atomic changesets + - clean user interface Index: othersrc/external/bsd/bikeshed/dist/doc/bs.1 diff -u /dev/null othersrc/external/bsd/bikeshed/dist/doc/bs.1:1.1 --- /dev/null Fri May 24 00:40:25 2013 +++ othersrc/external/bsd/bikeshed/dist/doc/bs.1 Fri May 24 00:40:25 2013 @@ -0,0 +1,50 @@ +.\" +.\" Copyright (c) 2013 The NetBSD Foundation, Inc. +.\" All rights reserved. +.\" +.\" This code is derived from software contributed to The NetBSD Foundation +.\" by David A. Holland. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 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. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +.\" POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd May 23, 2013 +.Dt BS 1 +.Os +.Sh NAME +.Nm bs, bikeshed +.Nd full-tree version control system +.Sh SYNOPSIS +.Nm bs +.Op Fl C Ar dir +.Op Fl hqvy +command +.Op Ar args... +.Sh DESCRIPTION +This page is a placeholder. +.Sh SEE ALSO +.Xr cvs 1 +.Sh HISTORY +The +.Nm bs +command will appear in +.Nx K +for large K. Index: othersrc/external/bsd/bikeshed/dist/src/main.c diff -u /dev/null othersrc/external/bsd/bikeshed/dist/src/main.c:1.1 --- /dev/null Fri May 24 00:40:25 2013 +++ othersrc/external/bsd/bikeshed/dist/src/main.c Fri May 24 00:40:25 2013 @@ -0,0 +1,156 @@ +/*- + * Copyright (c) 2013 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by David A. Holland. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include <stdbool.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <getopt.h> +#include <err.h> + +//////////////////////////////////////////////////////////// +// placeholder (XXX) + +static void +basehelp(void) +{ + printf("No help yet\n"); +} + +static int +help(int argc, char *argv[]) +{ + int i; + + if (argc == 1) { + basehelp(); + } else { + for (i=1; i<argc; i++) { + printf("No help for %s\n", argv[i]); + } + } + return EXIT_FAILURE; +} + +//////////////////////////////////////////////////////////// +// command table + +struct cmdtabentry { + const char *name; + bool usectldir; + int (*execute)(int argc, char *argv[]); +}; + +static const struct cmdtabentry cmdtab[] = { + { "help", false, help }, +}; +static const unsigned cmdtabnum = __arraycount(cmdtab); + +static int +findcmd(const void *av, const void *bv) +{ + const char *a = av; + const struct cmdtabentry *b = bv; + + return strcmp(a, b->name); +} + +//////////////////////////////////////////////////////////// +// main + +static void +usage(void) +{ + fprintf(stderr, "Usage: bs [options] command [args...]\n"); + fprintf(stderr, "Try \"bs help\" for more information.\n"); +} + +int +main(int argc, char *argv[]) +{ + const char *ctldirname = NULL; + bool quiet = false; + bool verbose = false; + bool yes = false; + + const char *cmd; + const struct cmdtabentry *cmdentry; + int ch; + + while ((ch = getopt(argc, argv, "C:hqvy")) != -1) { + switch (ch) { + case 'C': + /* specify the .bs dir */ + ctldirname = optarg; + break; + case 'h': + /* same as "bs help" */ + basehelp(); + return EXIT_FAILURE; + case 'q': + /* print less text */ + quiet = true; + break; + case 'v': + /* print more text */ + verbose = true; + break; + case 'y': + /* don't ask questions */ + yes = true; + break; + default: + usage(); + return EXIT_FAILURE; + } + } + if (optind >= argc) { + usage(); + return EXIT_FAILURE; + } + cmd = argv[optind]; + cmdentry = bsearch(cmd, cmdtab, cmdtabnum, sizeof(cmdtab[0]), findcmd); + if (cmdentry == NULL) { + warnx("Unknown command %s", cmd); + warnx("Try \"bs help\" for a list of basic commands."); + return EXIT_FAILURE; + } +#if 0 /* not yet XXX */ + if (cmdentry->usectldir) { + ctldir_establish(ctldirname); + } +#else + (void)ctldirname; + (void)quiet; + (void)verbose; + (void)yes; +#endif + + return cmdentry->execute(argc - optind, argv + optind); +}