Disallow writes to filesystems mounted read-only via NULLFS. In this case
[dragonfly.git] / sys / kern / genassym.sh
CommitLineData
984263bc
MD
1#!/bin/sh
2# $FreeBSD: src/sys/kern/genassym.sh,v 1.1.2.1 2000/07/07 01:36:35 obrien Exp $
1de703da 3# $DragonFly: src/sys/kern/genassym.sh,v 1.2 2003/06/17 04:28:41 dillon Exp $
984263bc
MD
4
5# Grrr, this should use stdin and stdout, but is encrufted for compatibility.
6
7usage() {
8 echo "usage: genassym [-o outfile] objfile"
9 exit 1
10}
11
12outfile=/dev/stdout
13while getopts "o:" option
14do
15 case "$option" in
16 o) outfile="$OPTARG";;
17 *) usage;;
18 esac
19done
20shift $(($OPTIND - 1))
21case $# in
221) ;;
23*) usage;;
24esac
25
26nm "$1" | awk '
27/ C .*sign$/ {
28 sign = substr($1, length($1) - 3, 4)
29 sub("^0*", "", sign)
30 if (sign != "")
31 sign = "-"
32}
33/ C .*w0$/ {
34 w0 = substr($1, length($1) - 3, 4)
35}
36/ C .*w1$/ {
37 w1 = substr($1, length($1) - 3, 4)
38}
39/ C .*w2$/ {
40 w2 = substr($1, length($1) - 3, 4)
41}
42/ C .*w3$/ {
43 w3 = substr($1, length($1) - 3, 4)
44 w = w3 w2 w1 w0
45 sub("^0*", "", w)
46 if (w == "")
47 w = "0"
48 sub("w3$", "", $3)
49 # This still has minor problems representing INT_MIN, etc. E.g.,
50 # with 32-bit 2''s complement ints, this prints -0x80000000, which
51 # has the wrong type (unsigned int).
52 printf("#define\t%s\t%s0x%s\n", $3, sign, w)
53}
54' 3>"$outfile" >&3 3>&-