[fpc-pascal]Type question.
Brad Campbell
brad at seme.com.au
Wed Jul 25 09:43:26 CEST 2001
G'day all,
I have implemented a native replacement for the linux shell chvt
command, however, I don't like the way in which I pass the terminal
number paramater to the ioctl. I had to do some strange fudging to
get this to work, as the last paramater of the ioctl routine in the
linux unit must be a VOID_POINTER. The ioctl in the kernel expects
an unsigned_longint. This works, verified by both function and running
an strace on the program. Is there a better way?
Function ChVT(Terminal : Cardinal) : Boolean;
Const
VT_ACTIVATE = $5606;
VT_WAITACTIVE= $5607;
Var
TTY : LongInt;
test : Pointer;
Begin
TTY := fdOpen('/dev/tty',Open_RdWr);
If TTY = 0 then Exit(False);
Test := $0;
Test := Test + Terminal;
IOCTL(TTY,VT_ACTIVATE,Test);
IOCTL(TTY,VT_WAITACTIVE,Test);
fdClose(TTY);
ChVT := True;
End;
Cheers all..
--
Brad....
/"\
Save the Forests \ / ASCII RIBBON CAMPAIGN
Burn a Greenie. X AGAINST HTML MAIL
/ \
More information about the fpc-pascal
mailing list