home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 15 Message / 15-Message.zip / oe991016.zip / Rx991015.txt < prev    next >
Text File  |  1999-10-16  |  58KB  |  1,730 lines

  1.  
  2.                     Programming/using OS/2 REXX      (echo)
  3.  
  4.                  Saturday, 09-Oct-1999 to Friday, 15-Oct-1999
  5.  
  6. +----------------------------------------------------------------------------+
  7.  
  8. From: David Noon                                        07-Oct-99 17:41:00
  9.   To: Eddy Thilleman                                    09-Oct-99 10:45:09
  10. Subj: hstart wget?
  11.  
  12. In a message dated 10-01-99, Eddy Thilleman said to Mike Ruskai about
  13. "hstart wget?"
  14.  
  15. Hi Eddy,
  16.  
  17. MR> It's 'READY:', not 'READY'.  Though in PC-DOS 7's REXX, it is 'READY'.
  18. MR> So, you might want to do this:
  19.  
  20. MR> if left(check,5) != 'READY' then do
  21.  
  22. ET>In my latest version, I do
  23.  
  24. ET>  if pos( 'READY', check ) = 1 then        /* if we opened file */
  25.  
  26. The definitive test is really an exact byte comparison on the string:
  27.  
  28.      IF check == 'READY:' THEN
  29.  
  30. Note the double equal sign.
  31.  
  32. ET>the same condition with the do while
  33.  
  34. ET>> do while stream( InFile, 'state' ) = 'READY'
  35.  
  36. MR> lines() or chars() would be better here.
  37.  
  38. ET>why?
  39.  
  40. I don't see any reason. In fact, checking the STATE would be marginally less
  41. overhead. Again, I would recommend an exact byte comparison:
  42.  
  43.      DO WHILE STREAM(InFile,'STATE') == 'READY'
  44.  
  45. Regards
  46.  
  47. Dave
  48. <Team PL/I>
  49. ___
  50.  * MR/2 2.25 #353 * "More tea, vicar?"
  51.  
  52. --- Maximus/2 3.01
  53.  * Origin: Air Applewood, OS/2 Gateway to Essex 44-1279-792300 (2:257/609)
  54. 45
  55.  
  56. +----------------------------------------------------------------------------+
  57.  
  58. From: Ron Mitchell                                      09-Oct-99 05:24:00
  59.   To: John Clarke                                       09-Oct-99 10:45:09
  60. Subj: hstart wget?
  61.  
  62. John Clarke wrote in a message to Jonathan de Boyne Pollard:
  63.  
  64.  JdBP> If it helps, the TEE in OS2CLU02.ZIP doesn't require any non-system 
  65.  JdBP> DLLs other than the one that is supplied along with it in the very 
  66.  JdBP> same archive.
  67.  
  68. JC> I would appreciate it if you would email a copy of this file to me
  69. JC> at the email address below or point me towards a place where I can
  70. JC> grab it from the 'net. 
  71.  
  72. You can pick it up at http://www.riverbbs.net in the files section.  Also at
  73. telnet://riverbbs.net.
  74.  
  75. L8r,
  76.                        Ron
  77.  
  78. ... Keep your OS/2 system healthy by practicing safe REXX.
  79.  
  80. ---
  81.  * Origin: River Canyon Rd. BBS  Chattanooga,TN  423-886-2521 (1:362/627)
  82.  
  83. +----------------------------------------------------------------------------+
  84.  
  85. From: Rich Wonneberger                                  09-Oct-99 10:18:00
  86.   To: David Noon                                        10-Oct-99 01:50:04
  87. Subj: hstart wget?
  88.  
  89. *** Quoting David Noon to Eddy Thilleman dated 10-07-99 ***
  90. >      IF check == 'READY:' THEN
  91. > Note the double equal sign.
  92.  
  93. David,
  94.  
  95. I've seen the double equal sign in DOS batch program.  What does this do thats 
  96. different then single equal?
  97.  
  98. TIA
  99. Rich
  100. I-Net   turtil@frontiernet.net
  101.  
  102.  
  103. ... Madness takes its toll.
  104. ---
  105.  * Origin: Turtil's Pond BBS. Monroe NY. 914-783-2106 (1:2625/50)
  106.  
  107. +----------------------------------------------------------------------------+
  108.  
  109. From: Eddy Thilleman                                    06-Oct-99 22:03:07
  110.   To: John Clarke                                       10-Oct-99 01:50:04
  111. Subj: hstart wget?
  112.  
  113. Hello John,
  114.  
  115. 02 Oct 99 19:31, John Clarke wrote to Eddy Thilleman:
  116.  
  117. ET>> I asked this in the wget mailing list, it is possible if you use
  118. ET>> a program 'tee' in addition:
  119.  
  120. JC> I'd appreciate a copy of 'tee' attached to my email address below if
  121. JC> you can organise it.
  122.  
  123. I've a tee but it needs a GNU lib file which I don't have.
  124.  
  125.   Greetings   -=Eddy=-        email: eddy.thilleman@net.hcc.nl
  126.  
  127. ... NT?  New Technology?  I don't think so...
  128. --- GoldED/2 3.0.1
  129.  * Origin: Windows98 is a graphic DOS extender (2:500/143.7)
  130.  
  131. +----------------------------------------------------------------------------+
  132.  
  133. From: Eddy Thilleman                                    06-Oct-99 22:04:24
  134.   To: Jonathan De Boyne Pollard                         10-Oct-99 01:50:04
  135. Subj: hstart wget?
  136.  
  137. Hello Jonathan,
  138.  
  139. 02 Oct 99 12:46, Jonathan de Boyne Pollard wrote to Eddy Thilleman:
  140.  
  141. ET>> (or use a tee version which doesn't need the gnushu lib files).
  142.  
  143. JP> If it helps, the TEE in OS2CLU02.ZIP doesn't require any non-system
  144. JP> DLLs other than the one that is supplied along with it in the very
  145. JP> same archive.
  146.  
  147. I haven't looked, but I'll in the weekend.
  148.  
  149.   Greetings   -=Eddy=-        email: eddy.thilleman@net.hcc.nl
  150.  
  151. ... I have shifting antigens. Don't even try to find a cure.
  152. --- GoldED/2 3.0.1
  153.  * Origin: Windows95 is a graphic DOS extender (2:500/143.7)
  154.  
  155. +----------------------------------------------------------------------------+
  156.  
  157. From: Eddy Thilleman                                    06-Oct-99 22:50:15
  158.   To: Jack Stein                                        10-Oct-99 01:50:04
  159. Subj: hstart wget?
  160.  
  161. Hello Jack,
  162.  
  163. 03 Oct 99 23:42, Jack Stein wrote to Eddy Thilleman:
  164.  
  165. JS> Something like that might work.
  166.  
  167. I don't know yet, I've too much work now. Later I could look at this (maybe).
  168.  
  169.   Greetings   -=Eddy=-        email: eddy.thilleman@net.hcc.nl
  170.  
  171. ... Windows Now Terminated
  172. --- GoldED/2 3.0.1
  173.  * Origin: Windows95 is a graphic DOS extender (2:500/143.7)
  174.  
  175. +----------------------------------------------------------------------------+
  176.  
  177. From: Eddy Thilleman                                    09-Oct-99 09:31:00
  178.   To: Mike Ruskai                                       10-Oct-99 01:50:04
  179. Subj: hstart wget?
  180.  
  181. Hello Mike,
  182.  
  183. 03 Oct 99 17:23, MIKE RUSKAI wrote to EDDY THILLEMAN:
  184.  
  185. MR> the read/write pointer is at the end.  The lines() function returns 1
  186. MR> if there's at least one line-end in the file (with the lines() method
  187. MR> of the stream class in OREXX, it actually counts the lines in the
  188. MR> file). The chars() function returns the character count remaining
  189. MR> ahead of the read/write pointer.
  190.  
  191. Thanks for the explanation.
  192.  
  193. OK, I choose Lines() because I read whole lines at a time.
  194.  
  195.   Greetings   -=Eddy=-        email: eddy.thilleman@net.hcc.nl
  196.  
  197. ... Lucky people gets OS/2, unfortunate people gets NT...
  198. --- GoldED/2 3.0.1
  199.  * Origin: Windows98 is a graphic DOS extender (2:500/143.7)
  200.  
  201. +----------------------------------------------------------------------------+
  202.  
  203. From: Ron Mitchell                                      09-Oct-99 20:25:24
  204.   To: Rich Wonneberger                                  10-Oct-99 01:50:04
  205. Subj: hstart wget?
  206.  
  207. Rich Wonneberger wrote in a message to David Noon:
  208.  
  209. RW> *** Quoting David Noon to Eddy Thilleman dated 10-07-99 ***
  210. >      IF check == 'READY:' THEN
  211. > Note the double equal sign.
  212.  
  213. RW> I've seen the double equal sign in DOS batch program.  What does
  214. RW> this do thats different then single equal?
  215.  
  216. == is a strict character by character string comparison.
  217.  
  218. =
  219.  
  220. Anything that can resolve to a numeric value is resolved and then compared
  221. mathematically.  Leading and trailing blanks are stripped.  Case sensitive.
  222.  
  223. ==
  224.  
  225. Strictly a string comparison.  Blanks are not stripped.  Case sensitive.
  226.  
  227. == is faster than = because of the lack of preprocessing.  It is also safer if 
  228. all you are interested in is a character by character comparison.
  229.  
  230. L8r,
  231.                        Ron
  232.  
  233. ... f y cn rd ths, y cn gt gd jbs n cmptr prgrmng.
  234.  
  235. ---
  236.  * Origin: River Canyon Rd. BBS  Chattanooga,TN  423-886-2521 (1:362/627)
  237.  
  238. +----------------------------------------------------------------------------+
  239.  
  240. From: John Clarke                                       08-Oct-99 20:52:19
  241.   To: Gord Hannah                                       10-Oct-99 19:23:11
  242. Subj: hstart wget?
  243.  
  244. On Oct 05, 1999 at 06:21 hrs, Gord Hannah of 1:17/23.1 wrote to John Clarke:
  245.  
  246. Hello Gord,
  247.  
  248.  GH> Replying to a message from John Clarke 3:713/730 to Eddy Thilleman,
  249.  
  250.  GH> About hstart wget?, On Sat Oct 02 1999
  251.  
  252. ET>> program 'tee' in addition:
  253.  
  254. JC>> I'd appreciate a copy of 'tee' attached to my email address below if
  255. JC>> you can organise it.
  256.  
  257.  GH> Pickup a copy of OS2CLU02.ZIP at hobbes, these utilities are 
  258.  GH> fantastic, mind you I am biased I am on the test team.
  259.  
  260. Thanks.   I will do so tonight.
  261.  
  262. Regards ... John
  263.  
  264. Email: jclarke@zip.com.au
  265.  
  266. --- MsgedSQ/2 3.30
  267.  * Origin: The Clearing House (3:713/730)
  268. 45
  269.  
  270. +----------------------------------------------------------------------------+
  271.  
  272. From: Rich Wonneberger                                  10-Oct-99 15:18:00
  273.   To: Ron Mitchell                                      10-Oct-99 19:23:11
  274. Subj: hstart wget?
  275.  
  276. *** Quoting Ron Mitchell to Rich Wonneberger dated 10-09-99 ***
  277. > == is a strict character by character string comparison.
  278. > =
  279. > Anything that can resolve to a numeric value is resolved and then 
  280. > compared mathematically.  Leading and trailing blanks are stripped.  
  281. > Case sensitive.
  282. > ==
  283. > Strictly a string comparison.  Blanks are not stripped.  Case 
  284. > sensitive.
  285.  
  286. Ron,
  287.  
  288. Thanks for the lesson.
  289. Is there any way to get a non case sensitive comparison??
  290.  
  291. Rich
  292. I-Net   turtil@frontiernet.net
  293.  
  294.  
  295. ... Editing is a rewording activity.
  296. ---
  297.  * Origin: Turtil's Pond BBS. Monroe NY. 914-783-2106 (1:2625/50)
  298.  
  299. +----------------------------------------------------------------------------+
  300.  
  301. From: David Noon                                        09-Oct-99 00:39:00
  302.   To: Mike Ruskai                                       11-Oct-99 23:10:20
  303. Subj: hstart wget?
  304.  
  305. In a message dated 10-03-99, Mike Ruskai said to Eddy Thilleman about
  306. "hstart wget?"
  307.  
  308. Hi Mike,
  309.  
  310.  ET>> do while stream( InFile, 'state' ) = 'READY'
  311.  
  312.  MR> lines() or chars() would be better here.
  313.  
  314.  ET> why?
  315.  
  316. MR>Because I don't see why a stream would fail to be ready simply because
  317. MR>the read/write pointer is at the end.
  318.  
  319. Well, it returns 'NOTREADY' when it hits end-of-file for the first time, and
  320. 'ERROR' for subsequent reads. [Assuming it was opened for read access.]
  321.  
  322. Regards
  323.  
  324. Dave
  325. <Team PL/I>
  326. ___
  327.  * MR/2 2.25 #353 * Windows Error: 003 - Windows found.  System halted.
  328.  
  329. --- Maximus/2 3.01
  330.  * Origin: Air Applewood, OS/2 Gateway to Essex 44-1279-792300 (2:257/609)
  331. 45
  332.  
  333. +----------------------------------------------------------------------------+
  334.  
  335. From: David Noon                                        09-Oct-99 00:41:01
  336.   To: John Clarke                                       11-Oct-99 23:10:20
  337. Subj: TEE command
  338.  
  339. In a message dated 10-02-99, John Clarke said to Eddy Thilleman about
  340. "hstart wget?"
  341.  
  342. Hi John,
  343.  
  344.  ET> I asked this in the wget mailing list, it is possible if you use a 
  345.  ET> program 'tee' in addition:
  346.  
  347. JC>I'd appreciate a copy of 'tee' attached to my email address 
  348. JC>below if you can organise it.
  349.  
  350. Since this is the OS2REXX echo, we can write our own!
  351.  
  352. ================================= TEE.CMD ==================================
  353. /* REXX version of the TEE command */
  354. PARSE ARG Arg_list
  355.  
  356. Append_flag = TRANSLATE(WORD(Arg_list,1))
  357. /* Remove the /A flag if supplied */
  358. IF Append_flag == '/A' THEN
  359. DO
  360.    Arg_list = STRIP(SUBSTR(Arg_list,3),'L')
  361.    Append_flag = 'APPEND'
  362. END
  363. ELSE
  364.    Append_flag = 'REPLACE'
  365.  
  366. /* Make sure at least 1 file was specified */
  367. IF LENGTH(Arg_list) = 0 THEN EXIT 12
  368.  
  369. File_name = .ARRAY~NEW(1)
  370. /* Parse the filenames into an array of strings */
  371. p = VERIFY(Arg_list,' ')
  372. DO i = 1 BY 1 WHILE p += 0
  373.    IF SUBSTR(Arg_list,p,1) == "'" | SUBSTR(Arg_list,p,1) == '"' THEN
  374.    DO
  375.       q = VERIFY(Arg_list,SUBSTR(Arg_list,p,1),'M',p+1)
  376.       p = p + 1
  377.       DO WHILE SUBSTR(Arg_list,q,1) == SUBSTR(Arg_list,q+1,1)
  378.          q = VERIFY(Arg_list,SUBSTR(Arg_list,p,1),'M',q+2)
  379.       END
  380.    END
  381.    ELSE
  382.       q = VERIFY(Arg_list,' ','M',p+1)
  383.  
  384.    IF q = 0 THEN q = LENGTH(Arg_list) + 1
  385.  
  386.    File_name[i] = SUBSTR(Arg_list,p,q-p+1)
  387.  
  388.    p = VERIFY(Arg_list,' ','N',q+1)
  389. END
  390.  
  391. /* Open a corresponding array of stream objects */
  392. File_stream = .ARRAY~NEW(File_name~ITEMS())
  393. DO i = 1 TO File_name~ITEMS()
  394.    File_stream[i] = .STREAM~NEW(File_name[i])~~OPEN('WRITE '||Append_flag)
  395. END
  396.  
  397. DROP File_name
  398.  
  399. /* Open standard devices */
  400. Stdin = .STREAM~NEW('STDIN:')~~OPEN('READ')
  401. Stdout = .STREAM~NEW('STDOUT:')~~OPEN('WRITE')
  402.  
  403. /* Copy the lines across */
  404. DO WHILE Stdin~STATE() == 'READY'
  405.     Line_buff = Stdin~LINEIN()
  406.     DO Output_file OVER File_stream
  407.        Output_file~LINEOUT(Line_buff)
  408.     END
  409.     Stdout~LINEOUT(Line_buff)
  410. END
  411.  
  412. DROP Output_file
  413.  
  414. /* Close all the files */
  415. DO i = File_stream~FIRST() TO File_stream~LAST()
  416.   File_stream[i]~CLOSE()
  417. END
  418.  
  419. Stdin~CLOSE()
  420. Stdout~CLOSE()
  421.  
  422. EXIT 0
  423. ============================================================================
  424.  
  425. As is my usual practice in this echo, I typed this code directly into my QWK
  426. reader, so it is totally untested. Note that it is in Object REXX.
  427.  
  428. Regards
  429.  
  430. Dave
  431. <Team PL/I>
  432. ___
  433.  * MR/2 2.25 #353 * Microsoft Windows: Proof that P.T. Barnum was correct.
  434.  
  435. --- Maximus/2 3.01
  436.  * Origin: Air Applewood, OS/2 Gateway to Essex 44-1279-792300 (2:257/609)
  437. 45
  438.  
  439. +----------------------------------------------------------------------------+
  440.  
  441. From: David Noon                                        09-Oct-99 20:29:00
  442.   To: John Clarke                                       11-Oct-99 23:10:20
  443. Subj: TEE command
  444.  
  445. In a message dated 10-09-99, David Noon said to John Clarke about "TEE
  446. command"
  447.  
  448. Hi John,
  449.  
  450. DN>Since this is the OS2REXX echo, we can write our own!
  451.  
  452. We can also improve it by removing the argument parsing and placing that
  453. into a new class library. This allows us to reuse that code wherever we want
  454. to convert an argument string into an array of values, in the manner typical
  455. of C/C++ start-up code.
  456.  
  457. ================================= TEE.CMD ==================================
  458. /* REXX version of the TEE command */
  459.  
  460. /* Build array of program arguments. Use the typical C/C++ name. */
  461. argv = .ARGARRAY~NEW(ARG(1))
  462.  
  463. /* Remove the /A flag if supplied */
  464. IF argv[1]~TRANSLATE() == '/A' THEN
  465. DO
  466.    argv~REMOVE(1)
  467.    Append_flag = 'APPEND'
  468. END
  469. ELSE
  470.    Append_flag = 'REPLACE'
  471.  
  472. /* Make sure at least 1 file was specified */
  473. IF argv~ITEMS() = 0 THEN EXIT 12
  474.  
  475. /* Open a corresponding array of stream objects */
  476. File_stream = .ARRAY~NEW(argv~ITEMS())
  477. i = 1
  478. DO File_name OVER argv
  479.    File_stream[j] = .STREAM~NEW(File_name)~~OPEN('WRITE '||Append_flag)
  480.    i = i + 1
  481. END
  482.  
  483. /* Finished with these */
  484. DROP argv Append_flag File_name
  485.  
  486. /* Open standard devices */
  487. Stdin = .STREAM~NEW('STDIN:')~~OPEN('READ')
  488. Stdout = .STREAM~NEW('STDOUT:')~~OPEN('WRITE')
  489.  
  490. /* Copy the lines across */
  491. DO WHILE Stdin~STATE() == 'READY'
  492.     Line_buff = Stdin~LINEIN()
  493.     DO Output_file OVER File_stream
  494.        Output_file~LINEOUT(Line_buff)
  495.     END
  496.     Stdout~LINEOUT(Line_buff)
  497. END
  498.  
  499. DROP Output_file
  500.  
  501. /* Close all the files */
  502. DO i = File_stream~FIRST() TO File_stream~LAST()
  503.   File_stream[i]~CLOSE()
  504. END
  505.  
  506. Stdin~CLOSE()
  507. Stdout~CLOSE()
  508.  
  509. EXIT 0
  510.  
  511. ::REQUIRES 'ARGARRAY.CMD'
  512. ============================================================================
  513.  
  514. And here is the class for forming arrays of arguments. It is actually a
  515. useful piece of code. You should put it in a PATH directory.
  516.  
  517. ============================== ARGARRAY.CMD ================================
  518. /* REXX class library to build argument arrays from character strings */
  519. /* such as command tails.                                             */
  520.  
  521. /* Author: David W. Noon, October 1999                                */
  522.  
  523. /* You may use this code freely, and redistribute it provided the     */
  524. /* original copyright caveat is retained and no charge is levied      */
  525. /* beyond the price of its distribution medium.                       */
  526.  
  527. /* No warranty is expressed or implied as to the suitability of this  */
  528. /* software to perform any given task, nor will the author accept     */
  529. /* liability for any damage or loss incurred by its use.              */
  530.  
  531. /* Copyright (C) 1999, David W. Noon.  All rights reserved.           */
  532.  
  533. ::CLASS ARGARRAY PUBLIC
  534.  
  535. ::METHOD INIT
  536.    EXPOSE Arg_array
  537.  
  538.    /* Only allow a single argument */
  539.    IF ARG() < 1 THEN RAISE SYNTAX 93.901 ADDITIONAL 1
  540.    IF ARG() > 1 THEN RAISE SYNTAX 93.902 ADDITIONAL 1
  541.  
  542.    /* Extract argument string */
  543.    Arg_string = ARG(1)~STRIP()
  544.  
  545.    /* Ensure it isn't a null string */
  546.    IF Arg_string~LENGTH() = 0 THEN RAISE SYNTAX 93.911 ADDITIONAL 1
  547.  
  548.    /* Build an array. */
  549.    Arg_array = .ARRAY~NEW(1)
  550.  
  551.    /* Now parse out the arguments into array elements */
  552.    DO i = 1 BY 1 UNTIL Arg_string~LENGTH() = 0
  553.       SELECT
  554.          WHEN Arg_string~LEFT(1) == "'" THEN
  555.          DO
  556.             r = Arg_string~VERIFY("'",'M',2)
  557.             DO WHILE r > 0 & Arg_string~SUBSTR(r+1,1) == "'"
  558.                r = Arg_string~VERIFY("'",'M',r+2)
  559.             END
  560.  
  561.             /* See if we have an unmatched apostrophe */
  562.             IF r = 0 THEN RAISE SYNTAX 6.2
  563.  
  564.             /* Ensure next character is comma or space */
  565.             IF r < Arg_string~LENGTH() THEN
  566.                IF VERIFY(' ,',Arg_string~SUBSTR(r+1,1),'M') = 0 THEN
  567.                   RAISE SYNTAX 22.1 ADDITIONAL(Arg_string~LEFT(r+1))
  568.  
  569.             Arg_array~PUT(SQUOTE(Arg_string~SUBSTR(2,r-2),"'"),i)
  570.          END
  571.  
  572.          WHEN Arg_string~LEFT(1) == '"' THEN
  573.          DO
  574.             r = Arg_string~VERIFY('"','M',2)
  575.             DO WHILE r > 0 & Arg_string~SUBSTR(r+1,1) == '"'
  576.                r = Arg_string~VERIFY('"','M',r+2)
  577.             END
  578.  
  579.             /* See if we have an unmatched quote */
  580.             IF r = 0 THEN RAISE SYNTAX 6.3
  581.  
  582.             /* Ensure next character is comma or space */
  583.             IF r < Arg_string~LENGTH() THEN
  584.                IF VERIFY(' ,',Arg_string~SUBSTR(r+1,1),'M') = 0 THEN
  585.                   RAISE SYNTAX 22.1 ADDITIONAL(Arg_string~LEFT(r+1))
  586.  
  587.             Arg_array~PUT(SQUOTE(Arg_string~SUBSTR(2,r-2),'"'),i)
  588.          END
  589.  
  590.          WHEN Arg_string~LEFT(1) == ',' THEN
  591.          DO
  592.             r = 1
  593.             Arg_array~PUT('',i)
  594.          END
  595.  
  596.          OTHERWISE
  597.          DO
  598.             r = Arg_string~VERIFY(" ,",'M')
  599.             IF r = 0 THEN r = Arg_string~LENGTH() + 1
  600.             Arg_array~PUT(Arg_string~SUBSTR(1,r-1),i)
  601.          END
  602.       END
  603.  
  604.       Arg_string = Arg_string~DELSTR(1,r)~STRIP('L')
  605.    END
  606.  
  607. RETURN
  608.  
  609. /* Fake inheritance */
  610. ::METHOD UNKNOWN
  611.    EXPOSE Arg_array
  612.  
  613.    USE ARG Method_name, Parm_array
  614.  
  615.    FORWARD MESSAGE(Method_name) TO(Arg_array) ARGUMENTS(Parm_array) CONTINUE
  616. RETURN RESULT
  617.  
  618. /* Internal subroutine to condense doubled quote marks */
  619. ::ROUTINE SQUOTE
  620.  
  621.    Str = ARG(1)
  622.    Qt = ARG(2)
  623.  
  624.    p = VERIFY(Str,Qt,'M')
  625.    DO WHILE p > 0
  626.       IF Str~SUBSTR(p+1,1) == Qt THEN Str = Str~DELSTR(p+1,1)
  627.       p = VERIFY(Str,Qt,'M',p+1)
  628.    END
  629.  
  630. RETURN Str
  631. ============================================================================
  632.  
  633. And this still applies to TEE.CMD ...
  634.  
  635. DN>As is my usual practice in this echo, I typed this code directly into my
  636. DN>QWK reader, so it is totally untested. Note that it is in Object REXX.
  637.  
  638. Regards
  639.  
  640. Dave
  641. <Team PL/I>
  642. ___
  643.  * MR/2 2.25 #353 * Buy the dog, get the fleas free of charge.
  644.  
  645. --- Maximus/2 3.01
  646.  * Origin: Air Applewood, OS/2 Gateway to Essex 44-1279-792300 (2:257/609)
  647. 45
  648.  
  649. +----------------------------------------------------------------------------+
  650.  
  651. From: MIKE RUSKAI                                       11-Oct-99 04:58:00
  652.   To: DAVID NOON                                        11-Oct-99 23:10:20
  653. Subj: hstart wget?
  654.  
  655. Some senseless babbling from David Noon to Mike Ruskai
  656. on 10-09-99  00:39 about hstart wget?...
  657.  
  658.  DN> In a message dated 10-03-99, Mike Ruskai said to Eddy Thilleman about
  659.  DN> "hstart wget?"
  660.  
  661.  DN> Hi Mike,
  662.  
  663.  ET>> do while stream( InFile, 'state' ) = 'READY'
  664.  
  665.  MR> lines() or chars() would be better here.
  666.  
  667.  ET> why?
  668.  
  669.  MR>Because I don't see why a stream would fail to be ready simply because
  670.  MR>the read/write pointer is at the end.
  671.  
  672.  DN> Well, it returns 'NOTREADY' when it hits end-of-file for the first
  673.  DN> time, and 'ERROR' for subsequent reads. [Assuming it was opened for
  674.  DN> read access.] 
  675.  
  676. I guess that'd work.  But if it's opened for read/write access, it
  677. certainly wouldn't.  That's probably why I got in the habit of using
  678. lines() or chars() early on.
  679.  
  680. Mike Ruskai
  681. thannymeister@yahoo.com
  682.  
  683.  
  684. ... And then Lancelot, Sir Robin and I will jump out of the rabbit... uhhh
  685.  
  686. ___ Blue Wave/QWK v2.20
  687. --- Platinum Xpress/Win/Wildcat5! v3.0pr2
  688.  * Origin: FIDO QWK MAIL & MORE!  WWW.DOCSPLACE.ORG (1:3603/140)
  689. 45
  690.  
  691. +----------------------------------------------------------------------------+
  692.  
  693. From: Eddy Thilleman                                    10-Oct-99 16:06:10
  694.   To: David Noon                                        11-Oct-99 23:10:20
  695. Subj: hstart wget?
  696.  
  697. Hello David,
  698.  
  699. 07 Oct 99 17:41, David Noon wrote to Eddy Thilleman:
  700.  
  701. DN> The definitive test is really an exact byte comparison on the string:
  702.  
  703. DN>      IF check == 'READY:' THEN
  704.  
  705. DN> Note the double equal sign.
  706.  
  707. I had tried that first, but once the ':' was present and another try the ':'
  708. was not present (with the same syntax?), so I was confused and didn't try
  709. more.
  710.  
  711. DN> I don't see any reason. In fact, checking the STATE would be
  712. DN> marginally less overhead. Again, I would recommend an exact byte
  713. DN> comparison:
  714.  
  715. DN>      DO WHILE STREAM(InFile,'STATE') == 'READY'
  716.  
  717. But when "READY:" is returned this returnes false? But I don't have time to
  718. investigate this now.
  719.  
  720.   Greetings   -=Eddy=-        email: eddy.thilleman@net.hcc.nl
  721.  
  722. ... "All constants are variables." -- Murphy's Law of Mathematics
  723. --- GoldED/2 3.0.1
  724.  * Origin: Windows98 is a graphic DOS extender (2:500/143.7)
  725.  
  726. +----------------------------------------------------------------------------+
  727.  
  728. From: Eddy Thilleman                                    10-Oct-99 21:38:00
  729.   To: All                                               11-Oct-99 23:10:20
  730. Subj: start wget
  731.  
  732. Hello All,
  733.  
  734. the for...in...do that calls (in the same session) or starts (in a separate
  735. session) the wgetmir.cmd REXX file  in combination with redirection to nul
  736. results in weird behavior (the log file names gets a space in the middle and
  737. the log output of wget is placed in the file with the url's listed). I don't
  738. know why this is, it took some time before I found the solution: leave out the 
  739. redirection.
  740.  
  741. ------------------- begin of startwget.cmd -------------------
  742. @echo off
  743. c:
  744. cd \www
  745.  
  746. call cheap
  747. if not errorlevel 1 exit
  748.  
  749. if exist wget.ftp call wgetftp
  750. for %%a in (wget*mirror) do call wgetmirror %%a
  751. for %%a in (wget*mir)    do call wgetmir %%a
  752. for %%a in (wget*news)   do start /win /c /b wgetnews %%a
  753. for %%a in (wget*www)    do start /win /c /b wgetwww %%a
  754. for %%a in (wget*x)      do start /win /c /b wgetx %%a
  755. exit
  756. -------------------- end of startwget.cmd --------------------
  757.  
  758. In wgetmir.cmd I use the arg() function instead the arg keyword to get the
  759. filename to prevent the filename is uppercased (parse arg would do too
  760. according to the REXX INF file).
  761.  
  762.   Greetings   -=Eddy=-        email: eddy.thilleman@net.hcc.nl
  763.  
  764. ... Windows?  Honey don't play that!
  765. --- GoldED/2 3.0.1
  766.  * Origin: Windows98 is a graphic DOS extender (2:500/143.7)
  767.  
  768. +----------------------------------------------------------------------------+
  769.  
  770. From: Francois Massonneau                               11-Oct-99 08:35:04
  771.   To: All                                               12-Oct-99 06:42:22
  772. Subj: FrontDoor/Mailser and Rexx
  773.  
  774. Hello !
  775.  
  776. This is a question I 've just asked in the FrontDoor echo, but I guess someone 
  777. in this one can help me to succeed in this process, as everything could be
  778. manage by a rexx script.
  779. This is the question :
  780. >------------------------------------------------------------------------------
  781. ----------------
  782. I need to run a mail server every 3 and a half hours and I would like :
  783.      - front door to exit, (I use a .BAT file to run frontdoor (2.30mL)).
  784.      - then run the Rexx Script (I 'm using OS/2) that takes care of my mail
  785. server, 
  786.      - wait for the script to complete (sometimes, it takes 3 or 4 minutes,
  787. but sometimes it takes longer).
  788.      - kill all applis that have been launched by the script, and the script
  789. itself, if it takes more that xx minutes (as I'm charged for every minutes on
  790. line, I can't afford to stay connected to my ISP if something goes wrong with
  791. it).
  792.      - then check the com port (I saw that from time to time some problems
  793. occur when the script ended).
  794.      - then restart frontdoor if everything above is ok, else, kill all the
  795. nodes (I run a two nodes BBS), and restart them.
  796.  
  797. I know there is a program to kill which name is "GO.EXE"(go -k appli.exe) but
  798. I saw that from time to time, when I want to kill an appli (I use it to kill
  799. InetMail, pop3d.exe, smtpd.exe and In-joy.exe), it kill my node 1 (which runs
  800. on my com1, !! (((-: )
  801. I use HSTART to start an OS/2 appli from a dos batch file too.
  802.  
  803. So the questions : 
  804.  
  805. 1) does someone can help me and show me what are the lines I have to add to my 
  806. batch file that runs that node to do what I need above and secure the whole
  807. process (I have to leave my system on its own for 3 or 4 weeks maybe more
  808. (when you enter in an hospital you don't know when and how you go out ;-( ) ?
  809.  
  810. 2) (deleted as it's off topic with this echo)....../.
  811.  
  812.  
  813. >------------------------------------------------------------------------------
  814. ----------------
  815.  
  816. in the next message I'm gonna post the script I use to run this mail server.
  817. I'm sorry it's a long script but many told me to post it in this echo, so I'm
  818. gonna do it, and ask the problems I have with it.
  819.  
  820. Bye, Francois!
  821.  
  822.  
  823. Email: fmas@celtes.com
  824. Web  : http://www.worldnet.net/~island/
  825.  
  826. ---
  827.  * Origin: Island's BBS, a Node in the Atlantic Ocean (2:326/2)
  828.  
  829. +----------------------------------------------------------------------------+
  830.  
  831. From: Francois Massonneau                               11-Oct-99 08:42:04
  832.   To: All                                               12-Oct-99 06:42:23
  833. Subj: (1/2) The Dialup (dve.cmd) script
  834.  
  835. Hello !
  836.  
  837. First, I have to apologize, because it's a very, very long message
  838. Second, I'm a total newbie with rexx, so in your reply, please give me the
  839. exact lines of code, as I won't be able to deal with just advices, I'm too
  840. short in time, as I have to leave home in 15 days.
  841.  
  842. This is the script I use to run my mail server, the questions are after it :
  843.  
  844. >==============================================================================
  845. =========
  846. /* REXX script for InetMail - Written by Paul Hethmon, and modify by many
  847. people */
  848. /*
  849.  * This program designed to control Inet.Mail in a dialup situation.
  850.  * 
  851.  * Orignial Script available at:
  852.  *     ftp://ftp.hethmon.com/hethmon/pub/scripts/dialup.zip
  853.  *
  854.  * This script depends on two external programs:
  855.  *
  856.  *   etrn.exe  --  Available from Hethmon Brothers
  857.  *     ftp://ftp.hethmon.com/hethmon/pub/scripts/etrn.zip
  858.  *
  859.  *   go.exe    -- Available from Hethmon Brothers
  860.  *     ftp://ftp.hethmon.com/hethmon/pub/scripts/go.zip
  861.  *
  862.  * When you start Inet.Mail, you must use 3 command line flags:
  863.  *
  864.  *   -ready
  865.  *   -queue
  866.  *   -relay
  867.  *
  868.  * You must also create two files in the Inet.Mail main directory:
  869.  *
  870.  *   noqueue
  871.  *   norelay
  872.  *
  873.  * The file contents do not matter. A simple way of creating them is
  874.  * to redirect the output of the dir command: dir > noqueue
  875.  *
  876.  * These two files are used as flag files to communicate between this
  877.  * script and Inet.Mail.*/
  878.  
  879. /* ------------------------ Beginning of Variable declarations
  880. -------------------------------- */
  881. /* This section of variables must be set to local values. */
  882.  
  883. InetMailDir = 'f:\inetmail'               /* Your InetMail directory  */
  884. DialerDir = 'e:\injoy'                    /* Your Dialer directory  */
  885. SemaforeDir = 'c:\fd\sem'                 /* The directory where you want a
  886. semafore file to */
  887.                                           /* be created  */
  888. DialupLogFile = 'f:\inetmail\dialup.log'  /*  The logfile and its path  */
  889.  
  890. SleepTime = (60 * 225 * 1)                /* Amount of time between
  891. connections in seconds */
  892.                                           /* template : seconds * minutes *
  893. hours */
  894.  
  895. RemoteServer = 'relay.worldnet.net'       /* Remote server to contact for mail 
  896. download */
  897.                                           /* Must be an ip name. */
  898. MailDomains = 'celtes.com'                /* The mail domain the remote server 
  899. is queueing for. */
  900.                                           /* This is the name of your mail
  901. domain as in  */
  902.                                           /* user@domain.com would be
  903. domain.com. You may enter */
  904.                                           /* multiple ip names here as needed. 
  905. Every domain you */
  906.                                           /* have email queued for must be
  907. listed. */
  908.  
  909. ImRelayFile = InetMailDir||'\norelay'     /* Inet.Mail relay file. The file is 
  910. always called  */
  911.                                           /* "norelay". Just add the full path 
  912. to it here. */
  913. ImReadyFile = InetMailDir||'\ready'       /* Inet.Mail ready file. The file is 
  914. always called */
  915.                                           /* "ready". Just add the full path
  916. to it here. */
  917. ImQueueFile = InetMailDir||'\noqueue'     /* Inet.Mail queue file. The file is 
  918. always called */
  919.                                           /* "noqueue". Just add the full path 
  920. to it here. */
  921. SpoolDir = InetMailDir||'\spool'          /* Inet.Mail spool Directory. The
  922. file is always */
  923.                                           /* *.spl. Just add the full path to
  924. it here. */
  925.  
  926. Etrn = InetMailDir||'\etrn.exe'           /* ETRN program */
  927. DialerProg = 'In-joy.exe'                 /* Your Dialer Program */
  928. DialIsp = DialerDir||'\in-joy.exe auto'   /* If your dialer needs any command
  929. line parameters to */
  930.                                           /* automatically dial, then place
  931. them here */
  932. KillDialer = DialerDir||'\killjoy.exe'    /* Kill program to hangup the
  933. dialer. If your dialer */
  934.                                           /* has a command which will cause it 
  935. to hang up. You */
  936.                                           /* may substitute it here*/
  937. CheckIfRunning = 'go.exe -cp'             /* Program to run to check if an
  938. appli is running */
  939. kill = 'go.exe -k'                        /* Kill program to kill The applis
  940. that could run and */
  941.                                           /* need to be killed. */
  942.  
  943. SemaMailer = SemaforeDir||'\inetmail.sem' /* Name, Drive and Directory of the
  944. semafore file you */
  945.                                           /* want the script to create once it 
  946. has run */
  947.  
  948. InetMail=inetmail                         /* define apps */
  949. pop3d=pop3d                               /* define apps */
  950. smtpd=smtpd                               /* define apps */
  951.  
  952. FireUpIM = InetMailDir||'\'||InetMail ' -l -vis -checkpoint -relay -ready
  953. -queue -hops 30'  /* How */
  954.                                           /* you fire up InetMail, and which
  955. parameters do you */
  956.                                           /* need for it */
  957.  
  958. /* --------------------------- End of Variable declarations
  959. ----------------------------------- */
  960.  
  961.  
  962. /* For non english speaking user : we change the day given in the log file
  963. from english to french */
  964. DayoftheWeek = date('W')
  965.  if DayoftheWeek = 'Sunday' then
  966.     JourdelaSemaine = 'Dimanche'
  967.  if DayoftheWeek = 'Monday' then
  968.     JourdelaSemaine = 'Lundi'
  969.  if DayoftheWeek = 'Tuesday' then
  970.     JourdelaSemaine = 'Mardi'
  971.  if DayoftheWeek = 'Wednesday' then
  972.     JourdelaSemaine = 'Mercredi'
  973.  if DayoftheWeek = 'Thursday' then
  974.     JourdelaSemaine = 'Jeudi'
  975.  if DayoftheWeek = 'Friday' then
  976.     JourdelaSemaine = 'Vendredi'
  977.  if DayoftheWeek = 'Saturday' then
  978.     JourdelaSemaine = 'Samedi'
  979. /* End of the french translation */
  980.  
  981. CurDir = directory()
  982.  
  983. /* Set to 1 to enable debug output */
  984. Debug = TRUE
  985.  
  986. /* Set to 1 to enable logging */
  987. Log = TRUE
  988.  
  989. DialupVersion = 'v.1.6'
  990. DialupRevision = '0.07'
  991. DialupDate = '11 October 1999'
  992. high = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
  993. low = 'abcdefghijklmnopqrstuvwxyz'
  994. Env = 'OS2ENVIRONMENT'
  995. FALSE = 0
  996. TRUE = 1
  997. CRLF='0d0a'x
  998. Start = 'start'
  999.  
  1000. /* Rexx Socket variables */
  1001. domain = 'AF_INET'
  1002. server.!family = 'AF_INET'
  1003. server.!port = 25
  1004. server.!addr = RemoteServer
  1005.  
  1006. /* The external functions we need */
  1007. call RxFuncAdd 'SysCls', 'RexxUtil', 'SysCls'
  1008. call RxFuncAdd 'SysFileDelete', 'RexxUtil', 'SysFileDelete'
  1009. call RxFuncAdd 'SysFileTree', 'RexxUtil', 'SysFileTree'
  1010. call RxFuncAdd 'SysSleep', 'RexxUtil', 'SysSleep'
  1011. call RxFuncAdd 'SockLoadFuncs', 'rxSock', 'SockLoadFuncs'
  1012. rc = SockLoadFuncs()
  1013. rc = SockInit()
  1014.  
  1015. /* start main function, we ignore any arguments */
  1016.  
  1017.  
  1018. /* Endless loop */
  1019. do while 1
  1020.  
  1021.  /*  We start the dial process, so it's time to write the log file */
  1022.  call LINEOUT DialupLogFile, ' '
  1023.  call LINEOUT DialupLogFile, '------/' 'DialUp Script' DialupVersion
  1024. 'rev.'DialupRevision ':' JourdelaSemaine date() '-' Time() '/------'
  1025.  call LINEOUT DialupLogFile, ' '
  1026.  call LINEOUT DialupLogFile, date() time() 'Started dialup up process ...' 
  1027.  
  1028.  /* lets attempt to shutdown dialer and mail server; in case it's running
  1029. already */
  1030.  /* we should really test if it runs 1st... but, we'll just 'dumb kill all'
  1031. for now */
  1032.  call SysCls
  1033.  say '--------------------------------------------------------------------'
  1034.  say '...we will try to shutdown dialer and mail server before we start...'
  1035.  say '--------------------------------------------------------------------'
  1036.  call LINEOUT DialupLogFile, date() time() '    dialer, if running, is
  1037. killed.' 
  1038.  KillDialer
  1039.  call SysSleep(2)
  1040.  call LINEOUT DialupLogFile, date() time() '    inetmail, if running, is
  1041. killed.' 
  1042.  kill inetmail
  1043.  call SysSleep(2)
  1044.  call LINEOUT DialupLogFile, date() time() '    pop3d process, if running, is
  1045. killed.' 
  1046.  kill pop3d
  1047.  call SysSleep(2)
  1048.  call LINEOUT DialupLogFile, date() time() '    smtpd process, if running, is
  1049. killed.' 
  1050.  kill smtpd
  1051.  call SysSleep(2)   /* just give it a little time to shut down... */
  1052.  
  1053.  /* Check for time of day - if outside business hours don't do anything */
  1054.  /* Check for day of week - if Saturday or Sunday don't do anything */
  1055. /*  IF (time('H') < '05:00:00') | (time('H') > '22:00:00') | (date('Base')//7
  1056. > 4) then do
  1057.     say "Outside working hours. Sleeping..."
  1058.     call SysSleep(SleepTime)
  1059.     iterate
  1060.     end
  1061.   else
  1062. */
  1063.  /* First we have to change to the Dialer directory */
  1064.  newdir = directory(DialerDir)
  1065.  
  1066.  /* Start the dialer */
  1067.  call SysCls
  1068.  say '--------------------------------------------------------------------'
  1069.  say 'Starting dialer ...                                                 '
  1070.  say '...starting InJoy dialer in another session...                      '
  1071.  say '--------------------------------------------------------------------'
  1072.  call LINEOUT DialupLogFile, date() time() '. Starting the Internet Dialer
  1073. ...' 
  1074.  Start '"Internet Dialer" /C' DialIsp
  1075.  
  1076.  /* return to script directory */
  1077.  newdir = directory(CurDir)
  1078.  
  1079.  /* We 're testing the server */
  1080.  
  1081.  /* We give dialer some time to negotiate and complete connection, then, start 
  1082. testing if TCP/IP is 'UP' */
  1083.  say "...let's sit'n'wait till connection is established before we try
  1084. anything..."
  1085.  say '...testing if a link has been established...'
  1086.  
  1087.  DO ii=1 to 24  /* test for connection up to 24*5 = 120 seconds */
  1088.   rc = SockGetHostByName(RemoteServer, "host.!")
  1089.   if (rc = 1) then do
  1090.    say '..we can resolve hostnames, connection is up...'
  1091.    call LINEOUT DialupLogFile, date() time() '   We can resolve hostnames,
  1092. connection is up...'
  1093.    call directory InetMailDir
  1094.    call LINEOUT DialupLogFile, date() time() '   InetMail, Pop3d and Smtpd are 
  1095. started...'
  1096.    '@start ' FireUpIM             /* We have to restart InetMail */
  1097.    call SysSleep(1)
  1098.    call directory CurDir
  1099.    leave
  1100.   end
  1101.   say '...no connection yet, wait, then test again...'
  1102.   call LINEOUT DialupLogFile, date() time() '   warning ! no connection yet,
  1103. wait, then test again...' 
  1104.   call SysSleep(5)
  1105.  end                      /* do */
  1106.  
  1107.  /* Check for a live connection */
  1108.  
  1109.  say '--------------------------------------------------------------------'
  1110.  say 'Check for a live connection, starting mail processing ...        '
  1111.  say '--------------------------------------------------------------------'
  1112.  
  1113.  call LINEOUT DialupLogFile, date() time() '. Starting of the PingServer
  1114. procedure ...' 
  1115.  rc = PingServer()
  1116.  
  1117.  /* a rc of 0 means we can connect, so start some stuff */
  1118.  if (rc == 0) then do
  1119.  
  1120.   /* We need to delete the queue file, otherwise smtpd will*/
  1121.   /* never wake up and check the queue for mail to be sent */                  
  1122.                                   
  1123.   say 'Deleting the outgoing mail queue flag file...'
  1124.   call LINEOUT DialupLogFile, date() time() '   deleting the outgoing Mail
  1125. Queue Flag.' 
  1126.   rc = SysFileDelete(ImQueueFile);
  1127.  
  1128.   /* Start the etrn program to pick up the new mail waiting */
  1129.   say 'Starting etrn program ...'
  1130.   call LINEOUT DialupLogFile, date() time() '. sending the ETRN signals ...' 
  1131.   do i = 1 to words(MailDomains)
  1132.    TmpDomain = word(MailDomains, i)
  1133.    etrn RemoteServer TmpDomain
  1134.   end
  1135.  
  1136.   /* We need to wait for at least the time between queue checks */
  1137.   /* for the outgoing mail process to start delivering mail and */
  1138.   /* delete the ready file before we check for its existence.   */
  1139.   call LINEOUT DialupLogFile, date() time() '   sleeping for 30 seconds ...' 
  1140.   Call SysSleep(30)
  1141.  
  1142.   /* Now wait for Inet.Mail to tell us it is done sending the */
  1143.   /* queued mail by checking for the existence of the ready file*/
  1144.   say 'Waiting for queue delivery to complete ...'
  1145.   call LINEOUT DialupLogFile, date() time() '   waiting for queue delivery to
  1146. complete ...' 
  1147.   Waiting = TRUE
  1148.   do while (Waiting == TRUE)
  1149.    rc = SysFileTree(ImReadyFile, "s.", 'F')
  1150.    if (s.0 == 1) then Waiting = FALSE
  1151.   end
  1152.   say 'Queue delivery complete.'
  1153.   call LINEOUT DialupLogFile, date() time() '   queue delivery complete ...' 
  1154.  
  1155.   /* Now we check that incoming mail delivery has completed.*/
  1156.   /* by checking for the presence of *.spl in the spool directory.*/
  1157.   /* Now we check that incoming mail delivery has completed.*/
  1158.   /* by checking for the presence of *.spl in the spool directory.*/
  1159.   Incoming = TRUE
  1160.   call LINEOUT DialupLogFile, date() time() '   waiting for Incoming mail
  1161. delivery to complete ...' 
  1162.   do while (Incoming == TRUE)
  1163.    rc = SysFileTree(SpoolDir'\*.spl', files., 'FO')
  1164.    if (files.0 == 0) then Incoming = FALSE
  1165.    call LINEOUT DialupLogFile, date() time() '   now waiting for 30 seconds
  1166. ...' 
  1167.    call SysSleep(30) /* We wait a little bit for the server to send the mail
  1168. */
  1169.   end
  1170.   say 'Incoming mail delivery complete.'
  1171.   call LINEOUT DialupLogFile, date() time() '   incoming mail delivery
  1172. complete ...' 
  1173.  
  1174.   /* Recreate the queue file to put the queue check process */
  1175.   /* back to sleep.                                         */
  1176.   call LINEOUT DialupLogFile, date() time() '   recreating the noqueue flag
  1177. file.' 
  1178.   rc = stream(ImQueueFile, 'c', 'open')
  1179.   rc = lineout(ImQueueFile, 'noqueue')
  1180.   rc = stream(ImQueueFile, 'c', 'close')
  1181.   end
  1182.  
  1183.  else do
  1184.  call LINEOUT DialupLogFile, date() time() '. Warning : Unable to connect to
  1185. remote Sever. Skipping connection.' 
  1186.  say 'Unable to connect to remote server. Skipping connection.'
  1187.  call LINEOUT DialupLogFile, date() time() '   and we go to sleep for a while
  1188. - 10 seconds.' 
  1189.  call SysSleep(10)
  1190.  end
  1191.  
  1192.  /* Now kill the dialer. Crude but necessary. */
  1193.  say 'Hanging up the dialer...'
  1194.  call LINEOUT DialupLogFile, date() time() '. Hanging up ...' 
  1195.  /* get current directory */
  1196.  curdir = directory()
  1197.  
  1198.  /* go stop injoy */
  1199.  newdir = directory(DialerDir)
  1200.  call LINEOUT DialupLogFile, date() time() '   we kill the Dialer, Crude but
  1201. necessary ...' 
  1202.  KillDialer
  1203.  call SysSleep(2)
  1204.  call LINEOUT DialupLogFile, date() time() '   InetMail is killed.' 
  1205.  kill InetMail
  1206.  call SysSleep(2)
  1207.  call LINEOUT DialupLogFile, date() time() '   Pop3d process is killed.' 
  1208.  kill pop3d
  1209.  call SysSleep(2)
  1210.  call LINEOUT DialupLogFile, date() time() '   Smtpd process is killed.' 
  1211.  kill smtpd
  1212.  
  1213.   /* return to script directory */
  1214.   newdir = directory(CurDir)
  1215.   call LINEOUT DialupLogFile, date() time() '. Sleeping for' SleepTime
  1216. 'seconds...'
  1217.   call LINEOUT DialupLogFile, date() time() 'End of the script'
  1218.   call LINEOUT DialupLogFile
  1219.  
  1220.   /* And we will take some rest before working again */
  1221.   say '--------------------------------------------------------------------'
  1222.   say 'Sleeping for' SleepTime 'seconds at' time() 'on' date() '...'
  1223.   say '--------------------------------------------------------------------'
  1224.   call SysSleep(SleepTime)
  1225.  
  1226.   /* Now it's time to create the semafore file your mailer is waiting */
  1227.   rc = stream(SemaMailer, 'c', 'open')
  1228.   rc = lineout(SemaMailer, 'inetmail semafore file')
  1229. ---
  1230.  * Origin: Island's BBS, a Node in the Atlantic Ocean (2:326/2)
  1231.  
  1232. +----------------------------------------------------------------------------+
  1233.  
  1234. From: Francois Massonneau                               11-Oct-99 08:42:04
  1235.   To: All                                               12-Oct-99 06:42:23
  1236. Subj: 2 (1/2) The Dialup (dve.cmd) script
  1237.  
  1238.   rc = stream(SemaMailer, 'c', 'close')
  1239.  
  1240.   end         /* This is the End of the Do for the Endless Loop */
  1241.  
  1242. /* exit */
  1243.  
  1244. /* ------------------------------------------------------ */
  1245.  
  1246. /* ---------------------------------------------- */
  1247. /* This function makes a connection to the remote mail server to */
  1248. /* check that the dialup connection has been made successfully. */
  1249.  
  1250. PingServer: procedure expose server. domain RemoteServer CRLF
  1251. say 'PingServer'
  1252.  
  1253. iTimes = 0
  1254. iRc = 1
  1255.  
  1256. rc = SockGetHostByName(RemoteServer, "host.!")
  1257. if (rc = 0) then do
  1258.  say 'Unable to resolve hostname'
  1259.  call LINEOUT DialupLogFile, date() time() 'Unable to resolve hostname ...' 
  1260.  return iRc
  1261.  end
  1262.  
  1263. /* save the ip address */
  1264. server.!addr = host.!addr
  1265.  
  1266. do while (iTimes < 30)
  1267.   say 'save the IP address ...'
  1268.   if (iTimes > 0) then do
  1269.     call SysSleep(10)                   /* go to sleep for a while - 10
  1270. seconds */
  1271.     end
  1272.  
  1273.   /* create a new socket */
  1274.   say 'Creating socket ...'
  1275.   sock = SockSocket('AF_INET', 'SOCK_STREAM', 0)
  1276.   if (sock < 0) then do
  1277.     iTimes = iTimes + 1
  1278.     iterate
  1279.     end
  1280.  
  1281.   /* connect to the remote server */
  1282.   say 'Connecting to server ...'
  1283.   call SysSleep(15)                     /* go to sleep for a while - 15
  1284. seconds */
  1285.   rc = SockConnect(sock, "server.!")
  1286.   if (rc < 0) then do
  1287.     say 'Error on SockConnect =' errno
  1288.     rc = SockClose(sock)
  1289.     iTimes = iTimes + 1
  1290.     iterate
  1291.     end
  1292.  
  1293.   /* get the greeting */
  1294.   say 'Getting the greeting ...'
  1295.   rc = SockRecv(sock, greeting, 1024)
  1296.   if (rc < 0) then do
  1297.     rc = SockClose(sock)
  1298.     iTimes = iTimes + 1
  1299.     iterate
  1300.     end
  1301.   say 'Server greeting: ' greeting
  1302.  
  1303.   /* Send a nice reply */
  1304.   rc = SockSend(sock, 'ehlo'CRLF)
  1305.   if (rc < 0) then do
  1306.     rc = SockClose(sock)
  1307.     iTimes = iTimes + 1
  1308.     iterate
  1309.     end
  1310.  
  1311.   /* get the response */
  1312.   rc = SockRecv(sock, greeting, 1024)
  1313.   if (rc < 0) then do
  1314.     rc = SockClose(sock)
  1315.     iTimes = iTimes + 1
  1316.     iterate
  1317.     end
  1318.   say 'Server helo response: ' greeting
  1319.  
  1320.   /* And a closing response */
  1321.   rc = SockSend(sock, 'quit'CRLF)
  1322.   if (rc < 0) then do
  1323.     rc = SockClose(sock)
  1324.     iTimes = iTimes + 1
  1325.     iterate
  1326.     end
  1327.  
  1328.   /* Must have completed ok */
  1329.   iRc = 0
  1330.   leave
  1331.   end
  1332.  
  1333. return iRc
  1334. /* end of function */
  1335.  
  1336. /* ------------------------------------------------------ */
  1337.  
  1338. >==============================================================================
  1339. =========
  1340.  
  1341. And now the first questions :
  1342.  
  1343. 1°) At the beginning of the script you find those lines :
  1344.  KillDialer
  1345.  call SysSleep(2)
  1346.  kill inetmail
  1347.  call SysSleep(2)
  1348.  kill pop3d
  1349.  call SysSleep(2)
  1350.  kill smtpd
  1351. (I've removed the lineout lines).
  1352.  
  1353. As you can see, I kill, using "go.exe", four applis (the dialer,
  1354. Inetmail, pop3d and smtpd).
  1355. I would like first to kill them, ONLY if they run.
  1356. Actually the script tries to kill them each time it is run, and the output
  1357. gives some error warnings (the script works but I do not like those
  1358. warning) . This is what I get :
  1359. --------------------------------------------------------------------
  1360. ...we will try to shutdown dialer and mail server before we start...
  1361. --------------------------------------------------------------------
  1362. [E:\tmp]e:\injoy\killjoy.exe
  1363. [E:\tmp]go.exe -k INETMAIL
  1364. GO! v1.5 - (c) 1993-95 by Carsten Wimmer <cawim@train.oche.de>
  1365. Querying pid for process <INETMAIL.EXE> ... Error ...
  1366. [E:\tmp]go.exe -k POP3D
  1367. GO! v1.5 - (c) 1993-95 by Carsten Wimmer <cawim@train.oche.de>
  1368. Querying pid for process <POP3D.EXE> ... Error ...
  1369. [E:\tmp]go.exe -k SMTPD
  1370. GO! v1.5 - (c) 1993-95 by Carsten Wimmer <cawim@train.oche.de>
  1371. Querying pid for process <SMTPD.EXE> ... Error ...
  1372.  
  1373. How can I modify the script to launch that kill function only if the
  1374. appli to kill is running ?
  1375. (I have added to the script the variable "CheckIfRunning" but I didn't add the 
  1376. lines for it into the code itself).
  1377.  
  1378. 2°) What are the lines to add to the script to have it to calculate the time
  1379. online. The script gives me the time it is for each process it is executing,
  1380. but I would like it to calculate the exact time I'm connected to my provider,
  1381. and with the cost of each minute connected, I would be able to know exactly
  1382. how much it costs me. (I'm charged about 0.25 $ per mn).
  1383. Would it be possible to have something like that (see below) in the log file :
  1384. 11 Oct 1999 03:11:55 . Sleeping for 13500 seconds...
  1385. 11 Oct 1999 03:11:55 End of the script
  1386. 11 Oct 1999 03:11:55 Total time connected for this run : 3' 25". Cost : 0.75$
  1387.  
  1388. 3°) I've just taken a look at the log file, and this is what I saw ;-( :
  1389.  
  1390. ----/ DialUp Script v.1.6 rev.0.05 : Jeudi 7 Oct 1999 - 18:34:36 /---
  1391. 7 Oct 1999 18:34:36 Started dialup up process ...
  1392. 7 Oct 1999 18:34:36     dialer, if running, is killed.
  1393. 7 Oct 1999 18:34:37     inetmail, if running, is killed.
  1394. 7 Oct 1999 18:34:38     pop3d process, if running, is killed.
  1395. 7 Oct 1999 18:34:39     smtpd process, if running, is killed.
  1396. 7 Oct 1999 18:34:42 . Starting the Internet Dialer ...
  1397. 7 Oct 1999 18:34:43    We can resolve hostnames, connection is up...
  1398. 7 Oct 1999 18:34:43    InetMail, Pop3d and Smtpd are started...
  1399. 7 Oct 1999 18:34:44 . Starting of the PingServer procedure ...
  1400. 7 Oct 1999 19:33:56 . Warning : Unable to connect to remote Sever.
  1401. Skipping connection.
  1402. 7 Oct 1999 19:33:56    and we go to sleep for a while - 10 seconds.
  1403. 7 Oct 1999 19:34:06 . Hanging up ...
  1404. 7 Oct 1999 19:34:06    we kill the Dialer, Crude but necessary ...
  1405. 7 Oct 1999 19:34:07    InetMail is killed.
  1406. 7 Oct 1999 19:34:10    Pop3d process is killed.
  1407. 7 Oct 1999 19:34:11    Smtpd process is killed.
  1408. 7 Oct 1999 19:34:11 . Sleeping for 10800 seconds...
  1409. 7 Oct 1999 19:34:11 End of the script
  1410.  
  1411. As you can see, 6.34pm : Starting of the PingServer Procedure
  1412. BUTTTTTTTT, 7.33 pm Warning : Unable ;.....
  1413. ONE HOUR LATER ;-(((((((((
  1414. I've to pay for ONE HOUR ;-(
  1415. Is there a way to have the script to check the com port or something
  1416. else, but I would like to have more secure ;-(((
  1417.  
  1418. 4°) This is an example of a problem I have from time to time :
  1419. I started the script, but Injoy hang up after running out of time. ( I setted
  1420. up its timer to 5 minutes.
  1421.  
  1422. In the window the script was running, I've got the following output :
  1423.  
  1424. >------------------------------------
  1425. --------------------------------------------------------------------
  1426. Starting dialer ...
  1427. ...starting InJoy dialer in another session...
  1428. --------------------------------------------------------------------
  1429. [E:\injoy]start "Internet Dialer" /C e:\injoy\in-joy.exe auto
  1430. ...let's sit'n'wait till connection is established before we try
  1431. anything...
  1432. ...testing if a link has been established...
  1433. ..we can resolve hostnames, connection is up...
  1434. --------------------------------------------------------------------
  1435. Check for a live connection, starting mail processing ...
  1436. --------------------------------------------------------------------
  1437. PingServer
  1438. Creating socket ...
  1439. Connecting to server ...
  1440. Error on SockConnect = ETIMEDOUT
  1441. Creating socket ...
  1442. Connecting to server ...
  1443. Getting the greeting ...
  1444. >----------------------------------
  1445.  
  1446. And the things stayed that way forever ;;-(
  1447. The script seems to wait for the greeting, but Injoy was stopped.
  1448. How can I tell the script to kill everything after a while if
  1449. something like that happens ???
  1450.  
  1451. 5°) Another kind of problem :
  1452. Sometimes, in the window the script is running, the script seems to be
  1453. frozen (?) as it displays :
  1454. PingServer
  1455. Creating socket ...
  1456. Connecting to server ...
  1457. Getting the greeting ...
  1458.  
  1459. Injoy is well connected, but I setted up the time to 5 minutes. (I pay
  1460. for every second I stay on line). The time has run out, then Injoy
  1461. has disconnected, but the script was always showing the same line :
  1462. "Getting the greeting....".
  1463. Injoy has restarted, connect to my isp and wait for the timer to run
  1464. out (5 minutes again)., but the script was always waiting for the
  1465. "greeeting", and things stayed that way, injoy has disconnected, then
  1466. restart, etc....
  1467. As I have to run this script in an unattended way, it's impossible to
  1468. have the things to run that way;
  1469. What are the changes to do ?
  1470.  
  1471.  
  1472. I guess, it's enough for a first message. Really, thank you to all of you who
  1473. will be able to help me to make that script strong enuf to run by itself and
  1474. in a secure way for one month.
  1475.  
  1476. Bye, Francois!
  1477.  
  1478.  
  1479. Email: fmas@celtes.com
  1480. Web  : http://www.worldnet.net/~island/
  1481.  
  1482. ---
  1483.  * Origin: Island's BBS, a Node in the Atlantic Ocean (2:326/2)
  1484.  
  1485. +----------------------------------------------------------------------------+
  1486.  
  1487. From: Ron Mitchell                                      11-Oct-99 21:34:29
  1488.   To: Rich Wonneberger                                  12-Oct-99 07:57:12
  1489. Subj: hstart wget?
  1490.  
  1491. Rich Wonneberger wrote in a message to Ron Mitchell:
  1492.  
  1493. RW> Thanks for the lesson.
  1494.  
  1495. Don't thank me.  Thank Charles Daney.  His 'Programming in REXX' book is the
  1496. best investment I've ever made in a programming book.
  1497.  
  1498. RW> Is there any way to get a non case sensitive comparison??
  1499.  
  1500. I don't think so.
  1501.  
  1502. Probably the best way to do it is to copy both operands to temporary variables 
  1503. and then convert these variables to lower or upper case before you compare.
  1504. Daney seems to like converting to lower case.  I don't know why yet.
  1505.  
  1506. You can drop the temporary variables and use the original operands however you 
  1507. wish depending on the outcome of the compare.
  1508.  
  1509. L8r,
  1510.                        Ron
  1511.  
  1512. ... Become a programmer - Make a living crashing your computer.
  1513.  
  1514. ---
  1515.  * Origin: River Canyon Rd. BBS  Chattanooga,TN  423-886-2521 (1:362/627)
  1516.  
  1517. +----------------------------------------------------------------------------+
  1518.  
  1519. From: John Clarke                                       10-Oct-99 18:50:26
  1520.   To: Ron Mitchell                                      12-Oct-99 21:15:10
  1521. Subj: hstart wget?
  1522.  
  1523. On Oct 09, 1999 at 05:24 hrs, Ron Mitchell of 1:362/627 wrote to John Clarke:
  1524.  
  1525. Hello Ron,
  1526.  
  1527.  RM> John Clarke wrote in a message to Jonathan de Boyne Pollard:
  1528.  
  1529. JdBP>> If it helps, the TEE in OS2CLU02.ZIP doesn't require any non-system 
  1530. JdBP>> DLLs other than the one that is supplied along with it in the very 
  1531. JdBP>> same archive.
  1532.  
  1533. JC>> I would appreciate it if you would email a copy of this file to me
  1534. JC>> at the email address below or point me towards a place where I can
  1535. JC>> grab it from the 'net. 
  1536.  
  1537.  RM> You can pick it up at http://www.riverbbs.net in the files section.  
  1538.  RM> Also at telnet://riverbbs.net.
  1539.  
  1540. Thanks.  I picked up a copy from Hobbes.
  1541.  
  1542. Regards ... John
  1543.  
  1544. Email: jclarke@zip.com.au
  1545.  
  1546. --- MsgedSQ/2 3.30
  1547.  * Origin: The Clearing House (3:713/730)
  1548. 45
  1549.  
  1550. +----------------------------------------------------------------------------+
  1551.  
  1552. From: Rich Wonneberger                                  12-Oct-99 20:24:00
  1553.   To: Ron Mitchell                                      13-Oct-99 06:57:09
  1554. Subj: hstart wget?
  1555.  
  1556. *** Quoting Ron Mitchell to Rich Wonneberger dated 10-11-99 ***
  1557. > RW> Is there any way to get a non case sensitive comparison??
  1558. > I don't think so.
  1559. > Probably the best way to do it is to copy both operands to temporary 
  1560. > variables and then convert these variables to lower or upper case 
  1561. > before you compare. Daney seems to like converting to lower case.  I 
  1562.  
  1563. Ron,
  1564.  
  1565. Sounds like this can be done in REXX easier then batch.
  1566. Gota look in the help files.
  1567.  
  1568. Thanks
  1569. Rich
  1570. I-Net   turtil@frontiernet.net
  1571.  
  1572.  
  1573. ... ▓▓▓▓▓▓▓▓▓ <- Scratch Here For Your Instant Tagline Prize!
  1574. ---
  1575.  * Origin: Turtil's Pond BBS. Monroe NY. 914-783-2106 (1:2625/50)
  1576.  
  1577. +----------------------------------------------------------------------------+
  1578.  
  1579. From: MIKE RUSKAI                                       12-Oct-99 09:50:00
  1580.   To: RON MITCHELL                                      13-Oct-99 11:13:15
  1581. Subj: hstart wget?
  1582.  
  1583. Some senseless babbling from Ron Mitchell to Rich Wonneberger
  1584. on 10-11-99  21:34 about hstart wget?...
  1585.  
  1586.  RM> Rich Wonneberger wrote in a message to Ron Mitchell:
  1587.  
  1588.  RW> Thanks for the lesson.
  1589.  
  1590.  RM> Don't thank me.  Thank Charles Daney.  His 'Programming in REXX' book
  1591.  RM> is the best investment I've ever made in a programming book.
  1592.  
  1593.  RW> Is there any way to get a non case sensitive comparison??
  1594.  
  1595.  RM> I don't think so.
  1596.  
  1597.  RM> Probably the best way to do it is to copy both operands to temporary
  1598.  RM> variables and then convert these variables to lower or upper case
  1599.  RM> before you compare. Daney seems to like converting to lower case.  I
  1600.  RM> don't know why yet. 
  1601.  RM> You can drop the temporary variables and use the original operands
  1602.  RM> however you wish depending on the outcome of the compare.
  1603.  
  1604. FYI, using a temporary variable isn't necessary.  Simply wrap the variable
  1605. inside a translate() call (or put a ~translate at the end of the message
  1606. chain, in Object REXX), like this:
  1607.  
  1608. string1='something'
  1609. string2='SoMeThInG'
  1610.  
  1611. say translate(string1)==translate(string2)
  1612.  
  1613. Mike Ruskai
  1614. thannymeister@yahoo.com
  1615.  
  1616.  
  1617. ... Does that look like a slut to you, Beavis?
  1618.  
  1619. ___ Blue Wave/QWK v2.20
  1620. --- Platinum Xpress/Win/Wildcat5! v3.0pr2
  1621.  * Origin: FIDO QWK MAIL & MORE!  WWW.DOCSPLACE.ORG (1:3603/140)
  1622. 45
  1623.  
  1624. +----------------------------------------------------------------------------+
  1625.  
  1626. From: David Noon                                        13-Oct-99 18:11:01
  1627.   To: Rich Wonneberger                                  15-Oct-99 06:08:04
  1628. Subj: comparison operators
  1629.  
  1630. In a message dated 10-09-99, Rich Wonneberger said to David Noon about
  1631. "hstart wget?"
  1632.  
  1633. Hi Rich,
  1634.  
  1635. > Note the double equal sign.
  1636.  
  1637. RW>I've seen the double equal sign in DOS batch program.  What 
  1638. RW>does this do thats different then single equal?
  1639.  
  1640. In simplest terms, a single equal sign asks if the values are equal, whereas
  1641. a double equal sign asks if the bytes are exactly the same. Thus,
  1642.  
  1643.     "A" = " A "   is true
  1644.     "A" == " A "  is false
  1645.  
  1646.      2 = 2.0      is true
  1647.      2 == 2.0     is false
  1648.  
  1649.      25 = 2.5E+1  is true
  1650.      25 == 2.5E+1 is false
  1651.  
  1652. All character comparisons are case-sensitive. To make a case-insensitive
  1653. comparison use the TRANSLATE() built-in function. For example,
  1654.  
  1655.    IF TRANSLATE(string_1) = TRANSLATE(string_2) THEN ...
  1656.  
  1657. performs a case-insensitive comparison of the variables string_1 and
  1658. string_2.
  1659.  
  1660. Regards
  1661.  
  1662. Dave
  1663. <Team PL/I>
  1664. ___
  1665.  * MR/2 2.25 #353 * I use Windows...on my car, on my house, but not on my ...
  1666.  
  1667. --- Maximus/2 3.01
  1668.  * Origin: Air Applewood, OS/2 Gateway to Essex 44-1279-792300 (2:257/609)
  1669. 45
  1670.  
  1671. +----------------------------------------------------------------------------+
  1672.  
  1673. From: Murray Lesser                                     15-Oct-99 16:09:00
  1674.   To: David Noon                                        15-Oct-99 16:09:00
  1675. Subj: Rxprep
  1676.  
  1677. Hi David--
  1678.  
  1679.     Do you have any comments, helpful or otherwise, about RXPREP?  This
  1680. is a preprocessor for REXX source code, written (in REXX) by Richard J.
  1681. Moore of IBM UK.  The following paragraph is an excerpt from the
  1682. introduction to RXPREP.DOC, as it appears in the July, 1999, CD-ROM
  1683. issue of DevCon Release 2 Volume 3 (disc M15):
  1684.  
  1685.     "RXPREP is a pre-processor for REXX source.  It permits source to be
  1686.   built from multiple members which are selected by imbedding
  1687.   directives.  Nesting of imbedded members is supported.  Also supported
  1688.   is the use of conditional inclusion of source or members as well as
  1689.   substitution of placeholders specified either within the source or
  1690.   from the command line.  In fact the features of RXPREP mimic those
  1691.   frequently found in C compiler pre-processors and assembler macro
  1692.   languages. The pre-processor is controlled by coding directives within
  1693.   the REXX source which have a syntactical resemblance to those of the
  1694.   SCRIPT language."
  1695.  
  1696.     (For those in the audience who are not familiar with IBM utilities
  1697. other than those furnished with OS/2, "SCRIPT" was a mainframe internal
  1698. IBM markup language for formatting documents written with any
  1699. lime-by-line text editor (often SPF).  There was a vintage-1986
  1700. IBM-distributed shrink-wrapped version, SCRIPT/PC, for PC-DOS.)
  1701.  
  1702.     A cursory reading of RXPREP.DOC leads me to the belief that the
  1703. advantages of a REXX preprocessor (even though it is free!) are not
  1704. great enough for me bothering to learn yet another language just to use
  1705. it, so I do not intend to install RXPREP.  But I may be missing
  1706. something.  Your comments would be appreciated.
  1707.  
  1708.     Regards,
  1709.  
  1710.         --Murray
  1711. <Team PL/I>
  1712. ___
  1713.  * MR/2 2.25 #120 * Which direction is forward?
  1714.  
  1715. --- Maximus/2 2.02
  1716.  * Origin: OS/2 Shareware BBS, telnet://bbs.os2bbs.com (1:109/347)
  1717.  
  1718.  
  1719. +----------------------------------------------------------------------------+
  1720.  
  1721. +============================================================================+
  1722.