Rob van der Woude's Scripting Pages
Powered by GeSHi

Source code for readline.rex

(view source code of readline.rex as plain text)

  1. /* Read a single line from standard input                              */
  2. /* Rexx version of OS/2 Warp 4 COMMAND.COM's internal READLINE command */
  3. /* Written by Rob van der Woude                                        */
  4.  
  5. parse upper arg commandline
  6. select
  7. 	when commandline = "/V" then upcase = 1
  8. 	when commandline = "" then nop
  9. 	otherwise call Syntax
  10. end
  11.  
  12. empty = 0
  13. do i = 1 by 1 while lines( ) > 0
  14. 	parse pull line
  15. 	if i = 1 then do
  16. 		if upcase = 1 then do
  17. 			say translate( line )
  18. 		end
  19. 		else do
  20. 			say line
  21. 		end
  22. 	end
  23. 	if line = "" then empty = empty + 1
  24. 	if empty > 100 then leave
  25. end
  26. EXIT 0
  27.  
  28.  
  29. Syntax: procedure
  30. 	say
  31. 	say "Use the READLINE command to read a line of text from the"
  32. 	say "keyboard and place it in the batch file variables to"
  33. 	say "This command can only be used from within a batch file."
  34. 	say
  35. 	say "SYNTAX: READLINE [/V]"
  36. 	say
  37. 	say "where:"
  38. 	say "  /V    converts the input line to upper case."
  39. 	EXIT 1
  40. return
  41.  

page last modified: 2024-04-16; loaded in 0.0047 seconds