Simplify strncat.
[glibc.git] / scripts / config-uname.sh
blobcf32ca53bf3ddac20e035b03ee2f689921d301dc
1 #!/bin/sh
3 config_os=$1
4 config_release=$2
5 uname_machine=$3
7 uname_sysname=`echo $config_os | sed 's/[0-9.]*$//'`
8 if test $uname_sysname != $config_os; then
9 config_release=`echo $config_os | sed s/$uname_sysname//`
12 if test -r /vmunix; then
13 kernel_id=`strings /vmunix | grep UNIX`
14 elif test -r /dynix; then
15 kernel_id=`strings /dynix | grep DYNIX`
16 else
17 kernel_id=
20 kernel_release=`echo "$kernel_id" | sed 's/^[^0-9.]*\([0-9.]*\).*$/\1/'`
21 if test x`echo "$config_release" | sed "s/^$kernel_release//"` \
22 != x$config_release; then
23 # The configuration release is a substring of the kernel release.
24 uname_release=$kernel_release
25 elif test x$config_release != x; then
26 uname_release=$config_release
27 elif test x$kernel_release != x; then
28 uname_release=$kernel_release
29 else
30 uname_release=unknown
33 kernel_version=`echo "$kernel_id" | sed 's/^[^#]*#\([0-9]*\).*$/\1/'`
34 if test -n "$kernel_version"; then
35 uname_version="$kernel_version"
36 else
37 uname_version=unknown
40 cat <<EOF
41 /* This file is generated by $0. DO NOT EDIT.
43 This is used only by the generic uname function for systems with no real
44 uname call. If this data is not correct, it does not matter much. */
46 #define UNAME_SYSNAME "$uname_sysname"
47 #define UNAME_RELEASE "$uname_release"
48 #define UNAME_VERSION "$uname_version"
49 #define UNAME_MACHINE "$uname_machine"
50 EOF