1 /* ***********************************************************
  2    *                                                         *
  3    * Copyright, (C) Honeywell Information Systems Inc., 1983 *
  4    *                                                         *
  5    *********************************************************** */
  6 
  7 linus_query:
  8           proc (lcb_ptr_parm, answer_parm, question_parm);
  9 
 10 /*
 11 
 12      This module provides an interface to the command_query subroutine
 13      It handles most of the setup work for its callers. The following external
 14      entry points are available:
 15 
 16      linus_query - general question and answer entry
 17      linus_query$yes_no - allows only a yes or no response
 18 */
 19 %page;
 20 /*
 21 
 22      Known Bugs:
 23 
 24      Other Problems:
 25 
 26      History:
 27 
 28      Written - 82/01/10 - Dave Schimke
 29 
 30 
 31 */
 32 %page;
 33           dcl answer_parm char(*) var parm;                 /* output: user's response */
 34           dcl lcb_ptr_parm ptr parm;                        /* input: ptr to linus control block */
 35           dcl question_parm char(*) var parm;               /* input: prompt */
 36           dcl yes_no_parm bit (1) aligned parm;             /* output: yes or no flag */
 37 
 38 /* This entry is the basic question/answer mode. */
 39 
 40           answer_parm = "";
 41           lcb_ptr = lcb_ptr_parm;
 42           question = question_parm;
 43 
 44           query_information.switches.yes_or_no_sw = "0"b;
 45           call query;
 46           answer_parm = answer;
 47           return;
 48 
 49 yes_no:   entry (lcb_ptr_parm, yes_no_parm, question_parm);
 50 
 51 /* This entrypoint accepts only a yes or no response and returns a flag
 52    (yes_no_parm) where "1"b equals yes and "0"b equals no. */
 53 
 54           yes_no_parm = "0"b;
 55           lcb_ptr = lcb_ptr_parm;
 56           question = question_parm;
 57 
 58           query_information.switches.yes_or_no_sw = "1"b;
 59           call query;
 60 
 61           if substr (answer, 1, 1) = "y"
 62                then yes_no_parm = "1"b;
 63 
 64           return;
 65 
 66 query:    proc;
 67           query_information.version = query_info_version_5;
 68           query_information.switches.suppress_name_sw = "1"b;
 69           query_information.switches.cp_escape_control = "00"b;
 70           query_information.switches.suppress_spacing = "1"b;
 71           query_information.switches.padding = "0"b;
 72           query_information.status_code = 0;
 73           query_information.query_code = 0;
 74           query_information.question_iocbp = iox_$user_output;
 75           query_information.answer_iocbp = iox_$user_input;
 76           query_information.repeat_time = 0;
 77           query_information.explanation_ptr = null();
 78           query_information.explanation_len = 0;
 79 
 80 /************************************************************************/
 81 /* Code added to insure upward compatibility with pre_ssu_linus invoke. */
 82 /* This can be removed if and when invoke is completely removed.        */
 83 
 84 /* If attached though invoke then get input from terminal regardless.   */
 85           if lcb.is_ptr ^= iox_$user_input
 86                then query_information.answer_iocbp = iox_$user_io;
 87 /*                                                                      */
 88 /************************************************************************/
 89 
 90 
 91 call command_query_ (addr(query_information), answer, "linus_query", (question));
 92 
 93 return;
 94 end;
 95 %page;
 96 %include iocb;
 97 %page;
 98 %include linus_lcb;
 99 %page;
100 %include query_info;
101 ^L
102 /* Automatic */
103 dcl answer char(linus_data_$buff_len) varying;
104 dcl 1 query_information like query_info;
105 dcl question char(linus_data_$buff_len) varying;
106 
107 /* Builtin */
108 dcl (addr, fixed, null, rel, substr) builtin;
109 
110 /* Static */
111 dcl iox_$user_input ptr ext static;
112 dcl iox_$user_io ptr ext static;
113 dcl iox_$user_output ptr ext static;
114 dcl linus_data_$buff_len fixed bin(35) ext static;
115 dcl sys_info$max_seg_size fixed bin(35) ext static;
116 
117 /* Entries */
118 dcl command_query_ entry() options(variable);
119 
120 end linus_query;
121 
122 
123 
124