you can use iwconfig to config adapter, here are the examples.

iwconfig ra0 essid any
iwconfig ra0 essid CISCO_AP1200AB
iwconifg ra0 ap 00:80:C8:03:32:11
iwconfig ra0 channel 3
iwconfig ra0 mode ad-hoc  (Ad-hoc mode)
iwconfig ra0 mode managed (infra mode)
iwconfig ra0 rts 2347
iwconfig ra0 fag 2346
iwconfig ra0 nick "My Nick Name"
iwconfig ra0 rate auto
iwconfig ra0 rate 5500000
iwconifg ra0 key [1] 0123456789 open
iwconfig ra0 key [4] 01234567890123456789012345 restricted

======================================================================================
case 1: 
        connect to AP[CISCO_AP1200AB] without WEP encryption

#!/bin/sh

iwconfig ra0 key off
iwconfig ra0 mode managed

iwconfig ra0 essid CISCO_AP1200AB

case 2: 
        connect to AP[00:0b:be:6d:8b:d5] with WEP64 share-key
        default keyid=1 and key=0123456789

#!/bin/sh

iwconfig ra0 key [1] 0123456789 restricted
iwconfig ra0 mode managed

iwconfig ra0 ap 00:0b:be:6d:8b:d5

case 3: 
	connect to AP:CISCO_AP1200AB with WEP128 open-system
	default keyid=4 and key=12345678901234567890123456

#!/bin/sh

iwconfig ra0 key [4] 12345678901234567890123456 open
iwconfig ra0 mode managed

iwconfig ra0 essid CISCO_AP1200AB

case 4:
	Create Station: adhoc-6 and channel at 6 without WEP encryption
		
#!/bin/sh

iwconfig ra0 channel 6 

iwconfig ra0 mode ad-hoc

iwconfig ra0 key off 

iwconfig ra0 essid adhoc-6



case 5:
	Create Station: adhoc-3 and channel at 3 with wep64 open-system
	default keyid=1 and key=0123456789

#!/bin/sh

iwconfig ra0 channel 3

iwconfig ra0 mode ad-hoc

iwconfig ra0 key [1] 0123456789 open

iwconfig ra0 essid adhoc-3

