From: PHO Date: Thu, 9 Feb 2012 03:56:54 +0000 (+0900) Subject: initial commit including canon-name X-Git-Url: https://git.cielonegro.org/gitweb.cgi?a=commitdiff_plain;h=7b8684199160e0da113ddeb5a1b13afb5a415d32;p=build-hc-pkg.git initial commit including canon-name --- 7b8684199160e0da113ddeb5a1b13afb5a415d32 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f470efe --- /dev/null +++ b/.gitignore @@ -0,0 +1,19 @@ +.deps +Makefile +Makefile.in +aclocal.m4 +*.cache +*.log +*.o +canon-name/src/canon-name +config.guess +config.status +config.sub +config.h +config.h.in* +configure +configure.scan +depcomp +install-sh +missing +stamp-h1 diff --git a/canon-name/Makefile.am b/canon-name/Makefile.am new file mode 100644 index 0000000..0a6c148 --- /dev/null +++ b/canon-name/Makefile.am @@ -0,0 +1,3 @@ +SUBDIRS = src + +AUTOMAKE_OPTIONS = foreign diff --git a/canon-name/autogen.sh b/canon-name/autogen.sh new file mode 100755 index 0000000..ab3041f --- /dev/null +++ b/canon-name/autogen.sh @@ -0,0 +1,3 @@ +#!/bin/sh +set -x +autoreconf -i diff --git a/canon-name/configure.ac b/canon-name/configure.ac new file mode 100644 index 0000000..e8f41fe --- /dev/null +++ b/canon-name/configure.ac @@ -0,0 +1,37 @@ +# -*- Autoconf -*- +# Process this file with autoconf to produce a configure script. + +AC_PREREQ([2.68]) +AC_INIT([canon-name], [0.1], [pho@cielonegro.org]) +AM_INIT_AUTOMAKE +AC_CONFIG_SRCDIR([src/canon-name.c]) +AC_CONFIG_HEADERS([src/config.h]) + +AM_MAINTAINER_MODE + +# Checks for environments. +AC_CANONICAL_HOST +AC_DEFINE_UNQUOTED([HOST_CPU], ["$host_cpu"], [Canonical host CPU name]) +AC_DEFINE_UNQUOTED([HOST_VENDOR], ["$host_vendor"], [Canonical host vendor name]) +AC_DEFINE_UNQUOTED([HOST_OS], ["$host_os"], [Canonical host OS name]) + +# Checks for programs. +AC_PROG_CC + +# Checks for libraries. + +# Checks for header files. +AC_CHECK_HEADERS([string.h]) + +# Checks for typedefs, structures, and compiler characteristics. +AC_TYPE_SIZE_T + +# Checks for library functions. +AC_CHECK_FUNCS([strcspn]) + +# Done. +AC_CONFIG_FILES([ + Makefile + src/Makefile + ]) +AC_OUTPUT diff --git a/canon-name/src/Makefile.am b/canon-name/src/Makefile.am new file mode 100644 index 0000000..30acdf3 --- /dev/null +++ b/canon-name/src/Makefile.am @@ -0,0 +1,3 @@ +bin_PROGRAMS = canon-name + +canon_name_SOURCES = canon-name.c diff --git a/canon-name/src/canon-name.c b/canon-name/src/canon-name.c new file mode 100644 index 0000000..447083f --- /dev/null +++ b/canon-name/src/canon-name.c @@ -0,0 +1,8 @@ +#include "config.h" +#include +#include + +int main(int argc, char* argv[]) { + size_t n_non_digits = strcspn(HOST_OS, "0123456789"); + printf("%s-%s-%.*s\n", HOST_CPU, HOST_VENDOR, n_non_digits, HOST_OS); +}