theworld 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. #!/bin/rc
  2. fn initfn {
  3. dial/flush
  4. echo +++
  5. echo -n atzh0
  6. dial/expect -q -t 5 OK
  7. }
  8. fn dialfn {
  9. dial/flush
  10. echo -n atdt^$telno^
  11. dial/expect -q -t 60 CONNECT
  12. }
  13. # process options
  14. for(i in $*){
  15. switch($i){
  16. case '-P'
  17. primary=-P
  18. }
  19. }
  20. switch($dev){
  21. case ''
  22. dev=/dev/eia1
  23. }
  24. switch($telno){
  25. case ''
  26. telno=18009878722
  27. }
  28. switch($baud){
  29. case ''
  30. baud=115200
  31. }
  32. {
  33. # set up uart
  34. if( test -e $dev^ctl ){
  35. echo -n b^$baud
  36. echo -n m1 # cts/rts flow control
  37. echo -n q64000 # big buffer
  38. echo -n n1 # nonblocking writes
  39. echo -n r1 # rts on
  40. echo -n d1 # dtr on
  41. echo -n c1 # handup wen we lose dcd
  42. } > $dev^ctl
  43. # get the modem's attention
  44. while( ! initfn )
  45. sleep 1
  46. # dial
  47. while( ! dialfn )
  48. sleep 30
  49. echo connected to the world >[1=2]
  50. # start ppp
  51. ip/ppp $primary -f
  52. } < $dev > $dev
  53. # supply unknowns with outside addresses
  54. if( ! grep -s 'auth=' /net/ndb){
  55. echo ' auth=204.178.31.3'>>/net/ndb
  56. echo ' authdom=cs.bell-labs.com'>>/net/ndb
  57. }
  58. if( ! grep -s 'ntp=' /net/ndb)
  59. echo ' ntp=204.178.31.2'>>/net/ndb
  60. if( ! grep -s 'dns=' /net/ndb){
  61. echo ' dns=204.178.31.3'>>/net/ndb
  62. echo ' dns=204.178.31.4'>>/net/ndb
  63. }
  64. # start dns if it isn't already going
  65. if(! test -e /srv/dns )
  66. ndb/dns -r