#include "config.h"
#include <dirent.h>
#include <errno.h>
#include <string.h>
#include <sys/stat.h>
#include "mutt/lib.h"
#include "core/lib.h"
#include "mutt_globals.h"
#include "muttlib.h"
#include "options.h"
#include "protos.h"
#include "imap/lib.h"
#include "nntp/lib.h"
Go to the source code of this file.
String auto-completion routines
- Authors
-
- Copyright
- This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version.
This program 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 General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
Definition in file complete.c.
◆ mutt_complete()
int mutt_complete |
( |
char * |
buf, |
|
|
size_t |
buflen |
|
) |
| |
Attempt to complete a partial pathname.
- Parameters
-
buf | Buffer containing pathname |
buflen | Length of buffer |
- Return values
-
Given a partial pathname, fill in as much of the rest of the path as is unique.
Definition at line 57 of file complete.c.
61 struct dirent *de = NULL;
64 struct Buffer *dirpart = NULL;
65 struct Buffer *exp_dirpart = NULL;
66 struct Buffer *filepart = NULL;
69 struct Buffer *imap_path = NULL;
83 if ((*buf ==
'=') || (*buf ==
'+') || (*buf ==
'!'))
110 if ((*buf ==
'=') || (*buf ==
'+') || (*buf ==
'!'))
117 p = strrchr(buf,
'/');
122 (
size_t)(p - buf - 1));
133 p = strrchr(buf,
'/');
172 while ((de = readdir(dirp)))
183 while ((de = readdir(dirp)))
189 char *cp = filepart->
data;
191 for (
int i = 0; (*cp !=
'\0') && (de->d_name[i] !=
'\0'); i++, cp++)
193 if (*cp != de->d_name[i])
243 return init ? 0 : -1;
bool mutt_strn_equal(const char *a, const char *b, size_t num)
Check for equality of two strings (to a maximum), safely.
String manipulation buffer.
bool mutt_buffer_is_empty(const struct Buffer *buf)
Is the Buffer empty?
@ LL_DEBUG1
Log at debug level 1.
int nntp_complete(char *buf, size_t buflen)
Auto-complete NNTP newsgroups.
void mutt_buffer_reset(struct Buffer *buf)
Reset an existing Buffer.
void mutt_buffer_pool_release(struct Buffer **pbuf)
Free a Buffer from the pool.
bool mutt_str_equal(const char *a, const char *b)
Compare two strings.
size_t mutt_buffer_addch(struct Buffer *buf, char c)
Add a single character to a Buffer.
struct Buffer * mutt_buffer_pool_get(void)
Get a Buffer from the pool.
size_t mutt_buffer_copy(struct Buffer *dst, const struct Buffer *src)
Copy a Buffer's contents to another Buffer.
WHERE char * C_Folder
Config: Base folder for a set of mailboxes.
@ MUTT_IMAP
'IMAP' Mailbox type
size_t mutt_buffer_concat_path(struct Buffer *buf, const char *dir, const char *fname)
Join a directory name and a filename.
int imap_complete(char *buf, size_t buflen, const char *path)
Try to complete an IMAP folder path.
#define mutt_debug(LEVEL,...)
void mutt_buffer_expand_path(struct Buffer *buf)
Create the canonical path.
static const char * mutt_buffer_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
void mutt_buffer_fix_dptr(struct Buffer *buf)
Move the dptr to end of the Buffer.
WHERE char * C_SpoolFile
Config: Inbox.
size_t mutt_buffer_substrcpy(struct Buffer *buf, const char *beg, const char *end)
Copy a partial string into a Buffer.
enum MailboxType imap_path_probe(const char *path, const struct stat *st)
Is this an IMAP Mailbox? - Implements MxOps::path_probe()
size_t mutt_buffer_len(const struct Buffer *buf)
Calculate the length of a Buffer.
size_t mutt_buffer_addstr(struct Buffer *buf, const char *s)
Add a string to a Buffer.
char * data
Pointer to data.
size_t mutt_buffer_concatn_path(struct Buffer *buf, const char *dir, size_t dirlen, const char *fname, size_t fnamelen)
Join a directory name and a filename.
size_t mutt_buffer_strcpy(struct Buffer *buf, const char *s)
Copy a string into a Buffer.
@ LL_DEBUG2
Log at debug level 2.
WHERE bool OptNews
(pseudo) used to change reader mode
size_t mutt_str_copy(char *dest, const char *src, size_t dsize)
Copy a string into a buffer (guaranteeing NUL-termination)