mirror of
https://github.com/tbamud/tbamud.git
synced 2026-04-30 04:41:51 +02:00
Compare commits
2 Commits
96dfc6fb09
...
copilot/fi
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bf9105aa4a | ||
|
|
fd81fadaed |
@@ -41,7 +41,7 @@
|
|||||||
/* local (file scope) functions */
|
/* local (file scope) functions */
|
||||||
static int perform_dupe_check(struct descriptor_data *d);
|
static int perform_dupe_check(struct descriptor_data *d);
|
||||||
static struct alias_data *find_alias(struct alias_data *alias_list, char *str);
|
static struct alias_data *find_alias(struct alias_data *alias_list, char *str);
|
||||||
static void perform_complex_alias(struct txt_q *input_q, char *orig, struct alias_data *a, struct char_data *ch);
|
static void perform_complex_alias(struct txt_q *input_q, char *orig, struct alias_data *a);
|
||||||
static int _parse_name(char *arg, char *name);
|
static int _parse_name(char *arg, char *name);
|
||||||
static bool perform_new_char_dupe_check(struct descriptor_data *d);
|
static bool perform_new_char_dupe_check(struct descriptor_data *d);
|
||||||
/* sort_commands utility */
|
/* sort_commands utility */
|
||||||
@@ -668,10 +668,9 @@ ACMD(do_alias)
|
|||||||
* commands. */
|
* commands. */
|
||||||
#define NUM_TOKENS 9
|
#define NUM_TOKENS 9
|
||||||
|
|
||||||
static void perform_complex_alias(struct txt_q *input_q, char *orig, struct alias_data *a, struct char_data *ch)
|
static void perform_complex_alias(struct txt_q *input_q, char *orig, struct alias_data *a)
|
||||||
{
|
{
|
||||||
struct txt_q temp_queue;
|
struct txt_q temp_queue;
|
||||||
struct txt_block *qtmp;
|
|
||||||
char *tokens[NUM_TOKENS], *temp, *write_point;
|
char *tokens[NUM_TOKENS], *temp, *write_point;
|
||||||
char buf2[MAX_RAW_INPUT_LENGTH], buf[MAX_RAW_INPUT_LENGTH]; /* raw? */
|
char buf2[MAX_RAW_INPUT_LENGTH], buf[MAX_RAW_INPUT_LENGTH]; /* raw? */
|
||||||
int num_of_tokens = 0, num;
|
int num_of_tokens = 0, num;
|
||||||
@@ -698,27 +697,16 @@ static void perform_complex_alias(struct txt_q *input_q, char *orig, struct alia
|
|||||||
} else if (*temp == ALIAS_VAR_CHAR) {
|
} else if (*temp == ALIAS_VAR_CHAR) {
|
||||||
temp++;
|
temp++;
|
||||||
if ((num = *temp - '1') < num_of_tokens && num >= 0) {
|
if ((num = *temp - '1') < num_of_tokens && num >= 0) {
|
||||||
if ((write_point - buf) + strlen(tokens[num]) >= MAX_RAW_INPUT_LENGTH)
|
strcpy(write_point, tokens[num]); /* strcpy: OK */
|
||||||
goto overflow;
|
|
||||||
strcpy(write_point, tokens[num]);
|
|
||||||
write_point += strlen(tokens[num]);
|
write_point += strlen(tokens[num]);
|
||||||
} else if (*temp == ALIAS_GLOB_CHAR) {
|
} else if (*temp == ALIAS_GLOB_CHAR) {
|
||||||
skip_spaces(&orig);
|
skip_spaces(&orig);
|
||||||
if ((write_point - buf) + strlen(orig) >= MAX_RAW_INPUT_LENGTH)
|
strcpy(write_point, orig); /* strcpy: OK */
|
||||||
goto overflow;
|
|
||||||
strcpy(write_point, orig);
|
|
||||||
write_point += strlen(orig);
|
write_point += strlen(orig);
|
||||||
} else {
|
} else if ((*(write_point++) = *temp) == '$') /* redouble $ for act safety */
|
||||||
if (write_point - buf + 2 >= MAX_RAW_INPUT_LENGTH)
|
*(write_point++) = '$';
|
||||||
goto overflow;
|
} else
|
||||||
if ((*(write_point++) = *temp) == '$') /* redouble $ for act safety */
|
|
||||||
*(write_point++) = '$';
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (write_point - buf + 1 >= MAX_RAW_INPUT_LENGTH)
|
|
||||||
goto overflow;
|
|
||||||
*(write_point++) = *temp;
|
*(write_point++) = *temp;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
*write_point = '\0';
|
*write_point = '\0';
|
||||||
@@ -732,16 +720,6 @@ static void perform_complex_alias(struct txt_q *input_q, char *orig, struct alia
|
|||||||
temp_queue.tail->next = input_q->head;
|
temp_queue.tail->next = input_q->head;
|
||||||
input_q->head = temp_queue.head;
|
input_q->head = temp_queue.head;
|
||||||
}
|
}
|
||||||
return;
|
|
||||||
|
|
||||||
overflow:
|
|
||||||
send_to_char(ch, "Alias expansion too long.\r\n");
|
|
||||||
while (temp_queue.head) {
|
|
||||||
qtmp = temp_queue.head;
|
|
||||||
temp_queue.head = qtmp->next;
|
|
||||||
free(qtmp->text);
|
|
||||||
free(qtmp);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Given a character and a string, perform alias replacement on it.
|
/* Given a character and a string, perform alias replacement on it.
|
||||||
@@ -777,7 +755,7 @@ int perform_alias(struct descriptor_data *d, char *orig, size_t maxlen)
|
|||||||
strlcpy(orig, a->replacement, maxlen);
|
strlcpy(orig, a->replacement, maxlen);
|
||||||
return (0);
|
return (0);
|
||||||
} else {
|
} else {
|
||||||
perform_complex_alias(&d->input, ptr, a, d->character);
|
perform_complex_alias(&d->input, ptr, a);
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -405,7 +405,7 @@ int load_char(const char *name, struct char_data *ch)
|
|||||||
|
|
||||||
case 'P':
|
case 'P':
|
||||||
if (!strcmp(tag, "Page")) GET_PAGE_LENGTH(ch) = atoi(line);
|
if (!strcmp(tag, "Page")) GET_PAGE_LENGTH(ch) = atoi(line);
|
||||||
else if (!strcmp(tag, "Pass")) strcpy(GET_PASSWD(ch), line);
|
else if (!strcmp(tag, "Pass")) { strncpy(GET_PASSWD(ch), line, MAX_PWD_LENGTH); GET_PASSWD(ch)[MAX_PWD_LENGTH] = '\0'; }
|
||||||
else if (!strcmp(tag, "Plyd")) ch->player.time.played = atoi(line);
|
else if (!strcmp(tag, "Plyd")) ch->player.time.played = atoi(line);
|
||||||
else if (!strcmp(tag, "PfIn")) POOFIN(ch) = strdup(line);
|
else if (!strcmp(tag, "PfIn")) POOFIN(ch) = strdup(line);
|
||||||
else if (!strcmp(tag, "PfOt")) POOFOUT(ch) = strdup(line);
|
else if (!strcmp(tag, "PfOt")) POOFOUT(ch) = strdup(line);
|
||||||
|
|||||||
Reference in New Issue
Block a user