home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / intel86b / itemize.p86 < prev    next >
Text File  |  2020-01-01  |  4KB  |  92 lines

  1. $large
  2.  
  3. itemize: do;
  4.     /*
  5.      *  This program copies each pathname given by the input filespec
  6.      *  to the corresponding output file.  It is intended to be used
  7.      *  with a single output file and a wild-card input pathname, in
  8.      *  which case it places in that output file all pathnames matching
  9.      *  the input filespec.
  10.      *
  11.      *  by Albert J. Goodman; Edit date:  30-July-1985
  12.      */
  13.  
  14. /* Get the needed iRMX 86 system call external declarations */
  15. $include(:I:NEXCEP.LIT)
  16. $include(:I:LTKSEL.LIT)
  17. $include(:I:IEXIOJ.EXT)
  18. $include(:I:NSTEXH.EXT)
  19. $include(:I:HGTIPN.EXT)
  20. $include(:I:HGTOPN.EXT)
  21. $include(:I:HGTOCN.EXT)
  22. $include(:I:ISWRMV.EXT)
  23. $include(:I:ISCLOS.EXT)
  24. $include(:I:ISDLCN.EXT)
  25.  
  26. declare
  27.     CR      literally   '0Dh',      /* ASCII Carriage-return character */
  28.     LF      literally   '0Ah',      /* ASCII Line-feed character */
  29.     ( input$pathname, output$pathname ) structure(
  30.                                             len     byte,
  31.                                             ch(80)  byte),
  32.     output$preposition                  byte,
  33.     output$connection                   token,
  34.     ( bytes$written, status )           word,
  35.     exception$handler$info              structure(
  36.                                             offset  word,
  37.                                             base    word,
  38.                                             mode    byte);
  39.  
  40. check$excep: procedure;     /* Check for an exception code */
  41.     if ( status <> E$OK ) then  /* we got an exceptional condition */
  42.         call rq$exit$io$job( status, 0, @status );  /* abort the program */
  43. end check$excep;
  44.  
  45. /* begin ITEMIZE */
  46. /* Disable our exception handler, so control never passes to it. */
  47. exception$handler$info.offset = 0;
  48. exception$handler$info.base = 0;
  49. exception$handler$info.mode = 0;
  50. call rq$set$exception$handler( @exception$handler$info, @status );
  51. call check$excep;
  52.  
  53. /* get the first input pathname */
  54. call rq$c$get$input$pathname( @input$pathname, size( input$pathname ),
  55.                                     @status );
  56. call check$excep;
  57. /* while we have any more pathnames */
  58. do while ( input$pathname.len > 0 );
  59.     /* Get the matching output pathname (default to command output) */
  60.     output$preposition = rq$c$get$output$pathname( @output$pathname,
  61.                                     size( output$pathname ),
  62.                                     @( 7,'TO :CO:' ), @status );
  63.     call check$excep;
  64.     /* Get a connection to the output file */
  65.     output$connection = rq$c$get$output$connection( @output$pathname,
  66.                                     output$preposition, @status );
  67.     call check$excep;
  68.     /* Copy the input pathname to the output file */
  69.     bytes$written = rq$s$write$move( output$connection, @input$pathname.ch,
  70.                                     input$pathname.len, @status );
  71.     call check$excep;
  72.     /* Append a carriage-return/line-feed line terminator */
  73.     bytes$written = rq$s$write$move( output$connection, @( CR,LF ),
  74.                                     2, @status );
  75.     call check$excep;
  76.     /* Close the output file */
  77.     call rq$s$close( output$connection, @status );
  78.     call check$excep;
  79.     /* And delete the output connection */
  80.     call rq$s$delete$connection( output$connection, @status );
  81.     call check$excep;
  82.     /* Get the next input pathname, if any */
  83.     call rq$c$get$input$pathname( @input$pathname, size( input$pathname ),
  84.                                     @status );
  85.     call check$excep;
  86. end;    /* do while ( input$pathname.len > 0 ) */
  87.  
  88. /* Terminate the program, signalling O.K. */
  89. call rq$exit$io$job( E$OK, 0, @status );
  90.  
  91. end itemize;
  92.