Finding out logged users/user's tty.

bridged with qdn.public.articles
Post Reply
Arunas Bytautas

Finding out logged users/user's tty.

Post by Arunas Bytautas » Tue Feb 19, 2002 1:01 pm

Hello,

I have several questions:
-How to find from source on which tty user is logged on?
-Where can I find port of such most used and common unix utilities like
w/who/finger?
I can't even determine on QNX what users are logged in?

Thanks in advance, With best regards,

Arunas

Kris Warkentin

Re: Finding out logged users/user's tty.

Post by Kris Warkentin » Tue Feb 19, 2002 1:03 pm

I recently ported who to QNX6 from BSD and it works just fine (see attached)
and I expect finger and w would be much the same. All you need to do is
touch /var/log/utmp and wtmp and login will quite happily add entries for
logins. The problem is, however, that not all of our stuff is aware of utmp
and friends. So, unfortunately, the utmp/wtmp database is not kept very
well. Someone here will have to audit our stuff (pterm, shells, etc.) to
make sure they're doing the right thing...it's just a matter of finding the
time. I think that since so many people are asking for it we'll have to do
it soon.

cheers,

Kris

"Arunas Bytautas" <arubyt@elsis.com> wrote in message
news:a4tecc$fsj$1@inn.qnx.com...
Hello,

I have several questions:
-How to find from source on which tty user is logged on?
-Where can I find port of such most used and common unix utilities like
w/who/finger?
I can't even determine on QNX what users are logged in?

Thanks in advance, With best regards,

Arunas

begin 666 who.c
M+RH*("H@0V]P>7)I9VAT("AC*2 Q.3@Y+" Q.3DS"B J"51H92!296=E;G1S
M(&]F('1H92!5;FEV97)S:71Y(&]F($-A;&EF;W)N:6$N("!!;&P@<FEG:'1S
M(')E<V5R=F5D+@H@*@H@*B!4:&ES(&-O9&4@:7,@9&5R:79E9"!F<F]M('-O
M9G1W87)E(&-O;G1R:6)U=&5D('1O($)E<FME;&5Y(&)Y"B J($UI8VAA96P@
M1FES8VAB96EN+@H@*@H@*B!2961I<W1R:6)U=&EO;B!A;F0@=7-E(&EN('-O
M=7)C92!A;F0@8FEN87)Y(&9O<FUS+"!W:71H(&]R('=I=&AO=70*("H@;6]D
M:69I8V%T:6]N+"!A<F4@<&5R;6ET=&5D('!R;W9I9&5D('1H870@=&AE(&9O
M;&QO=VE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N('!E<FUI<W-I;VXN"B J"B J(%1(25,@4T]&5%=!4D4@25,@4%)/5DE$
M140@0ED@5$A%(%)%1T5.5%,@04Y$($-/3E1224)55$]24R!@8$%3($E3)R<@
M04Y$"B J($%.62!%6%!215-3($]2($E-4$Q)140@5T%24D%.5$E%4RP@24Y#
M3%5$24Y'+"!"550@3D]4($Q)34E4140@5$\L(%1(10H@*B!)35!,245$(%=!
M4E)!3E1)15,@3T8@34520TA!3E1!0DE,2519($%.1"!&251.15-3($9/4B!!
M(%!!4E1)0U5,05(@4%524$]310H@*B!!4D4@1$E30TQ!24U%1"X@($E.($Y/
M($5614Y4(%-(04Q,(%1(12!214=%3E13($]2($-/3E1224)55$]24R!"12!,
M24%"3$4*("H@1D]2($%.62!$25)%0U0L($E.1$E214-4+"!)3D-)1$5.5$%,
M+"!34$5#24%,+"!%6$5-4$Q!4EDL($]2($-/3E-%455%3E1)04P*("H@1$%-
M04=%4R H24Y#3%5$24Y'+"!"550@3D]4($Q)34E4140@5$\L(%!23T-54D5-
M14Y4($]&(%-50E-425155$4@1T]/1%,*("H@3U(@4T525DE#15,[($Q/4U,@
M3T8@55-%+"!$051!+"!/4B!04D]&2513.R!/4B!"55-)3D534R!)3E1%4E)5
M4%1)3TXI"B J($A/5T5615(@0T%54T5$($%.1"!/3B!!3ED@5$A%3U)9($]&
M($Q)04))3$E462P@5TA%5$A%4B!)3B!#3TY44D%#5"P@4U1224-4"B J($Q)
M04))3$E462P@3U(@5$]25" H24Y#3%5$24Y'($Y%1TQ)1T5.0T4@3U(@3U1(
M15)725-%*2!!4DE324Y'($E.($%.62!705D*("H@3U54($]&(%1(12!54T4@
M3T8@5$A)4R!33T945T%212P@159%3B!)1B!!1%9)4T5$($]&(%1(12!03U-3
M24))3$E462!/1@H@*B!354-(($1!34%'12X*("HO"@HC:6YC;'5D92 \<WES
M+V-D969S+F@^"B-I;F-L=61E(#QS>7,O='EP97,N:#X*(VEN8VQU9&4@/'-Y
M<R]F:6QE+F@^"@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M92@I.PH)?0H)97AI="@P*3L*?0H*<W1A=&EC('9O:60*=7-A9V4H*0I["@DH
M=F]I9"EF<')I;G1F*'-T9&5R<BP@(B5S7&XE<UQN(BP*"0DB=7-A9V4Z('=H
M;R!;9FEL95TB+ H)"2(@(" @(" @=VAO(&%M(&DB*3L*"65X:70H,2D["GT*
M"G9O:60*;W5T<'5T*'5P*0H)<W1R=6-T('5T;7 @*G5P.PI["@EC:&%R(&)U
M9ELX,%T["@ES=&%T:6,@:6YT(&1?9FER<W0@/2 M,3L*"@DH=F]I9"EP<FEN
M=&8H(B4M*BXJ<R E+2HN*G,B+"!55%].04U%4TE:12P@551?3D%-15-)6D4L
M('5P+3YU=%]N86UE+ H)(" @(%547TQ)3D5325I%+"!55%],24Y%4TE:12P@
M=7 M/G5T7VQI;F4I.PH)*'9O:60I<W1R9G1I;64H8G5F+"!S:7IE;V8H8G5F
M*2P*"0D@(" @(" @9%]F:7)S=" _("(E92 E8B E4B(@.B B)6(@)64@)5(B
M+ H)"2 @(" @("!L;V-A;'1I;64H)G5P+3YU=%]T:6UE*2D["@DH=F]I9"EP
M<FEN=&8H(B5S7&XB+"!B=68I.PI]"@IS=&%T:6,@1DE,12 J"F9I;&4H;F%M
M92D*"6-O;G-T(&-H87(@*FYA;64["GL*"49)3$4@*G5F<#L*"@EI9B H(2AU
M9G @/2!F;W!E;BAN86UE+" B<B(I*2D*"0EE<G(H,2P@(B5S(BP@;F%M92D[
3"@ER971U<FXH=69P*3L*?0H*"@``
`
end

Post Reply

Return to “qdn.public.articles”