X-Git-Url: http://git.kpe.io/?p=cl-readline.git;a=blobdiff_plain;f=cl-readline.c;fp=cl-readline.c;h=3697a7702036cdfbc5e15589853dd026e4c49632;hp=63874f6b7bc4f09cbe3fcd37a673e765ad19696a;hb=b8a4296ea50f31577fa6ee695ef900a4637ee0c9;hpb=044e8c98d9b11b20a62d6a3ea31bfb6458a6c2f7 diff --git a/cl-readline.c b/cl-readline.c index 63874f6..3697a77 100644 --- a/cl-readline.c +++ b/cl-readline.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2003 Nikodemus Siivola - * + * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including @@ -8,10 +8,10 @@ * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: - * + * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. @@ -43,10 +43,10 @@ add_completion (char * str) { int cmp = strcmp (str, tmp->str); if (0 == cmp) - return 1; - + return 1; + if (0 < cmp) - break; + break; /* printf ("-skip- (%s)\n", tmp->str);*/ @@ -57,13 +57,13 @@ add_completion (char * str) node = malloc (sizeof (node_t)); if (!node) return 0; - + node->next = tmp; node->str = strdup (str); if (! pre) collection = node; - else + else pre->next = node; return 1; @@ -80,15 +80,15 @@ custom_completer (const char * str, int target) root = NULL; node_t * tmp = collection; while (len && tmp) - { - if (0 == strncmp (str, tmp->str, len)) - { - root = tmp; - return strdup (root->str); - } - else - tmp = tmp->next; - } + { + if (0 == strncmp (str, tmp->str, len)) + { + root = tmp; + return strdup (root->str); + } + else + tmp = tmp->next; + } return (char *)NULL; } else if (root && (0 == strncmp (str, root->str, len)))