Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- define OK_FREQ 1000
- define OK_LEN 100
- define ERR_FREQ 400
- define ERR_LEN 250
- define VOL 50
- define YSPACE1 0
- define DELAY 1000
- vmthread MAIN
- {
- DATA32 Status
- DATAS Command 60
- DATAS Interface 10
- DATAS Info 10
- DATA16 Handle
- DATA8 Empty
- STRINGS(DUPLICATE,'udhcpc -R -b -p /var/run/udhcpc.',Command)
- UI_DRAW(FILLWINDOW, BG_COLOR, 0, 0)
- UI_DRAW(UPDATE)
- SYSTEM('killall udhcpc', Status)
- SYSTEM('ifconfig -a | sed "s/[ \\t].*//;/^\\(lo\\|\\)$/d" >/mnt/ramdisk/interfaces 2>/dev/null', Status)
- FILE(OPEN_READ, '/mnt/ramdisk/interfaces', Handle, Status)
- FILE(READ_TEXT, Handle, DEL_LINEFEED, 40, Interface)
- FILE(CLOSE, Handle)
- FILE(REMOVE, '/mnt/ramdisk/interfaces')
- STRINGS(STRIP, Interface, Interface)
- STRINGS(COMPARE, Interface, '', Empty)
- JR_FALSE(Empty, run)
- UI_DRAW(TEXT, FG_COLOR, 0, YSPACE1, 'No interface!')
- UI_DRAW(UPDATE)
- JR(err)
- run:
- STRINGS(ADD, Command, Interface, Command)
- STRINGS(ADD, Command, '.pid -i ', Command)
- STRINGS(ADD, Command, Interface, Command)
- SYSTEM(Command, Status)
- DIV32(Status, 256, Status)
- STRINGS(NUMBER_FORMATTED, Status, '%d', 10, Info)
- UI_DRAW(TEXT, FG_COLOR, 0, YSPACE1, 'dhcp:')
- UI_DRAW(TEXT, FG_COLOR, 50, YSPACE1, Info)
- UI_DRAW(UPDATE)
- JR_NEQ32(Status, 0, err)
- SOUND(TONE, VOL, OK_FREQ, OK_LEN)
- TIMER_WAIT(DELAY, Status)
- TIMER_READY(Status)
- JR(end)
- err:
- SOUND(TONE, VOL, ERR_FREQ, ERR_LEN)
- UI_BUTTON(WAIT_FOR_PRESS)
- end:
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement