mksh/mksh.logging/exec.c
static const char *
do_selectargs(const char **ap, bool print_menu)
{
	static const char *read_args[] = {
		"read", "-r", "REPLY", NULL
	};
	char *s;
	int i, argct;

	for (argct = 0; ap[argct]; argct++)
		;
	while (/* CONSTCOND */ 1) {
		/*-
		 * Menu is printed if
		 *	- this is the first time around the select loop
		 *	- the user enters a blank line
		 *	- the REPLY parameter is empty
		 */
		if (print_menu || !*str_val(global("REPLY")))
			pr_menu(ap);
		shellf("%s", str_val(global("PS3")));
		if (call_builtin(findcom("read", FC_BI), read_args, Tselect,
				 false, 0))
			return (NULL);
		if (*(s = str_val(global("REPLY"))))
			return ((getn(s, &i) && i >= 1 && i <= argct) ?
			    ap[i - 1] : null);
		print_menu = true;
	}
}
/*
 *	ksh special - the select command processing section
 *	print the args in column form - assuming that we can
 */
ksh special - the select command processing section
print the args in column form - assuming that we can
ksh special - the select command processing section print the args in column form - assuming that we can
static const char *
do_selectargs(const char **ap, bool print_menu)
{
	static const char *read_args[] = {
		"read", "-r", "REPLY", NULL
	};
	char *s;
	int i, argct;
	for (argct = 0; ap[argct]; argct++)
		;
	while ( 1) {
		if (print_menu || !*str_val(global("REPLY")))
			pr_menu(ap);
		shellf("%s", str_val(global("PS3")));
		if (call_builtin(findcom("read", FC_BI), read_args, Tselect,
				 false, 0))
			return (NULL);
		if (*(s = str_val(global("REPLY"))))
			return ((getn(s, &i) && i >= 1 && i <= argct) ?
			    ap[i - 1] : null);
		print_menu = true;
	}
}
static const char * do_selectargs ( const char * * ap , bool print_menu ) { static const char * read_args [ ] = { " " , " " , " " , NULL } ; char * s ; int i , argct ; for ( argct = 0 ; ap [ argct ] ; argct ++ ) ; while ( 1 ) { if ( print_menu || ! * str_val ( global ( " " ) ) ) pr_menu ( ap ) ; shellf ( " " , str_val ( global ( " " ) ) ) ; if ( call_builtin ( findcom ( " " , FC_BI ) , read_args , Tselect , false , 0 ) ) return ( NULL ) ; if ( * ( s = str_val ( global ( " " ) ) ) ) return ( ( getn ( s , & i ) && i >= 1 && i <= argct ) ? ap [ i - 1 ] : null ) ; print_menu = true ; } }
ksh special - the select command processing section
      print the args in column form - assuming that we can
ksh special - the select command processing section print the args in column form - assuming that we can
/* CONSTCOND */ /*-
		 * Menu is printed if
		 *	- this is the first time around the select loop
		 *	- the user enters a blank line
		 *	- the REPLY parameter is empty
		 */