home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 35 Internet / 35-Internet.zip / postnews.zip / postnews.cmd < prev   
OS/2 REXX Batch file  |  1995-01-21  |  5KB  |  124 lines

  1. /*--------------------------------------------------------------------*/
  2. /*       Program:    pnews.cmd                                        */
  3. /*       Author:     Snuffles P. Bear                                 */
  4. /*                   Kendra Electronic Wonderworks                    */
  5. /*                   P.O. Box 132                                     */
  6. /*                   Arlington, MA 02174                              */
  7. /*                                                                    */
  8. /*       Function:   Quick and (very) dirty OS/2 posting program      */
  9. /*                   for UUPC/extended                                */
  10. /*--------------------------------------------------------------------*/
  11.  
  12. /*  This file modified and renamed to POSTNEWS.CMD for use with TIN   */
  13. /*  for OS/2.   */
  14.  
  15. /*--------------------------------------------------------------------*/
  16. /*       Note: This program doesn't support prefixed keywords in      */
  17. /*             the UUPC/extended RC file, and further presumes you    */
  18. /*             always want your posts saved for posterity and/or      */
  19. /*             law suits.  In truth, this program was a quickly       */
  20. /*             hacked prototype and no more or less.                  */
  21. /*                                                                    */
  22. /*             Did we mention it also ALWAYS tacks on your .sig       */
  23. /*             file?  Or that it may not work on multiple disk        */
  24. /*             systems?                                               */
  25. /*--------------------------------------------------------------------*/
  26.  
  27. /*--------------------------------------------------------------------*/
  28. /*       Changes Copyright (c) 1989-1994 by Kendra Electronic         */
  29. /*       Wonderworks.                                                 */
  30. /*                                                                    */
  31. /*       All rights reserved except those explicitly granted by       */
  32. /*       the UUPC/extended license agreement.                         */
  33. /*--------------------------------------------------------------------*/
  34.  
  35. /*--------------------------------------------------------------------*/
  36. /*                          RCS Information                           */
  37. /*--------------------------------------------------------------------*/
  38.  
  39. /*
  40.  *    $Id: pnews.cmd 1.2 1994/02/13 04:56:14 ahd Exp $
  41.  *
  42.  *    $Log: pnews.cmd $
  43.  *       Revision 1.2  1994/02/13  04:56:14  ahd
  44.  *       Add RCS log field
  45.  *
  46.  */
  47.  
  48. /* Changed to POSTNEWS.CMD by John D. Carmack to work with OS/2 TIN */
  49. /* Notice it is mostly just taking stuff out of the original        */
  50.  
  51. signal on novalue
  52. '@echo off'                             /* Disable OS/2 command echo  */
  53.  
  54. /*--------------------------------------------------------------------*/
  55. /*                    Get environment information                     */
  56. /*--------------------------------------------------------------------*/
  57.  
  58. uupcusrrc    = value( 'UUPCUSRRC',,'OS2ENVIRONMENT');
  59.  
  60. domain       = getuupc("fromDomain", getuupc("domain"));
  61. editor       = getuupc("OS2.editor",,uupcusrrc);
  62. home         = getuupc("home",,uupcusrrc);
  63. mailbox      = getuupc("mailbox",,uupcusrrc);
  64. name         = getuupc("name",,uupcusrrc);
  65. organization = getuupc("organization","NOT!",uupcusrrc);
  66. signature    = getuupc("signature","NOT!",uupcusrrc);
  67. tempdir      = getuupc("TEMPDIR" )
  68.  
  69. /*--------------------------------------------------------------------*/
  70. /*                      Create a posting header                       */
  71. /*--------------------------------------------------------------------*/
  72.  
  73. dfile        = Arg(1);
  74. say dfile
  75.  
  76. /*--------------------------------------------------------------------*/
  77. /*              Save the file whether or not we post it               */
  78. /*--------------------------------------------------------------------*/
  79.  
  80. savefile = home || '\' || 'USENETPR.SPB'
  81.  
  82. call lineout savefile,copies('01'x,19)
  83. call lineout savefile,'Date:' left(date('w'),3) || ',' date() time() 'LOCAL';
  84. do while(lines(dfile))
  85.    call lineout savefile,linein(dfile)
  86. end
  87.  
  88. call lineout savefile
  89.  
  90. say 'Copy saved in' savefile;
  91.  
  92. /*--------------------------------------------------------------------*/
  93. /*       Determine if the user really wants to post the article       */
  94. /*--------------------------------------------------------------------*/
  95.  
  96. if signature <> 'NOT!' then
  97. do;
  98.    if pos( '\' , signature ) == 0 then
  99.       signature = home || '\' || signature;
  100.  
  101.    call lineout dfile,'--';         /* Terminate body of message     */
  102.    do while( lines(signature) )
  103.       call lineout dfile,linein(signature)
  104.    end;
  105.  
  106.    call lineout dfile;              /* Close the file          */
  107. end;
  108.  
  109. /*--------------------------------------------------------------------*/
  110. /*                          Execute the post                          */
  111. /*--------------------------------------------------------------------*/
  112.  
  113. 'inews <' dfile;
  114.  
  115. /*--------------------------------------------------------------------*/
  116. /*                   Delete our work file and exit                    */
  117. /*--------------------------------------------------------------------*/
  118.  
  119. /* call sysfiledelete dfile; */
  120. call SysCls;
  121. exit rc;
  122.  
  123.  
  124.