diff --git a/cskel/LICENSE b/cskel/LICENSE new file mode 100644 index 0000000..1ea2a53 --- /dev/null +++ b/cskel/LICENSE @@ -0,0 +1,21 @@ +This code is released under the ISC license. + +-------------------------------------------------------------------------------- + +the ISC license: +Copyright (c) 2011 Kyle Isom + +Permission to use, copy, modify, and distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +-------------------------------------------------------------------------------- + diff --git a/cskel/README b/cskel/README new file mode 100644 index 0000000..a98632b --- /dev/null +++ b/cskel/README @@ -0,0 +1,26 @@ +cskel - skeleton files for new C projects +----------------------------------------- +cskel is a skeleton set of files that are useful when making a new C project. + + +What's included +--------------- +I've got a config.sh and Makefile.in that are used to generate code that will +build properly on Linux. + + +Caveats +------- +This is intended for projects where the codebase resides in the project root, +i.e. not in a src/ directory. It also isn't set up to build libraries. + + +Author +------ +Kyle Isom . + + +See also +-------- +http://www.tyrfingr.is/cskel/ + diff --git a/cskel/config.sh b/cskel/config.sh new file mode 100755 index 0000000..ddafb4c --- /dev/null +++ b/cskel/config.sh @@ -0,0 +1,51 @@ +#!/bin/sh + +TARGET="$(cat Makefile.in | grep 'TARGET :=' | awk -F' ' '{ print $3; }')" +echo "configuring ${TARGET}" + +which sed 2>/dev/null 1>/dev/null +if [ $? -ne 0 ]; then + echo "cannot find sed!" 1>&2 +fi + +OPSYS=$(uname -s) + +echo "Configuring for ${OPSYS}..." +if [ "x${OPSYS}" = "xLinux" ]; then + OS_CFLAGS="-D_BSD_SOURCE -D_POSIX_SOURCE -D_XOPEN_SOURCE" +else + OS_CFLAGS="" +fi + +if [ -z "${OS_CFLAGS}" ]; then + echo "${OPSYS} requires no extra build flags." +else + echo "${OPSYS} requires build flags ${OS_CFLAGS}" +fi + +if [ -z "${PREFIX}" ]; then + PREFIX="/usr/local" +fi + +if [ "${PREFIX}" = "/usr" ]; then + MANDIR="$(PREFIX)/share/man" +elif [ "${PREFIX}" = "/usr/local" ]; then + if [ "${OPSYS}" = "Darwin" ]; then + MANDIR="${PREFIX}/share/man" + else + MANDIR="${PREFIX}/man" + fi +else + MANDIR="${PREFIX}/man" +fi + +echo "prefix: ${PREFIX}" +echo "mandir: ${MANDIR}" + +echo "writing new Makefile" +cat Makefile.in | sed -e "s|OS_CFLAGS|${OS_CFLAGS}|" | \ + sed -e "s|\$PREFIX|${PREFIX}|" | \ + sed -e "s|\$MANDIR|${MANDIR}|" > Makefile + + +echo "done." diff --git a/cskel/man.n.scd b/cskel/man.n.scd new file mode 100644 index 0000000..6eee40d --- /dev/null +++ b/cskel/man.n.scd @@ -0,0 +1,33 @@ +progname(N) + +# NAME +progname - one line about what it does + +# SYNOPSIS + +progname [flags] [args] + +# DESCRIPTION + +; # RETURN VALUES +; For sections 2, 3, & 9 only. +; # ENVIRONMENT +; For sections 1, 6, 7, & 8 only. +; # FILES +; # EXIT STATUS +; For sections 1, 6, & 8 only. +; # EXAMPLES +; # DIAGNOSTICS +; For sections 1, 4, 6, 7, & 8 only. +; # ERRORS +; For sections 2, 3, & 9 only. +; # SEE ALSO + +# AUTHORS + +Maintained by Kyle Isom . Up-to-date sources can be found +at https://hg.sr.ht/~kisom/progname. + +; # CAVEATS +; # BUGS +