LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 08-19-2011, 12:14 PM   #16
ta0kira
Senior Member
 
Registered: Sep 2004
Distribution: FreeBSD 9.1, Kubuntu 12.10
Posts: 3,078

Rep: Reputation: Disabled

Yes, that's essentially what I had in mind. I haven't actually used the utmp system, however.

Looking at the manpage, getutline/getutxline should find the correct entry based on ut_line; if you use that you shouldn't need to search manually. The manpage also says that you should use "utx" variants over "ut" variants because the former are standardized by POSIX.
Kevin Barry
 
Old 08-24-2011, 01:35 PM   #17
linuxdev817
LQ Newbie
 
Registered: Aug 2011
Posts: 19

Original Poster
Rep: Reputation: Disabled
Based off of your advice, this is what I ended up using:

Code:
struct utmpx ut_entry;
struct utmpx *my_ut_entry;
strcpy((ut_entry.ut_line, ttyname(STDIN_FILENO) + strlen("/dev/"));
setutxent();
my_ut_entry = getutxline(&ut_entry);
Thanks to everyone that responded to my post.
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Custom Shell output help CapnStank Programming 1 10-18-2010 11:08 AM
How to call Shell Script on a remote server with remote servers env variables need Linux - Server 1 10-14-2009 08:37 PM
Firefox custom chrome and -remote MardukKurios Linux - Software 0 11-22-2005 04:39 PM
Custom shell menu? Darkfin Linux - Newbie 1 04-24-2005 09:37 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:07 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration