~fultonbrowne/rc-scripts

7923e9afe0182b0a723e80f93b0eec30020549ca — glenda 9 months ago 69ecee7
added script
1 files changed, 38 insertions(+), 0 deletions(-)

A util/fscale
A util/fscale => util/fscale +38 -0
@@ 0,0 1,38 @@
#!/bin/rc
# by mischief

fn x86_speed {
	if(! io -wM 0x19A $1 >[2]/dev/null){
		echo unsupported processor
		exit unsupported
	}
}

fn x86_slow {
	x86_speed 0x12
}

fn x86_fast {
	x86_speed 0x0
}

arch=()

switch $objtype {
case 386 amd64
	arch=x86
case *
	echo unsupported architecture
	exit unsupported
}

switch $1 {
case off
	$arch^_slow
case on
	$arch^_fast
case *
	echo invalid mode
	exit invalid
}