File: varset.sl

package info (click to toggle)
slrn 1.0.3%2Bdfsg-3
  • links: PTS
  • area: main
  • in suites: buster
  • size: 6,412 kB
  • sloc: ansic: 39,852; sh: 3,777; perl: 467; makefile: 229; sed: 24
file content (23 lines) | stat: -rw-r--r-- 545 bytes parent folder | download | duplicates (13)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
% This macro will prompt for a variable name and lets you change it, using
% the current value as the default.

define set_variable ()
{
   variable name, value;
   
   name = read_mini_variable ("Set variable: ", "", "");
   if (name == "")
     return;
   
   value = get_variable_value (name);
   if (typeof (value) == Integer_Type)
     {
	value = read_mini_integer ("New value: ", value);
	set_integer_variable (name, value);
     }
   else
     {
	value = read_mini ("New value: ", "", value);
	set_string_variable (name, value);
     }
}