X-Git-Url: http://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=Ada95%2Fsamples%2Fncurses2-getopt.adb;h=5719b1b01eb6d489b084ae923d64a851f965106b;hp=176073b0bb59197171a8e85136cc060d7c6d4019;hb=55ccd2b959766810cf7db8d1c4462f338ce0afc8;hpb=a8987e73ec254703634802b4f7ee30d3a485524d diff --git a/Ada95/samples/ncurses2-getopt.adb b/Ada95/samples/ncurses2-getopt.adb index 176073b0..5719b1b0 100644 --- a/Ada95/samples/ncurses2-getopt.adb +++ b/Ada95/samples/ncurses2-getopt.adb @@ -35,7 +35,8 @@ ------------------------------------------------------------------------------ -- Author: Eugene V. Melaragno 2000 -- Version Control --- $Revision: 1.3 $ +-- $Revision: 1.6 $ +-- $Date: 2004/08/21 21:37:00 $ -- Binding Version 01.00 ------------------------------------------------------------------------------ -- A simplified version of the GNU getopt function @@ -47,8 +48,6 @@ with Ada.Text_IO; use Ada.Text_IO; package body ncurses2.getopt is - optopt : Character := '?'; - nextchar : Natural := 0; -- Ncurses doesn't use the non option elements so we are spared @@ -104,13 +103,12 @@ package body ncurses2.getopt is -- Look at and handle the next short option-character. declare c : Character := argv (optind) (nextchar); - temp : Natural := + temp : constant Natural := Ada.Strings.Fixed.Index (optstring, String'(1 => c)); begin if temp = 0 or c = ':' then Put_Line (Standard_Error, argv (optind) & ": invalid option -- " & c); - optopt := c; c := '?'; return; end if; @@ -134,7 +132,6 @@ package body ncurses2.getopt is Put_Line (Standard_Error, argv (optind) & ": option requires an argument -- " & c); - optopt := c; if optstring (1) = ':' then c := ':'; else