comparison scripts/miscellaneous/menu.m @ 917:b843a65fa977

[project @ 1994-11-11 02:00:28 by jwe]
author jwe
date Fri, 11 Nov 1994 02:06:42 +0000
parents 3470f1e25a79
children 3f257ab07921
comparison
equal deleted inserted replaced
916:2f35156aa18b 917:b843a65fa977
32 32
33 # Don't send the menu through the pager since doing that can cause 33 # Don't send the menu through the pager since doing that can cause
34 # major confusion. 34 # major confusion.
35 35
36 save_page_screen_output = page_screen_output; 36 save_page_screen_output = page_screen_output;
37 page_screen_output = "false";
38 37
39 if (! isempty (t)) 38 unwind_protect
40 disp (t);
41 printf ("\n");
42 endif
43 39
44 nopt = nargin - 1; 40 page_screen_output = "false";
45 41
46 while (1) 42 if (! isempty (t))
47 va_start (); 43 disp (t);
48 for i = 1:nopt
49 printf (" [%2d] ", i);
50 disp (va_arg ());
51 endfor
52 printf ("\n");
53 s = "";
54 s = input ("pick a number, any number: ", "s");
55 if (strcmp (s, ""))
56 printf ("\n"); 44 printf ("\n");
57 continue;
58 endif 45 endif
59 eval (sprintf ("num = %s;", s));
60 if (! is_scalar (num) || num < 1 || num > nopt)
61 printf ("\nerror: input invalid or out of range\n\n");
62 else
63 break;
64 endif
65 endwhile
66 46
67 page_screen_output = save_page_screen_output; 47 nopt = nargin - 1;
48
49 while (1)
50 va_start ();
51 for i = 1:nopt
52 printf (" [%2d] ", i);
53 disp (va_arg ());
54 endfor
55 printf ("\n");
56 s = "";
57 s = input ("pick a number, any number: ", "s");
58 if (strcmp (s, ""))
59 printf ("\n");
60 continue;
61 endif
62 eval (sprintf ("num = %s;", s));
63 if (! is_scalar (num) || num < 1 || num > nopt)
64 printf ("\nerror: input invalid or out of range\n\n");
65 else
66 break;
67 endif
68 endwhile
69
70 unwind_protect_cleanup
71
72 page_screen_output = save_page_screen_output;
73
74 end_unwind_protect
68 75
69 endfunction 76 endfunction