start = (string[0] << 8) | string[1];
thread->misc_conduit = FR_CONDUIT_COMPLETE;
+
+ fprintf(stderr, "COMPLETE %d %d %s\n", hdr->length - 2, start, string + 2);
fr_radmin_complete(thread->misc, string + 2, start);
thread->misc_conduit = FR_CONDUIT_STDOUT;
status = FR_CONDUIT_SUCCESS;
if (stack_depth > 0) *(p++) = ' ';
+ /*
+ * No input, allow a trailing space so that tab
+ * completion works.
+ */
+ if (!*cmd) {
+ return p - cmd_buffer;
+ }
+
len = strlcpy(p, cmd, cmd_buffer + sizeof(cmd_buffer) - p);
if ((p + len) >= (cmd_buffer + sizeof(cmd_buffer))) {
fprintf(stderr, "Command too long\n");
radmin_num_expansions = 0;
- start += stack[stack_depth] - cmd_buffer;
+ len = cmd_copy(rl_line_buffer);
+ if (len < 0) return NULL;
+
+ start += len;
if (start > 65535) return NULL;
io_buffer[0] = (start >> 8) & 0xff;
io_buffer[1] = start & 0xff;
- len = cmd_copy(rl_line_buffer);
- if (len < 0) return NULL;
-
/*
* Note that "text" is the PARTIAL thing we're trying to complete.
* And "start" is the OFFSET from rl_line_buffer where we want to