Refactoring. Added URLSCHEME config keyword (not active yet).

This commit is contained in:
Ianos Gnatiuc
2007-01-08 09:48:18 +00:00
parent 0d84e02cfa
commit 3750658bf2
30 changed files with 796 additions and 574 deletions

View File

@@ -31,7 +31,7 @@
// ------------------------------------------------------------------
#include <gfilutil.h>
#include <gstrarr.h>
#include <gstrall.h>
// ------------------------------------------------------------------

View File

@@ -31,6 +31,7 @@
#include <string>
#include <gdefs.h>
#include <gregex.h>
// ------------------------------------------------------------------
@@ -239,9 +240,9 @@ const int DISPMSGSIZE_LINES = 3;
// ------------------------------------------------------------------
// Replylink types
const int REPLYLINK_DIRECT = 0;
const int REPLYLINK_CHAIN = 1;
const int REPLYLINK_NONE = 2;
const int REPLYLINK_DIRECT = 0;
const int REPLYLINK_CHAIN = 1;
const int REPLYLINK_NONE = 2;
const int REPLYLINKLIST_FAST = 0;
const int REPLYLINKLIST_FULL = 1;
@@ -562,23 +563,32 @@ struct infoLookup {
// ------------------------------------------------------------------
// Structures and constants for external utilities
const int EXTUTIL_CLS = 0x0001;
const int EXTUTIL_CURSOR = 0x0004;
const int EXTUTIL_RELOAD = 0x0008;
const int EXTUTIL_PAUSE = 0x0010;
const int EXTUTIL_PAUSEONERROR = 0x0020;
const int EXTUTIL_WIPE = 0x0040;
const int EXTUTIL_KEEPCTRL = 0x0080;
const uint32_t EXTUTIL_CLS = 0x0001;
const uint32_t EXTUTIL_CURSOR = 0x0004;
const uint32_t EXTUTIL_RELOAD = 0x0008;
const uint32_t EXTUTIL_PAUSE = 0x0010;
const uint32_t EXTUTIL_PAUSEONERROR = 0x0020;
const uint32_t EXTUTIL_WIPE = 0x0040;
const uint32_t EXTUTIL_KEEPCTRL = 0x0080;
struct ExtUtil {
int utilno;
int options;
char cmdline[256];
struct ExtUtil
{
uint32_t utilno;
uint32_t options;
std::string cmdline;
};
struct SaveUtil {
int utilno;
char menutext[41];
struct SaveUtil
{
uint32_t utilno;
std::string menutext;
};
struct UrlHandler
{
std::string name;
gregex scheme;
ExtUtil handler;
};

View File

@@ -33,6 +33,7 @@
// Required headers
#include <string>
#include <vector>
#include <gctype.h>
#include <cstring>
#include <gdefs.h>
@@ -54,11 +55,17 @@ char* strlwr(char* s);
#endif
// ------------------------------------------------------------------
typedef std::vector<std::string> gstrarray;
// ------------------------------------------------------------------
// Function prototypes
bool strblank(const char* str);
int strchg(char* str, char oldch, char newch);
size_t strchg(char *str, char oldch, char newch);
size_t strchg(std::string &str, char oldch, char newch);
char* stridela(const char* substr, char* str);
int strnicmpw(const char* str1, const char* str2, int len);
const char* striinc(const char* str1, const char* str2);
@@ -74,7 +81,8 @@ char* strshr(char* str, int count);
char* strsrep(char* str, const char* search, const char* replace);
char* strltrim(char* str);
char* strtrim(char* str);
std::string& strtrim(std::string& p);
std::string &strtrim(std::string &str);
std::string &strltrim(std::string &str);
char* struplow(char* str);
char* longdotstr(long num); // Convert a long to a dotted string: xxx.xxx.xxx.xxx
@@ -147,6 +155,8 @@ int gsprintf(TCHAR* buffer, size_t sizeOfBuffer, const TCHAR* __file, int __line
// ------------------------------------------------------------------
// String tokenizer class
void tokenize(gstrarray &array, const TCHAR* str, const TCHAR *delim = NULL);
class GTok
{
protected:

View File

@@ -1,76 +0,0 @@
// This may look like C code, but it is really -*- C++ -*-
// ------------------------------------------------------------------
// The Goldware Library
// Copyright (C) 1999-2000 Alexander S. Aganichev
// ------------------------------------------------------------------
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
// License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Library General Public License for more details.
//
// You should have received a copy of the GNU Library General Public
// License along with this program; if not, write to the Free
// Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
// MA 02111-1307, USA
// ------------------------------------------------------------------
// $Id$
// ------------------------------------------------------------------
// String manipulation routines.
// ------------------------------------------------------------------
#ifndef __gstrarr_h
#define __gstrarr_h
// ------------------------------------------------------------------
#include <cstring>
#include <vector>
#include <string>
#include <gdefs.h>
#include <gmemdbg.h>
// ------------------------------------------------------------------
typedef std::vector<std::string> gstrarray;
// ------------------------------------------------------------------
inline void tokenize(gstrarray &array, const TCHAR* str, const TCHAR *delim = NULL)
{
if (delim == NULL) delim = ", \t";
TCHAR *tmp = throw_xstrdup(str);
#if defined(_tcstok_s)
TCHAR *next_token;
TCHAR *token = _tcstok_s(tmp, delim, &next_token);
#else
TCHAR *token = strtok(tmp, delim);
#endif
while (NULL != token)
{
array.push_back(token);
#if defined(_tcstok_s)
token = _tcstok_s(NULL, delim, &next_token);
#else
token = strtok(NULL, delim);
#endif
}
throw_xfree(tmp);
}
// ------------------------------------------------------------------
#endif // __gstrarr_h
// ------------------------------------------------------------------

View File

@@ -52,12 +52,14 @@ bool strblank(const char* str) {
// ------------------------------------------------------------------
// Changes all occurrences of one character to another
int strchg(char* str, char oldch, char newch) {
size_t strchg(char *str, char oldch, char newch)
{
size_t count = 0;
int count = 0;
for(char* p=str; *p; p++) {
if(oldch == *p) {
for (char *p = str; *p; p++)
{
if (oldch == *p)
{
*p = newch;
count++;
}
@@ -67,6 +69,28 @@ int strchg(char* str, char oldch, char newch) {
}
// ------------------------------------------------------------------
// Changes all occurrences of one character to another
size_t strchg(std::string &str, char oldch, char newch)
{
size_t count = 0;
std::string::iterator it = str.begin();
std::string::iterator end = str.end();
for (; it != end; it++)
{
if (oldch == *it)
{
*it = newch;
count++;
}
}
return count;
}
// ------------------------------------------------------------------
// Deletes a substring from within a string
@@ -478,28 +502,34 @@ char* strtrim(char* p) {
}
std::string& strtrim(std::string& p) {
std::string &strtrim(std::string &str)
{
if (!str.empty())
{
std::string::iterator trail = str.end();
if(not p.empty()) {
std::string::iterator trail = p.end();
while(trail != p.begin()) {
while(trail != str.begin())
{
--trail;
if(not isspace(*trail) and not iscntrl(*trail)) {
if (not isspace(*trail) and not iscntrl(*trail))
{
++trail;
break;
}
}
p.erase(trail, p.end());
str.erase(trail, str.end());
}
return p;
return str;
}
// ------------------------------------------------------------------
// Trims leading spaces off of a string
char* strltrim(char* str) {
char* strltrim(char* str)
{
char* p;
char* q;
@@ -516,6 +546,22 @@ char* strltrim(char* str) {
return str;
}
// ------------------------------------------------------------------
std::string &strltrim(std::string &str)
{
if (!str.empty())
{
std::string::iterator begin = str.begin();
std::string::iterator end = str.end();
std::string::iterator it = begin;
for (; (it != end) && isspace(*it); it++) { /**/ }
if (it != begin) str.erase(begin, it);
}
return str;
}
// ------------------------------------------------------------------
@@ -695,4 +741,33 @@ char* strlwr(char* s) {
#endif
// ------------------------------------------------------------------
void tokenize(gstrarray &array, const TCHAR* str, const TCHAR *delim)
{
if (delim == NULL) delim = ", \t";
#if defined(_tcstok_s)
TCHAR *tmp = _strdup(str);
TCHAR *next_token;
TCHAR *token = _tcstok_s(tmp, delim, &next_token);
#else
TCHAR *tmp = strdup(str);
TCHAR *token = strtok(tmp, delim);
#endif
while (token)
{
array.push_back(token);
#if defined(_tcstok_s)
token = _tcstok_s(NULL, delim, &next_token);
#else
token = strtok(NULL, delim);
#endif
}
free(tmp);
}
// ------------------------------------------------------------------

View File

@@ -313,8 +313,8 @@ public:
int currow; // Current cursor row
int curcol; // Current cursor column
int numrows; // number of displayed rows
int numcols; // number of displayed columns
size_t numrows; // number of displayed rows
size_t numcols; // number of displayed columns
word videoseg; // video buffer segment address

View File

@@ -371,7 +371,7 @@ int wopen (int srow, int scol, int erow, int ecol, int btype, vattr
inline int wopen_ (int srow, int scol, int vlen, int hlen, int btype, vattr battr, vattr wattr, vattr sbattr = DEFATTR, vattr loattr = DEFATTR) { return wopen(srow, scol, srow+vlen-1, scol+hlen-1, btype, battr, wattr, sbattr, loattr); }
int wperror (const char* message);
bool wpickfile (int srow, int scol, int erow, int ecol, int btype, vattr bordattr, vattr winattr, vattr barattr, bool title, std::string &filespec, IfcpCP open, bool casesens=false);
int wpickstr (int srow, int scol, int erow, int ecol, int btype, vattr bordattr, vattr winattr, vattr barattr, char* strarr[], int initelem, VfvCP open);
int wpickstr (int srow, int scol, int erow, int ecol, int btype, vattr bordattr, vattr winattr, vattr barattr, gstrarray &strarr, int initelem, VfvCP open);
int wprintc (int wrow, int wcol, vattr attr, vchar ch);
int wprintf (const char* format, ...) __attribute__ ((format (printf, 1, 2)));
int wprintaf (int attr, const char* format, ...) __attribute__ ((format (printf, 2, 3)));
@@ -379,7 +379,7 @@ int wprintfs (int wrow, int wcol, vattr attr, const char* format, ...)
int wprints (int wrow, int wcol, vattr attr, const char* str);
int wprints_box (int wrow, int wcol, vattr attr, const char* str);
int wprintvs (int wrow, int wcol, vattr attr, const vchar* str);
int wprintns (int wrow, int wcol, vattr attr, const char* str, uint len, vchar fill=' ', vattr fill_attr = DEFATTR);
int wprintns (int wrow, int wcol, vattr attr, const std::string &str, uint len, vchar fill=' ', vattr fill_attr = DEFATTR);
int wprintsf (int wrow, int wcol, vattr attr, const char* format, const char* str);
int wprintws (int wrow, int wcol, vatch* buf, uint len);
void wpropbar (int xx, int yy, long len, vattr attr, long pos, long size);

View File

@@ -951,9 +951,9 @@ int wputy(int wrow, int wcol, vattr attr, vchar chr, uint len) {
// ------------------------------------------------------------------
// Displays a string inside active window
int wprintns(int wrow, int wcol, vattr attr, const char* str, uint len, vchar fill, vattr fill_attr)
int wprintns(int wrow, int wcol, vattr attr, const std::string &str, uint len, vchar fill, vattr fill_attr)
{
char* istr = throw_xstrdup(str);
char* istr = throw_xstrdup(str.c_str());
char* ostr = istr;
char och = *ostr;
uint olen = strlen(istr);

View File

@@ -30,6 +30,7 @@
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <gmemdbg.h>
#include <gfilutil.h>
#include <gwildmat.h>
@@ -49,30 +50,29 @@ static char* namextp;
// ------------------------------------------------------------------
// this function is the compare function for qsort()
static int compare(const char** str1, const char** str2) {
// this function is the compare function for std::sort()
static bool compare(const std::string str1, const std::string str2)
{
// Sort with directories first
bool dir1 = !!strchr(*str1, GOLD_SLASH_CHR);
bool dir2 = !!strchr(*str2, GOLD_SLASH_CHR);
int cmp = compare_two(dir2, dir1);
if(cmp != 0)
return cmp;
bool dir1 = !!strchr(str1.c_str(), GOLD_SLASH_CHR);
bool dir2 = !!strchr(str2.c_str(), GOLD_SLASH_CHR);
if (dir1 && !dir2) return true;
Path p1, p2;
strcpy(p1, *str1); if(dir1) { p1[strlen(p1)-1] = NUL; }
strcpy(p2, *str2); if(dir2) { p2[strlen(p2)-1] = NUL; }
std::string s1 = dir1 ? str1.substr(0, str1.length()-1) : str1;
std::string s2 = dir2 ? str2.substr(0, str2.length()-1) : str2;
if(case_sensitive)
return strcmp(p1, p2);
else {
cmp = stricmp(p1, p2);
if(cmp == 0)
cmp = strcmp(p1, p2);
int cmp;
if (case_sensitive)
cmp = strcmp(s1.c_str(), s2.c_str());
else
{
cmp = stricmp(s1.c_str(), s2.c_str());
if (cmp == 0)
cmp = strcmp(s1.c_str(), s2.c_str());
}
return cmp;
return (cmp > 0);
}
@@ -101,39 +101,15 @@ static void disp_title() {
// ------------------------------------------------------------------
// this function frees all allocated strings in the array of pointers
static void free_strings(char** p, int numelems) {
for(int i=0;i<numelems;i++)
throw_xfree(p[i]);
}
// ------------------------------------------------------------------
static void pre_exit(char** p, int numelems) {
free_strings(p,numelems);
throw_xfree(p);
gchdir(tcwdp);
}
// ------------------------------------------------------------------
bool wpickfile(int srow, int scol, int erow, int ecol, int btype, vattr bordattr, vattr winattr, vattr barattr, bool title, std::string &filespec, IfcpCP open, bool casesens) {
bool wpickfile(int srow, int scol, int erow, int ecol, int btype, vattr bordattr, vattr winattr, vattr barattr, bool title, std::string &filespec, IfcpCP open, bool casesens)
{
Path cwd, dir, namext, tcwd, path, spec;
cwdp = cwd;
tcwdp = tcwd;
namextp = namext;
// allocate space to hold array of char pointers
int allocated = 100;
char** p = (char**)throw_xmalloc(allocated*sizeof(char*));
// set static variables
open_function = open;
path_in_title = title;
@@ -165,16 +141,15 @@ bool wpickfile(int srow, int scol, int erow, int ecol, int btype, vattr bordattr
}
bool finished;
int picked, files;
do {
int picked;
do
{
// if directory was specified, change to it
if(*dir) {
if(gchdir(dir)) {
pre_exit(p, 0);
return false;
}
if (*dir && gchdir(dir))
{
gchdir(tcwdp);
return false;
}
// get current working directory
@@ -183,77 +158,71 @@ bool wpickfile(int srow, int scol, int erow, int ecol, int btype, vattr bordattr
// find all directories plus all files matching input filespec in
// current directory, allocating an array element for each
files = 0;
picked = -1;
gposixdir d(dir);
gstrarray strarr;
const gdirentry *de;
if(d.ok) {
while((de = d.nextentry()) != NULL) {
if (d.ok)
{
while((de = d.nextentry()) != NULL)
{
const char* name = NULL;
if(de->is_directory()) {
if (de->is_directory())
{
if(de->name != ".") {
strxmerge(path, sizeof(Path), de->name.c_str(), GOLD_SLASH_STR, NULL);
name = path;
}
}
else if(de->is_file()) {
else if(de->is_file())
{
if(case_sensitive ? gwildmat(de->name.c_str(), namext) : gwildmati(de->name.c_str(), namext))
name = de->name.c_str();
}
if(name) {
p[files] = throw_xstrdup(name);
files++;
if(files == allocated-1) {
allocated *= 2;
p = (char**)throw_xrealloc(p, allocated*sizeof(char*));
}
}
if (name) strarr.push_back(name);
}
}
p[files] = NULL;
// sort files in array by swapping their pointers
qsort(p, files, sizeof(char*), (StdCmpCP)compare);
sort(strarr.begin( ), strarr.end( ), compare);
//std::qsort(p, files, sizeof(char*), (StdCmpCP)compare);
// let user pick file
if(files)
picked = wpickstr(srow, scol, erow, ecol, btype, bordattr, winattr, barattr, p, 0, disp_title);
if(picked == -1 or files == 0) {
pre_exit(p, files);
if (strarr.size())
{
picked = wpickstr(srow, scol, erow, ecol, btype, bordattr, winattr, barattr, strarr, 0, disp_title);
}
if (picked == -1 or !strarr.size())
{
gchdir(tcwdp);
return false;
}
// see if a directory was selected. if so save
// directory name, otherwise build whole path name
q = strchr(p[picked], GOLD_SLASH_CHR);
if(q) {
const char *slash = strchr(strarr[picked].c_str(), GOLD_SLASH_CHR);
if (slash)
{
finished = false;
strcpy(dir, p[picked]);
strcpy(dir, strarr[picked].c_str());
r = strrchr(dir, GOLD_SLASH_CHR);
if(r)
*r = NUL;
*q = NUL;
if (r) *r = NUL;
}
else {
finished = true;
PathCopy(filespec, cwd);
filespec += p[picked];
filespec += strarr[picked].c_str();
}
// free allocated strings
free_strings(p, files);
strarr.clear();
}
while(not finished); // if a directory was selected, go back and do again
// if a directory was selected, go back and do again
} while(not finished);
// change back to current drive and directory
gchdir(tcwd);
// free allocated char pointers
throw_xfree(p);
// return normally
return true;
gchdir(tcwd); // change back to current drive and directory
return true; // return normally
}

View File

@@ -98,8 +98,8 @@ static void hide_mouse_cursor_pck() {
// this function updates the current item by either
// displaying or erasing the selection bar on it
static void update_curr(char* strarr[], r_t* r, int bar) {
static void update_curr( const gstrarray &strarr, r_t* r, int bar)
{
// calculate row and column string will be displayed
// at, then print out the string character-by-character
@@ -119,8 +119,8 @@ static void update_curr(char* strarr[], r_t* r, int bar) {
// ------------------------------------------------------------------
static void update_line(char* strarr[], r_t* r, int wrow, int upcurr) {
static void update_line(const gstrarray &strarr, r_t* r, int wrow, int upcurr)
{
int nomore = false;
int ccol = r->gapspaces + r->xtraspaces;
int celem = (wrow*r->strsperline) + r->first;
@@ -142,8 +142,8 @@ static void update_line(char* strarr[], r_t* r, int wrow, int upcurr) {
// ------------------------------------------------------------------
// this function will update all items in the window
static void update_window(char* strarr[], r_t* r) {
static void update_window(const gstrarray &strarr, r_t* r)
{
hide_mouse_cursor_pck();
for(int crow=0; crow<r->wheight; crow++)
update_line(strarr, r, crow, 1);
@@ -205,8 +205,8 @@ static int e_endwin(r_t* r, int felem) {
// ------------------------------------------------------------------
static void goto_item(r_t* r, char* strarr[], int elem) {
static void goto_item(r_t* r, const gstrarray &strarr, int elem)
{
if(elem<0 or elem>r->lastelem)
elem = 0;
int outside = (elem<r->first or elem>r->last) ? YES : NO;
@@ -260,8 +260,8 @@ static int mouse_on_item(r_t* r, int mcrow, int mccol) {
// ------------------------------------------------------------------
static void page_down(char* strarr[], r_t* r) {
static void page_down(const gstrarray &strarr, r_t* r)
{
if(r->curr != r->last) {
r->curr = r->last;
update_window(strarr, r);
@@ -279,8 +279,8 @@ static void page_down(char* strarr[], r_t* r) {
// ------------------------------------------------------------------
static void page_up(char* strarr[], r_t* r) {
static void page_up(const gstrarray &strarr, r_t* r)
{
if(r->curr != r->first) {
r->curr = r->first;
update_window(strarr, r);
@@ -297,8 +297,8 @@ static void page_up(char* strarr[], r_t* r) {
// ------------------------------------------------------------------
static void scroll_down(char* strarr[], r_t* r, int upcurr) {
static void scroll_down(const gstrarray &strarr, r_t* r, int upcurr)
{
if(r->first) {
hide_mouse_cursor_pck();
if(upcurr)
@@ -317,8 +317,8 @@ static void scroll_down(char* strarr[], r_t* r, int upcurr) {
// ------------------------------------------------------------------
static void scroll_up(char* strarr[], r_t* r, int upcurr) {
static void scroll_up(const gstrarray &strarr, r_t* r, int upcurr)
{
if(r->last!=(r->lastelem)) {
hide_mouse_cursor_pck();
if(upcurr)
@@ -339,8 +339,8 @@ static void scroll_up(char* strarr[], r_t* r, int upcurr) {
// ------------------------------------------------------------------
// this function reads the mouse for input
static gkey read_mouse(char* strarr[], r_t* r) {
static gkey read_mouse(const gstrarray & /*strarr*/, r_t* /*r*/)
{
#ifdef GOLD_MOUSE
// if free-floating mouse cursor support is on
if(gmou.FreeCursor()) {
@@ -403,12 +403,11 @@ static gkey read_mouse(char* strarr[], r_t* r) {
// ------------------------------------------------------------------
int wpickstr(int srow, int scol, int erow, int ecol, int btype, vattr bordattr, vattr winattr, vattr barattr, char* strarr[], int initelem, VfvCP open) {
int i, j, maxlen, outside;
int wpickstr(int srow, int scol, int erow, int ecol, int btype, vattr bordattr, vattr winattr, vattr barattr, gstrarray &strarr, int initelem, VfvCP open)
{
int outside;
gkey xch;
char ch;
char* p;
r_t r;
int quickpos = (strarr[0][0] == ' ') ? 1 : 0;
@@ -416,14 +415,22 @@ int wpickstr(int srow, int scol, int erow, int ecol, int btype, vattr bordattr,
// go through input array and determine the longest
// string, and count the number of elements in the array
maxlen = strlen(m_title);
size_t maxlen = strlen(m_title);
for (i = 0; strarr[i] != NULL; i++)
if ((j = strlen(strarr[i])) > maxlen)
maxlen = j;
gstrarray::const_iterator it = strarr.begin();
gstrarray::const_iterator end = strarr.end();
for (; it != end; it++)
{
size_t len;
if ((len = it->length()) > maxlen)
{
maxlen = len;
}
}
r.maxstrlen = maxlen;
r.lastelem = ((r.numelems=i)-1);
r.numelems = strarr.size();
r.lastelem = r.numelems - 1;
r.winattr = winattr;
r.barattr = barattr;
@@ -507,16 +514,18 @@ int wpickstr(int srow, int scol, int erow, int ecol, int btype, vattr bordattr,
switch(xch) {
case Key_Space:
if(wpickstr_tag) {
p = strarr[r.curr];
switch(*p) {
if (wpickstr_tag)
{
char p = strarr[r.curr][0];
switch (p)
{
case ' ':
*p = (char)wpickstr_tag;
update_curr(strarr,&r,1);
strarr[r.curr][0] = (char)wpickstr_tag;
update_curr(strarr, &r, 1);
break;
default:
*p = ' ';
update_curr(strarr,&r,1);
strarr[r.curr][0] = ' ';
update_curr(strarr, &r, 1);
}
kbput(Key_Dwn);
}
@@ -544,18 +553,26 @@ int wpickstr(int srow, int scol, int erow, int ecol, int btype, vattr bordattr,
case Key_StrG:
case Key_S_8:
if(wpickstr_tag) {
for(i=0; i<r.numelems; i++)
if (wpickstr_tag)
{
for (size_t i = 0; i < r.numelems; i++)
{
strarr[i][0] = (char)wpickstr_tag;
update_window(strarr,&r);
}
update_window(strarr, &r);
}
break;
case Key_Sls:
if(wpickstr_tag) {
for(i=0; i<r.numelems; i++)
if (wpickstr_tag)
{
for (size_t i = 0; i < r.numelems; i++)
{
strarr[i][0] = ' ';
update_window(strarr,&r);
}
update_window(strarr, &r);
}
break;
@@ -679,22 +696,29 @@ int wpickstr(int srow, int scol, int erow, int ecol, int btype, vattr bordattr,
// character as the keypress. If not found after current
// position, search from the beginning for a match
ch = (char)g_toupper(char(xch & 0xFF));
if(!ch)
break;
for(i=r.curr+1; i<r.numelems; i++)
if(ch==g_toupper(strarr[i][quickpos]))
if (!ch) break;
size_t i;
for (i = r.curr + 1; i < r.numelems; i++)
{
if (ch == g_toupper(strarr[i][quickpos]))
break;
if(i==r.numelems) {
for(i=0;i<r.curr;i++)
if(ch==g_toupper(strarr[i][quickpos]))
}
if (i == r.numelems)
{
for (i = 0; i < r.curr; i++)
{
if (ch == g_toupper(strarr[i][quickpos]))
break;
if(i==r.curr)
continue;
}
if (i == r.curr) continue;
}
// a matching ASCII character was found. set position
// to matching element, adjusting window if necessary
goto_item(&r,strarr,i);
goto_item(&r, strarr, i);
}
}
}