diff --git a/Changelog b/Changelog index d162e8f..26f9a66 100644 --- a/Changelog +++ b/Changelog @@ -1,5 +1,7 @@ [Changes 1.2.2] +* Rename exported function move_to_abs_word() to move_to_word(). (caf) + * Make "You can't hide an invisible window" message respect /SET WINDOW_QUIET. (caf) diff --git a/include/ircaux.h b/include/ircaux.h index eff7e0b..d334108 100644 --- a/include/ircaux.h +++ b/include/ircaux.h @@ -133,7 +133,7 @@ char * base64_encode (const void *data, size_t size); #define SOS -32767 #define EOS 32767 char *BX_strsearch (register char *, char *, char *, int); -char *BX_move_to_abs_word (const register char *, char **, int); +char *BX_move_to_word (const char *, int); char *BX_move_word_rel (const char *, char **, int); char *BX_extract (char *, int, int); char *BX_extract2 (const char *, int, int); diff --git a/include/module.h b/include/module.h index e036892..8c78a37 100644 --- a/include/module.h +++ b/include/module.h @@ -10,7 +10,7 @@ * if we change the table below, we change this module number to the * current date (YYYYMMDDxx where xx is a serial number). */ -#define MODULE_VERSION 2017110602UL +#define MODULE_VERSION 2017111401UL #include "struct.h" @@ -201,7 +201,7 @@ enum FUNCTION_VALUE /* words.c */ STRSEARCH, - MOVE_TO_ABS_WORD, + MOVE_TO_WORD, MOVE_WORD_REL, EXTRACT, EXTRACT2, diff --git a/include/modval.h b/include/modval.h index fc64b8a..7afe7ea 100644 --- a/include/modval.h +++ b/include/modval.h @@ -200,7 +200,7 @@ extern Function_ptr *global; /* words.c reg.c */ #define strsearch (*(char *(*)(char *, char *, char *, int ))global[STRSEARCH]) -#define move_to_abs_word (*(char *(*)(const char *, char **, int ))global[MOVE_TO_ABS_WORD]) +#define move_to_word (*(char *(*)(const char *, int))global[MOVE_TO_WORD]) #define move_word_rel (*(char *(*)(const char *, char **, int ))global[MOVE_WORD_REL]) #define extract (*(char *(*)(char *, int , int ))global[EXTRACT]) #define extract2 (*(char *(*)(const char *, int , int ))global[EXTRACT2]) diff --git a/source/modules.c b/source/modules.c index aa846c0..5634691 100644 --- a/source/modules.c +++ b/source/modules.c @@ -201,7 +201,7 @@ static int already_done = 0; /* words.c reg.c */ global_table[STRSEARCH] = (Function_ptr) BX_strsearch; - global_table[MOVE_TO_ABS_WORD] = (Function_ptr) BX_move_to_abs_word; + global_table[MOVE_TO_WORD] = (Function_ptr) BX_move_to_word; global_table[MOVE_WORD_REL] = (Function_ptr) BX_move_word_rel; global_table[EXTRACT] = (Function_ptr) BX_extract; global_table[EXTRACT2] = (Function_ptr) BX_extract2; diff --git a/source/who.c b/source/who.c index 600e4e0..44f2480 100644 --- a/source/who.c +++ b/source/who.c @@ -845,7 +845,7 @@ void BX_userhostbase(char *args, void (*line) (UserhostItem *, char *, char *), { UserhostEntry *new_uh = get_new_userhost_entry(); - move_to_abs_word(ptr, &next_ptr, 5); + next_ptr = move_to_word(ptr, 5); if (next_ptr && *next_ptr && next_ptr > ptr) next_ptr[-1] = 0; diff --git a/source/words.c b/source/words.c index 15461d6..951ce42 100644 --- a/source/words.c +++ b/source/words.c @@ -47,12 +47,14 @@ extern char *BX_strsearch(register char *start, char *mark, char *chars, int how return mark; } -/* Move to an absolute word number from start */ -/* First word is always numbered zero. */ -extern char *BX_move_to_abs_word (const register char *start, char **mark, int word) +/* move_to_word() + * + * Return a pointer to the first character of the Nth word in a string. + * The first word is always numbered zero. + */ +extern char *BX_move_to_word(const char *start, int word) { - register char *pointer = (char *)start; - register int counter = word; + const char *pointer = start; /* This fixes a bug that counted leading spaces as * a word, when they're really not a word.... @@ -64,10 +66,10 @@ extern char *BX_move_to_abs_word (const register char *start, char **mark, int w * my foot in this one... I'm just going to go with * what the stock client does... */ - while (pointer && *pointer && my_isspace(*pointer)) + while (*pointer && my_isspace(*pointer)) pointer++; - for (;counter > 0 && *pointer;counter--) + for (; word > 0 && *pointer; word--) { while (*pointer && !my_isspace(*pointer)) pointer++; @@ -75,9 +77,7 @@ extern char *BX_move_to_abs_word (const register char *start, char **mark, int w pointer++; } - if (mark) - *mark = pointer; - return pointer; + return (char *)pointer; } /* move_word_rel() @@ -179,7 +179,7 @@ extern char *BX_extract2(const char *start, int firstword, int lastword) /* If the firstword is positive, move to that word */ else if (firstword >= 0) { - move_to_abs_word(start, &mark, firstword); + mark = move_to_word(start, firstword); if (!*mark) return m_strdup(empty_string); } @@ -221,7 +221,7 @@ extern char *BX_extract2(const char *start, int firstword, int lastword) else { if (lastword >= 0) - move_to_abs_word(start, &mark2, lastword+1); + mark2 = move_to_word(start, lastword + 1); else { mark2 = (char *)start + strlen(start); @@ -297,7 +297,7 @@ extern char *BX_extract(char *start, int firstword, int lastword) /* If the firstword is positive, move to that word */ else if (firstword >= 0) - move_to_abs_word(start, &mark, firstword); + mark = move_to_word(start, firstword); /* Its negative. Hold off right now. */ else @@ -314,7 +314,7 @@ extern char *BX_extract(char *start, int firstword, int lastword) else { if (lastword >= 0) - move_to_abs_word(start, &mark2, lastword+1); + mark2 = move_to_word(start, lastword + 1); else /* it's negative -- that's not valid */ return m_strdup(empty_string);