home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 35 Internet / 35-Internet.zip / ppdial31.zip / PPDXIT.CMD < prev    next >
OS/2 REXX Batch file  |  1996-12-28  |  2KB  |  57 lines

  1. /* REXX */
  2. /* Sample user exit for pppdial.cmd */
  3. /* Don Russell */
  4. /* don_russell@ibm.net */
  5.  
  6. /* This particular exit determines the local IP address and displays it. */
  7. /* You could modify this script to write the IP address to a file for further */
  8. /* distribution. i.e. so people can FTP to/from you, obtaining your IP address */
  9. /* by sending you e-mail. */
  10.  
  11. parse upper source env how self .
  12. parse arg arguments
  13.  
  14. address cmd
  15. '@ECHO OFF'
  16.  
  17. if how = 'FUNCTION' then do
  18.    /* we were started as a function call from pppdial... */
  19.    /* start us again as a separate session and return. */
  20.    'START /C /I' self arguments
  21.    return 0
  22. end
  23.  
  24. /* The user exit actually ended but hasn't done anything yet... */
  25. /* It started up the exit again asynchronously in order to let the dial */
  26. /* connection be completed.... */
  27.  
  28. /* Let's wait a few seconds to let things settle a bit... */
  29. call SysSleep 3
  30.  
  31. NewQueue = RXQUEUE( 'create' )
  32. OldQueue = RXQUEUE( 'set', NewQueue )
  33. /* What's our IP address this time? ... */
  34. 'NETSTAT -a | RXQUEUE' NewQueue
  35. if queued() = 0 then
  36.    MyIP = '*unknown*'
  37. else
  38.    parse pull . MyIP .
  39.  
  40. /* There may be more than one IP address in the queue */
  41. /* if you're connected to more than one network at the same time. */
  42. /* MyIP will be the FIRST adress, the others will be ignored. */
  43. call RXQUEUE 'delete', NewQueue
  44. call RXQUEUE 'set', OldQueue
  45.  
  46. parse var arguments DCERate .
  47. say 'Our IP address is' MyIP
  48. say "Connection speed to the 'net is" DCERate
  49.  
  50. /* Create file to send to people asking for my IP address... */
  51.     /* code to be developed by user */
  52. /* Start up my mail client so I can process requests for this file. */
  53.     /* code to be developed by user */
  54.  
  55. '@PAUSE'
  56.  
  57.