home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / unix / question / 10444 < prev    next >
Encoding:
Text File  |  1992-08-27  |  1.8 KB  |  57 lines

  1. Newsgroups: comp.unix.questions
  2. Path: sparky!uunet!sun-barr!cs.utexas.edu!zaphod.mps.ohio-state.edu!moe.ksu.ksu.edu!usenet-feed.cc.umr.edu!cnews
  3. From: mgj@franklin.ee.umr.edu (Mahesh Govind Joshi)
  4. Subject: How do I find out if a user is refusing messages ?
  5. Date: Thu, 27 Aug 1992 20:37:00 GMT
  6. Nntp-Posting-Host: franklin.ee.umr.edu
  7. Reply-To: mgj@ee.umr.edu (Mahesh Govind Joshi)
  8. Organization: University of Missouri - Rolla
  9. Sender: cnews@umr.edu (UMR Usenet News Post)
  10. Originator: mgj@ee.umr.edu
  11. Message-ID: <1992Aug27.203700.642@umr.edu>
  12. Lines: 43
  13.  
  14. Hi,
  15.  
  16. I dont know if this is the right newsgroup to ask this question
  17. but I will go ahead anyway.
  18.  
  19. How do I find out if a person is refusing messages (mesg n) at 
  20. a remote site through a 'C' program ?
  21. ( This includes checking if he is logged on !!).
  22.  
  23. At present, I am doing this in a crude fashion. I dont know if
  24. a better method exists.
  25.  
  26. argv[2]    node_name (eg. ee.umr.edu)
  27. argv[1] username (eg. mgj)
  28.  
  29.  
  30. I do a system(" finger @argv[2] | grep argv[1] > /tmp/file ")
  31.  
  32. I do a fgets(buf,35,file_pointer_to_/tmp/file).
  33.     If fgets  returns a  NULL, person is not logged on.
  34.     else
  35.          check for the occurrence of '*' in this file
  36.         
  37.         if index(buf,'*') != NULL
  38.          person is logged on but refusing messages
  39.         else
  40.           person is logged.
  41.  
  42. This is very crude I beleive, but it works very well !
  43.  
  44. Suggestions  are welcome !!
  45.  
  46.  
  47. Thanks in advance!!
  48.  
  49. ________________________________________________________________________
  50. Mahesh Joshi             |   Bura duniya ko hai kehta
  51. Help Desk Consultant        |   Aisa bhola to na ban 
  52. Snail Mail:- 1300 N. Oak Street    |   Jo hai karta,woh hai bharta    
  53. #17, Rolla MO 65401.        |   Hai yahan ka hai chalan
  54. Voice:(314)341-8197.        |   Takdeer nahi chalnegi yahan
  55. Email : mgj@ee.umr.edu        |    ---- Majrooh Sultanpuri---- 
  56. ------------------------------------------------------------------------
  57.