]> gitweb @ CieloNegro.org - build-hc-pkg.git/commitdiff
initial commit including canon-name
authorPHO <pho@cielonegro.org>
Thu, 9 Feb 2012 03:56:54 +0000 (12:56 +0900)
committerPHO <pho@cielonegro.org>
Thu, 9 Feb 2012 03:56:54 +0000 (12:56 +0900)
.gitignore [new file with mode: 0644]
canon-name/Makefile.am [new file with mode: 0644]
canon-name/autogen.sh [new file with mode: 0755]
canon-name/configure.ac [new file with mode: 0644]
canon-name/src/Makefile.am [new file with mode: 0644]
canon-name/src/canon-name.c [new file with mode: 0644]

diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..f470efe
--- /dev/null
@@ -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 (file)
index 0000000..0a6c148
--- /dev/null
@@ -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 (executable)
index 0000000..ab3041f
--- /dev/null
@@ -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 (file)
index 0000000..e8f41fe
--- /dev/null
@@ -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 (file)
index 0000000..30acdf3
--- /dev/null
@@ -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 (file)
index 0000000..447083f
--- /dev/null
@@ -0,0 +1,8 @@
+#include "config.h"
+#include <stdio.h>
+#include <string.h>
+
+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);
+}