2010-01-12 17:44:24 +03:00
|
|
|
/* $NetBSD: complete.c,v 1.20 2010/01/12 14:44:24 christos Exp $ */
|
2006-09-18 23:48:44 +04:00
|
|
|
|
|
|
|
/*-
|
2006-10-22 01:37:20 +04:00
|
|
|
* Copyright (c) 1997-2000,2005,2006 The NetBSD Foundation, Inc.
|
2006-09-18 23:48:44 +04:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* This code is derived from software contributed to The NetBSD Foundation
|
|
|
|
* by Luke Mewburn.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
|
|
|
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
|
|
|
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
|
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
|
|
|
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
|
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
|
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
|
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
|
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
|
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
* POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
/*
|
|
|
|
* Most of this is derived or copied from src/usr.bin/ftp/complete.c (1.41).
|
|
|
|
*/
|
2006-09-18 23:48:44 +04:00
|
|
|
|
2006-10-22 01:37:20 +04:00
|
|
|
#ifdef USE_EDITLINE
|
2006-09-18 23:48:44 +04:00
|
|
|
|
|
|
|
#include <sys/cdefs.h>
|
|
|
|
#ifndef lint
|
2010-01-12 17:44:24 +03:00
|
|
|
__RCSID("$NetBSD: complete.c,v 1.20 2010/01/12 14:44:24 christos Exp $");
|
2006-09-18 23:48:44 +04:00
|
|
|
#endif /* not lint */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* FTP user program - command and file completion routines
|
|
|
|
*/
|
|
|
|
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
#include <assert.h>
|
2006-09-18 23:48:44 +04:00
|
|
|
#include <ctype.h>
|
|
|
|
#include <err.h>
|
|
|
|
#include <dirent.h>
|
|
|
|
#include <glob.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <stringlist.h>
|
2009-02-11 22:10:08 +03:00
|
|
|
#include <termcap.h>
|
2006-10-22 01:37:20 +04:00
|
|
|
#include <util.h>
|
2006-09-18 23:48:44 +04:00
|
|
|
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
#include <sys/param.h>
|
|
|
|
#include <sys/stat.h>
|
|
|
|
|
2006-09-18 23:48:44 +04:00
|
|
|
#include "rcv.h" /* includes "glob.h" */
|
|
|
|
#include "extern.h"
|
|
|
|
#include "complete.h"
|
2006-10-22 01:37:20 +04:00
|
|
|
#ifdef MIME_SUPPORT
|
|
|
|
#include "mime.h"
|
|
|
|
#endif
|
From Anon Ymous:
- Remove all longjmp(3) calls from signal handlers. Instead, we post
to an internal signal queue and check that periodically. All signal
related code is now in sig.c, except for the SIGCHLD handler which
remains in popen.c as it is intimately tied to routines there.
- Handle SIGPIPE in type1() regardless of mime support, or else the
handler in execute() will prevent our error code from being returned
resulting in 'sawcom' not being set on the first command as it should.
This only affected the initial behavior of the "next" command without
mime support.
- Add the 'T' flag to many commands in cmdtab.c that should not look
like the first command. E.g., start mail on a mailbox with multiple
messages, run "set foo", then "next", and watch the second message get
displayed rather than the first as is the case without the first "set"
command.
- Add file descriptor and file handle leak detection. Enabled by
DEBUG_FILE_LEAK. This will likely disappear in the future.
- Fix a long standing (since import in 1993) longjmp() bug in
edstop(): the jmpbuf was invalid when quit() is called at the end of
main.
- Fix a long standing bug (since import in 1993) in snarf() where it
didn't strip whitespace correctly if the line consisted only of
whitespace.
- Lint cleanup.
- New Feature: "Header" command. This allows miscellaneous header
fields to be added to the header, e.g., "X-Organization:" or
"Reply-To:" fields.
- New Feature: "page-also" variable. This allows the specification of
additional commands to page. It is more flexible than "crt".
- Document the "pager-off" variable: if set, it disables paging
entirely.
2009-04-10 17:08:24 +04:00
|
|
|
#include "sig.h"
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
#ifdef THREAD_SUPPORT
|
|
|
|
#include "thread.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define BELL 0x7
|
2006-09-18 23:48:44 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Global variables
|
|
|
|
*/
|
|
|
|
static int doglob = 1; /* glob local file names */
|
|
|
|
|
|
|
|
#define ttyout stdout
|
|
|
|
#define ttywidth screenwidth /* in "glob.h" */
|
|
|
|
#define ttyheight screenheight /* in "glob.h" */
|
|
|
|
|
|
|
|
/************************************************************************/
|
2006-10-22 01:37:20 +04:00
|
|
|
/* from src/usr.bin/ftp/utils.h (1.135) - begin */
|
2006-09-18 23:48:44 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* List words in stringlist, vertically arranged
|
|
|
|
*/
|
|
|
|
static void
|
|
|
|
list_vertical(StringList *sl)
|
|
|
|
{
|
2009-01-18 04:29:57 +03:00
|
|
|
int k;
|
|
|
|
size_t i, j, columns, lines;
|
2006-09-18 23:48:44 +04:00
|
|
|
char *p;
|
|
|
|
size_t w, width;
|
|
|
|
|
|
|
|
width = 0;
|
|
|
|
|
2006-10-22 01:37:20 +04:00
|
|
|
for (i = 0; i < sl->sl_cur; i++) {
|
2006-09-18 23:48:44 +04:00
|
|
|
w = strlen(sl->sl_str[i]);
|
|
|
|
if (w > width)
|
|
|
|
width = w;
|
|
|
|
}
|
|
|
|
width = (width + 8) &~ 7;
|
|
|
|
|
|
|
|
columns = ttywidth / width;
|
|
|
|
if (columns == 0)
|
|
|
|
columns = 1;
|
|
|
|
lines = (sl->sl_cur + columns - 1) / columns;
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
k = 0;
|
2006-09-18 23:48:44 +04:00
|
|
|
for (i = 0; i < lines; i++) {
|
|
|
|
for (j = 0; j < columns; j++) {
|
|
|
|
p = sl->sl_str[j * lines + i];
|
|
|
|
if (p)
|
2006-10-22 01:37:20 +04:00
|
|
|
(void)fputs(p, ttyout);
|
2006-09-18 23:48:44 +04:00
|
|
|
if (j * lines + i + lines >= sl->sl_cur) {
|
2006-10-22 01:37:20 +04:00
|
|
|
(void)putc('\n', ttyout);
|
2006-09-18 23:48:44 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (p) {
|
|
|
|
w = strlen(p);
|
|
|
|
while (w < width) {
|
|
|
|
w = (w + 8) &~ 7;
|
|
|
|
(void)putc('\t', ttyout);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
if (ttyheight > 2 && ++k == ttyheight - 2) {
|
|
|
|
int ch;
|
|
|
|
k = 0;
|
|
|
|
(void)fputs("--more--", ttyout);
|
|
|
|
while ((ch = getchar()) != EOF && ch != ' ' && ch != 'q')
|
|
|
|
(void)putc(BELL, ttyout);
|
|
|
|
(void)fputs("\r \r", ttyout);
|
|
|
|
if (ch == 'q')
|
|
|
|
break;
|
|
|
|
}
|
2006-09-18 23:48:44 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Copy characters from src into dst, \ quoting characters that require it
|
|
|
|
*/
|
|
|
|
static void
|
|
|
|
ftpvis(char *dst, size_t dstlen, const char *src, size_t srclen)
|
|
|
|
{
|
2009-01-18 04:29:57 +03:00
|
|
|
size_t di, si;
|
2006-09-18 23:48:44 +04:00
|
|
|
|
|
|
|
for (di = si = 0;
|
|
|
|
src[si] != '\0' && di < dstlen && si < srclen;
|
|
|
|
di++, si++) {
|
|
|
|
switch (src[si]) {
|
|
|
|
case '\\':
|
|
|
|
case ' ':
|
|
|
|
case '\t':
|
|
|
|
case '\r':
|
|
|
|
case '\n':
|
|
|
|
case '"':
|
|
|
|
dst[di++] = '\\';
|
|
|
|
if (di >= dstlen)
|
|
|
|
break;
|
|
|
|
/* FALLTHROUGH */
|
|
|
|
default:
|
|
|
|
dst[di] = src[si];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
dst[di] = '\0';
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* sl_init() with inbuilt error checking
|
|
|
|
*/
|
|
|
|
static StringList *
|
2006-10-22 01:37:20 +04:00
|
|
|
mail_sl_init(void)
|
2006-09-18 23:48:44 +04:00
|
|
|
{
|
|
|
|
StringList *p;
|
|
|
|
|
|
|
|
p = sl_init();
|
|
|
|
if (p == NULL)
|
2010-01-12 17:44:24 +03:00
|
|
|
err(EXIT_FAILURE, "Unable to allocate memory for stringlist");
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
return p;
|
2006-09-18 23:48:44 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* sl_add() with inbuilt error checking
|
|
|
|
*/
|
|
|
|
static void
|
2006-10-22 01:37:20 +04:00
|
|
|
mail_sl_add(StringList *sl, char *i)
|
2006-09-18 23:48:44 +04:00
|
|
|
{
|
|
|
|
|
|
|
|
if (sl_add(sl, i) == -1)
|
2010-01-12 17:44:24 +03:00
|
|
|
err(EXIT_FAILURE, "Unable to add `%s' to stringlist", i);
|
2006-09-18 23:48:44 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Glob a local file name specification with the expectation of a single
|
|
|
|
* return value. Can't control multiple values being expanded from the
|
|
|
|
* expression, we return only the first.
|
|
|
|
* Returns NULL on error, or a pointer to a buffer containing the filename
|
|
|
|
* that's the caller's responsiblity to free(3) when finished with.
|
|
|
|
*/
|
|
|
|
static char *
|
|
|
|
globulize(const char *pattern)
|
|
|
|
{
|
|
|
|
glob_t gl;
|
|
|
|
int flags;
|
|
|
|
char *p;
|
|
|
|
|
|
|
|
if (!doglob)
|
2006-10-22 01:37:20 +04:00
|
|
|
return estrdup(pattern);
|
2006-09-18 23:48:44 +04:00
|
|
|
|
|
|
|
flags = GLOB_BRACE|GLOB_NOCHECK|GLOB_TILDE;
|
2006-10-22 01:37:20 +04:00
|
|
|
(void)memset(&gl, 0, sizeof(gl));
|
2006-09-18 23:48:44 +04:00
|
|
|
if (glob(pattern, flags, NULL, &gl) || gl.gl_pathc == 0) {
|
|
|
|
warnx("%s: not found", pattern);
|
|
|
|
globfree(&gl);
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
return NULL;
|
2006-09-18 23:48:44 +04:00
|
|
|
}
|
2006-10-22 01:37:20 +04:00
|
|
|
p = estrdup(gl.gl_pathv[0]);
|
2006-09-18 23:48:44 +04:00
|
|
|
globfree(&gl);
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
return p;
|
2006-09-18 23:48:44 +04:00
|
|
|
}
|
|
|
|
|
2006-10-22 01:37:20 +04:00
|
|
|
/* from src/usr.bin/ftp/utils.h (1.135) - end */
|
2006-09-18 23:48:44 +04:00
|
|
|
/************************************************************************/
|
|
|
|
|
|
|
|
static int
|
|
|
|
comparstr(const void *a, const void *b)
|
|
|
|
{
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
return strcmp(*(const char * const *)a, *(const char * const *)b);
|
2006-09-18 23:48:44 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Determine if complete is ambiguous. If unique, insert.
|
|
|
|
* If no choices, error. If unambiguous prefix, insert that.
|
|
|
|
* Otherwise, list choices. words is assumed to be filtered
|
|
|
|
* to only contain possible choices.
|
|
|
|
* Args:
|
|
|
|
* word word which started the match
|
2006-10-22 01:37:20 +04:00
|
|
|
* dolist list by default
|
2006-09-18 23:48:44 +04:00
|
|
|
* words stringlist containing possible matches
|
|
|
|
* Returns a result as per el_set(EL_ADDFN, ...)
|
|
|
|
*/
|
|
|
|
static unsigned char
|
2006-10-22 01:37:20 +04:00
|
|
|
complete_ambiguous(EditLine *el, char *word, int dolist, StringList *words)
|
2006-09-18 23:48:44 +04:00
|
|
|
{
|
|
|
|
char insertstr[MAXPATHLEN];
|
|
|
|
char *lastmatch, *p;
|
2009-01-18 04:29:57 +03:00
|
|
|
size_t i, j, matchlen, wordlen;
|
2006-09-18 23:48:44 +04:00
|
|
|
|
|
|
|
wordlen = strlen(word);
|
|
|
|
if (words->sl_cur == 0)
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
return CC_ERROR; /* no choices available */
|
2006-09-18 23:48:44 +04:00
|
|
|
|
|
|
|
if (words->sl_cur == 1) { /* only once choice available */
|
|
|
|
p = words->sl_str[0] + wordlen;
|
|
|
|
if (*p == '\0') /* at end of word? */
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
return CC_REFRESH;
|
2006-09-18 23:48:44 +04:00
|
|
|
ftpvis(insertstr, sizeof(insertstr), p, strlen(p));
|
|
|
|
if (el_insertstr(el, insertstr) == -1)
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
return CC_ERROR;
|
2006-09-18 23:48:44 +04:00
|
|
|
else
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
return CC_REFRESH;
|
2006-09-18 23:48:44 +04:00
|
|
|
}
|
|
|
|
|
2006-10-22 01:37:20 +04:00
|
|
|
if (!dolist) {
|
2006-09-18 23:48:44 +04:00
|
|
|
matchlen = 0;
|
|
|
|
lastmatch = words->sl_str[0];
|
|
|
|
matchlen = strlen(lastmatch);
|
2006-10-22 01:37:20 +04:00
|
|
|
for (i = 1; i < words->sl_cur; i++) {
|
|
|
|
for (j = wordlen; j < strlen(words->sl_str[i]); j++)
|
2006-09-18 23:48:44 +04:00
|
|
|
if (lastmatch[j] != words->sl_str[i][j])
|
|
|
|
break;
|
|
|
|
if (j < matchlen)
|
|
|
|
matchlen = j;
|
|
|
|
}
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
if (matchlen >= wordlen) {
|
2006-09-18 23:48:44 +04:00
|
|
|
ftpvis(insertstr, sizeof(insertstr),
|
|
|
|
lastmatch + wordlen, matchlen - wordlen);
|
|
|
|
if (el_insertstr(el, insertstr) == -1)
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
return CC_ERROR;
|
2006-09-18 23:48:44 +04:00
|
|
|
else
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
return CC_REFRESH_BEEP;
|
2006-09-18 23:48:44 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-10-22 01:37:20 +04:00
|
|
|
(void)putc('\n', ttyout);
|
2006-09-18 23:48:44 +04:00
|
|
|
qsort(words->sl_str, words->sl_cur, sizeof(char *), comparstr);
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
|
2006-09-18 23:48:44 +04:00
|
|
|
list_vertical(words);
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
return CC_REDISPLAY;
|
2006-09-18 23:48:44 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Complete a mail command.
|
|
|
|
*/
|
|
|
|
static unsigned char
|
2006-10-22 01:37:20 +04:00
|
|
|
complete_command(EditLine *el, char *word, int dolist)
|
2006-09-18 23:48:44 +04:00
|
|
|
{
|
|
|
|
const struct cmd *c;
|
|
|
|
StringList *words;
|
|
|
|
size_t wordlen;
|
|
|
|
unsigned char rv;
|
|
|
|
|
2006-10-22 01:37:20 +04:00
|
|
|
words = mail_sl_init();
|
2006-09-18 23:48:44 +04:00
|
|
|
wordlen = strlen(word);
|
|
|
|
|
|
|
|
for (c = cmdtab; c->c_name != NULL; c++) {
|
|
|
|
if (wordlen > strlen(c->c_name))
|
|
|
|
continue;
|
|
|
|
if (strncmp(word, c->c_name, wordlen) == 0)
|
2006-10-22 01:37:20 +04:00
|
|
|
mail_sl_add(words, __UNCONST(c->c_name));
|
2006-09-18 23:48:44 +04:00
|
|
|
}
|
|
|
|
|
2006-10-22 01:37:20 +04:00
|
|
|
rv = complete_ambiguous(el, word, dolist, words);
|
2006-09-18 23:48:44 +04:00
|
|
|
if (rv == CC_REFRESH) {
|
|
|
|
if (el_insertstr(el, " ") == -1)
|
|
|
|
rv = CC_ERROR;
|
|
|
|
}
|
|
|
|
sl_free(words, 0);
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
return rv;
|
2006-09-18 23:48:44 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Complete a local filename.
|
|
|
|
*/
|
|
|
|
static unsigned char
|
2006-10-22 01:37:20 +04:00
|
|
|
complete_filename(EditLine *el, char *word, int dolist)
|
2006-09-18 23:48:44 +04:00
|
|
|
{
|
|
|
|
StringList *words;
|
|
|
|
char dir[MAXPATHLEN];
|
|
|
|
char *fname;
|
|
|
|
DIR *dd;
|
|
|
|
struct dirent *dp;
|
|
|
|
unsigned char rv;
|
|
|
|
size_t len;
|
|
|
|
|
|
|
|
if ((fname = strrchr(word, '/')) == NULL) {
|
|
|
|
dir[0] = '.';
|
|
|
|
dir[1] = '\0';
|
|
|
|
fname = word;
|
|
|
|
} else {
|
|
|
|
if (fname == word) {
|
|
|
|
dir[0] = '/';
|
|
|
|
dir[1] = '\0';
|
2006-10-22 01:37:20 +04:00
|
|
|
} else {
|
|
|
|
len = fname - word + 1;
|
|
|
|
(void)estrlcpy(dir, word, sizeof(dir));
|
|
|
|
dir[len] = '\0';
|
|
|
|
}
|
2006-09-18 23:48:44 +04:00
|
|
|
fname++;
|
|
|
|
}
|
|
|
|
if (dir[0] == '~') {
|
|
|
|
char *p;
|
|
|
|
|
|
|
|
if ((p = globulize(dir)) == NULL)
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
return CC_ERROR;
|
2006-10-22 01:37:20 +04:00
|
|
|
(void)estrlcpy(dir, p, sizeof(dir));
|
2006-09-18 23:48:44 +04:00
|
|
|
free(p);
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((dd = opendir(dir)) == NULL)
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
return CC_ERROR;
|
2006-09-18 23:48:44 +04:00
|
|
|
|
2006-10-22 01:37:20 +04:00
|
|
|
words = mail_sl_init();
|
2006-09-18 23:48:44 +04:00
|
|
|
len = strlen(fname);
|
|
|
|
|
|
|
|
for (dp = readdir(dd); dp != NULL; dp = readdir(dd)) {
|
|
|
|
if (!strcmp(dp->d_name, ".") || !strcmp(dp->d_name, ".."))
|
|
|
|
continue;
|
|
|
|
|
|
|
|
#if defined(DIRENT_MISSING_D_NAMLEN)
|
|
|
|
if (len > strlen(dp->d_name))
|
|
|
|
continue;
|
|
|
|
#else
|
|
|
|
if (len > dp->d_namlen)
|
|
|
|
continue;
|
|
|
|
#endif
|
|
|
|
if (strncmp(fname, dp->d_name, len) == 0) {
|
|
|
|
char *tcp;
|
|
|
|
|
2006-10-22 01:37:20 +04:00
|
|
|
tcp = estrdup(dp->d_name);
|
|
|
|
mail_sl_add(words, tcp);
|
2006-09-18 23:48:44 +04:00
|
|
|
}
|
|
|
|
}
|
2006-10-22 01:37:20 +04:00
|
|
|
(void)closedir(dd);
|
2006-09-18 23:48:44 +04:00
|
|
|
|
2006-10-22 01:37:20 +04:00
|
|
|
rv = complete_ambiguous(el, fname, dolist, words);
|
2006-09-18 23:48:44 +04:00
|
|
|
if (rv == CC_REFRESH) {
|
|
|
|
struct stat sb;
|
|
|
|
char path[MAXPATHLEN];
|
|
|
|
|
2006-10-22 01:37:20 +04:00
|
|
|
(void)estrlcpy(path, dir, sizeof(path));
|
|
|
|
(void)estrlcat(path, "/", sizeof(path));
|
|
|
|
(void)estrlcat(path, words->sl_str[0], sizeof(path));
|
2006-09-18 23:48:44 +04:00
|
|
|
|
|
|
|
if (stat(path, &sb) >= 0) {
|
|
|
|
char suffix[2] = " ";
|
|
|
|
|
|
|
|
if (S_ISDIR(sb.st_mode))
|
|
|
|
suffix[0] = '/';
|
|
|
|
if (el_insertstr(el, suffix) == -1)
|
|
|
|
rv = CC_ERROR;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
sl_free(words, 1);
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
return rv;
|
2006-09-18 23:48:44 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
find_execs(char *word, char *path, StringList *list)
|
|
|
|
{
|
|
|
|
char *sep;
|
|
|
|
char *dir=path;
|
|
|
|
DIR *dd;
|
|
|
|
struct dirent *dp;
|
2006-10-22 01:37:20 +04:00
|
|
|
size_t len = strlen(word);
|
2006-09-18 23:48:44 +04:00
|
|
|
uid_t uid = getuid();
|
|
|
|
gid_t gid = getgid();
|
|
|
|
|
2006-10-22 01:37:20 +04:00
|
|
|
for (sep = dir; sep; dir = sep + 1) {
|
2006-09-18 23:48:44 +04:00
|
|
|
if ((sep=strchr(dir, ':')) != NULL) {
|
|
|
|
*sep=0;
|
|
|
|
}
|
2007-10-23 18:58:43 +04:00
|
|
|
|
2006-09-18 23:48:44 +04:00
|
|
|
if ((dd = opendir(dir)) == NULL) {
|
|
|
|
perror("dir");
|
|
|
|
return -1;
|
|
|
|
}
|
2007-10-23 18:58:43 +04:00
|
|
|
|
2006-09-18 23:48:44 +04:00
|
|
|
for (dp = readdir(dd); dp != NULL; dp = readdir(dd)) {
|
|
|
|
|
|
|
|
if (!strcmp(dp->d_name, ".") || !strcmp(dp->d_name, ".."))
|
|
|
|
continue;
|
2007-10-23 18:58:43 +04:00
|
|
|
|
2006-09-18 23:48:44 +04:00
|
|
|
#if defined(DIRENT_MISSING_D_NAMLEN)
|
|
|
|
if (len > strlen(dp->d_name))
|
|
|
|
continue;
|
|
|
|
#else
|
|
|
|
if (len > dp->d_namlen)
|
|
|
|
continue;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if (strncmp(word, dp->d_name, len) == 0) {
|
|
|
|
struct stat sb;
|
|
|
|
char pathname[ MAXPATHLEN ];
|
|
|
|
unsigned mask;
|
|
|
|
|
2006-10-22 01:37:20 +04:00
|
|
|
(void)snprintf(pathname, sizeof(pathname),
|
|
|
|
"%s/%s", dir, dp->d_name);
|
2006-09-18 23:48:44 +04:00
|
|
|
if (stat(pathname, &sb) != 0) {
|
|
|
|
perror(pathname);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
mask = 0001;
|
|
|
|
if (sb.st_uid == uid) mask |= 0100;
|
|
|
|
if (sb.st_gid == gid) mask |= 0010;
|
|
|
|
|
|
|
|
if ((sb.st_mode & mask) != 0) {
|
|
|
|
char *tcp;
|
2006-10-22 01:37:20 +04:00
|
|
|
tcp = estrdup(dp->d_name);
|
|
|
|
mail_sl_add(list, tcp);
|
2006-09-18 23:48:44 +04:00
|
|
|
}
|
|
|
|
}
|
2007-10-23 18:58:43 +04:00
|
|
|
|
2006-09-18 23:48:44 +04:00
|
|
|
}
|
|
|
|
|
2006-10-22 01:37:20 +04:00
|
|
|
(void)closedir(dd);
|
2006-09-18 23:48:44 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Complete a local executable
|
|
|
|
*/
|
|
|
|
static unsigned char
|
2006-10-22 01:37:20 +04:00
|
|
|
complete_executable(EditLine *el, char *word, int dolist)
|
2006-09-18 23:48:44 +04:00
|
|
|
{
|
|
|
|
StringList *words;
|
|
|
|
char dir[ MAXPATHLEN ];
|
|
|
|
char *fname;
|
|
|
|
unsigned char rv;
|
2006-10-22 01:37:20 +04:00
|
|
|
size_t len;
|
2006-09-18 23:48:44 +04:00
|
|
|
int error;
|
|
|
|
|
|
|
|
if ((fname = strrchr(word, '/')) == NULL) {
|
|
|
|
dir[0] = '\0'; /* walk the path */
|
|
|
|
fname = word;
|
|
|
|
} else {
|
|
|
|
if (fname == word) {
|
|
|
|
dir[0] = '/';
|
|
|
|
dir[1] = '\0';
|
|
|
|
} else {
|
2006-10-22 01:37:20 +04:00
|
|
|
len = fname - word;
|
|
|
|
(void)strncpy(dir, word, len);
|
2006-09-18 23:48:44 +04:00
|
|
|
dir[fname - word] = '\0';
|
|
|
|
}
|
|
|
|
fname++;
|
|
|
|
}
|
|
|
|
|
|
|
|
words = sl_init();
|
|
|
|
|
|
|
|
if (*dir == '\0') { /* walk path */
|
|
|
|
char *env;
|
|
|
|
char *path;
|
|
|
|
env = getenv("PATH");
|
|
|
|
len = strlen(env);
|
|
|
|
path = salloc(len + 1);
|
2006-10-22 01:37:20 +04:00
|
|
|
(void)strcpy(path, env);
|
2006-09-18 23:48:44 +04:00
|
|
|
error = find_execs(word, path, words);
|
|
|
|
}
|
|
|
|
else { /* check specified dir only */
|
|
|
|
error = find_execs(word, dir, words);
|
|
|
|
}
|
|
|
|
if (error != 0)
|
|
|
|
return CC_ERROR;
|
|
|
|
|
2006-10-22 01:37:20 +04:00
|
|
|
rv = complete_ambiguous(el, fname, dolist, words);
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
if (rv == CC_REFRESH) {
|
2006-09-18 23:48:44 +04:00
|
|
|
if (el_insertstr(el, " ") == -1)
|
|
|
|
rv = CC_ERROR;
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
}
|
2006-09-18 23:48:44 +04:00
|
|
|
sl_free(words, 1);
|
|
|
|
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
return rv;
|
2006-09-18 23:48:44 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
static unsigned char
|
|
|
|
complete_set(EditLine *el, char *word, int dolist)
|
2006-09-18 23:48:44 +04:00
|
|
|
{
|
|
|
|
struct var *vp;
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
const char **ap;
|
|
|
|
const char **p;
|
2006-09-18 23:48:44 +04:00
|
|
|
int h;
|
|
|
|
int s;
|
2006-10-22 01:37:20 +04:00
|
|
|
size_t len = strlen(word);
|
2006-09-18 23:48:44 +04:00
|
|
|
StringList *words;
|
|
|
|
unsigned char rv;
|
|
|
|
|
|
|
|
words = sl_init();
|
|
|
|
|
|
|
|
/* allocate space for variables table */
|
2006-10-31 23:07:32 +03:00
|
|
|
s = 1;
|
|
|
|
for (h = 0; h < HSHSIZE; h++)
|
2006-09-18 23:48:44 +04:00
|
|
|
for (vp = variables[h]; vp != NULL; vp = vp->v_link)
|
|
|
|
s++;
|
2007-10-30 02:20:37 +03:00
|
|
|
ap = salloc(s * sizeof(*ap));
|
2006-09-18 23:48:44 +04:00
|
|
|
|
2006-10-31 23:07:32 +03:00
|
|
|
/* save the pointers */
|
2006-09-18 23:48:44 +04:00
|
|
|
for (h = 0, p = ap; h < HSHSIZE; h++)
|
|
|
|
for (vp = variables[h]; vp != NULL; vp = vp->v_link)
|
|
|
|
*p++ = vp->v_name;
|
|
|
|
*p = NULL;
|
|
|
|
sort(ap);
|
2006-10-31 23:07:32 +03:00
|
|
|
for (p = ap; *p != NULL; p++)
|
|
|
|
if (len == 0 || strncmp(*p, word, len) == 0)
|
|
|
|
mail_sl_add(words, estrdup(*p));
|
2006-09-18 23:48:44 +04:00
|
|
|
|
2006-10-22 01:37:20 +04:00
|
|
|
rv = complete_ambiguous(el, word, dolist, words);
|
2006-09-18 23:48:44 +04:00
|
|
|
|
|
|
|
sl_free(words, 1);
|
|
|
|
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
return rv;
|
2006-09-18 23:48:44 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static unsigned char
|
2006-10-22 01:37:20 +04:00
|
|
|
complete_alias(EditLine *el, char *word, int dolist)
|
2006-09-18 23:48:44 +04:00
|
|
|
{
|
|
|
|
struct grouphead *gh;
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
const char **ap;
|
|
|
|
const char **p;
|
2006-09-18 23:48:44 +04:00
|
|
|
int h;
|
|
|
|
int s;
|
2006-10-22 01:37:20 +04:00
|
|
|
size_t len = strlen(word);
|
2006-09-18 23:48:44 +04:00
|
|
|
StringList *words;
|
|
|
|
unsigned char rv;
|
|
|
|
|
|
|
|
words = sl_init();
|
|
|
|
|
|
|
|
/* allocate space for alias table */
|
2006-10-31 23:07:32 +03:00
|
|
|
s = 1;
|
|
|
|
for (h = 0; h < HSHSIZE; h++)
|
2006-09-18 23:48:44 +04:00
|
|
|
for (gh = groups[h]; gh != NULL; gh = gh->g_link)
|
|
|
|
s++;
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
ap = salloc(s * sizeof(*ap));
|
2007-10-23 18:58:43 +04:00
|
|
|
|
2006-09-18 23:48:44 +04:00
|
|
|
/* save pointers */
|
2006-10-31 23:07:32 +03:00
|
|
|
p = ap;
|
|
|
|
for (h = 0; h < HSHSIZE; h++)
|
2006-09-18 23:48:44 +04:00
|
|
|
for (gh = groups[h]; gh != NULL; gh = gh->g_link)
|
|
|
|
*p++ = gh->g_name;
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
|
2006-09-18 23:48:44 +04:00
|
|
|
*p = NULL;
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
|
2006-09-18 23:48:44 +04:00
|
|
|
sort(ap);
|
2006-10-31 23:07:32 +03:00
|
|
|
for (p = ap; *p != NULL; p++)
|
|
|
|
if (len == 0 || strncmp(*p, word, len) == 0)
|
|
|
|
mail_sl_add(words, estrdup(*p));
|
2007-10-23 18:58:43 +04:00
|
|
|
|
2006-10-22 01:37:20 +04:00
|
|
|
rv = complete_ambiguous(el, word, dolist, words);
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
if (rv == CC_REFRESH) {
|
2006-09-18 23:48:44 +04:00
|
|
|
if (el_insertstr(el, " ") == -1)
|
|
|
|
rv = CC_ERROR;
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
}
|
2006-10-31 23:07:32 +03:00
|
|
|
sl_free(words, 1);
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
return rv;
|
2006-10-31 23:07:32 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
static unsigned char
|
|
|
|
complete_smopts(EditLine *el, char *word, int dolist)
|
2006-10-31 23:07:32 +03:00
|
|
|
{
|
|
|
|
struct grouphead *gh;
|
|
|
|
struct smopts_s *sp;
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
const char **ap;
|
|
|
|
const char **p;
|
2006-10-31 23:07:32 +03:00
|
|
|
int h;
|
|
|
|
int s1;
|
|
|
|
int s2;
|
|
|
|
size_t len;
|
|
|
|
StringList *words;
|
|
|
|
unsigned char rv;
|
|
|
|
|
|
|
|
len = strlen(word);
|
|
|
|
words = sl_init();
|
|
|
|
|
|
|
|
/* count the entries in the smoptstbl and groups (alias) tables */
|
|
|
|
s1 = 1;
|
|
|
|
s2 = 1;
|
|
|
|
for (h = 0; h < HSHSIZE; h++) {
|
|
|
|
for (sp = smoptstbl[h]; sp != NULL; sp = sp->s_link)
|
|
|
|
s1++;
|
|
|
|
for (gh = groups[h]; gh != NULL; gh = gh->g_link)
|
|
|
|
s2++;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* allocate sufficient space for the pointers */
|
2007-10-30 02:20:37 +03:00
|
|
|
ap = salloc(MAX(s1, s2) * sizeof(*ap));
|
2006-10-31 23:07:32 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* First do the smoptstbl pointers. (case _insensitive_)
|
|
|
|
*/
|
|
|
|
p = ap;
|
|
|
|
for (h = 0; h < HSHSIZE; h++)
|
|
|
|
for (sp = smoptstbl[h]; sp != NULL; sp = sp->s_link)
|
|
|
|
*p++ = sp->s_name;
|
|
|
|
*p = NULL;
|
|
|
|
sort(ap);
|
|
|
|
for (p = ap; *p != NULL; p++)
|
|
|
|
if (len == 0 || strncasecmp(*p, word, len) == 0)
|
|
|
|
mail_sl_add(words, estrdup(*p));
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Now do the groups (alias) pointers. (case sensitive)
|
|
|
|
*/
|
|
|
|
p = ap;
|
|
|
|
for (h = 0; h < HSHSIZE; h++)
|
|
|
|
for (gh = groups[h]; gh != NULL; gh = gh->g_link)
|
|
|
|
*p++ = gh->g_name;
|
|
|
|
*p = NULL;
|
|
|
|
sort(ap);
|
|
|
|
for (p = ap; *p != NULL; p++)
|
|
|
|
if (len == 0 || strncmp(*p, word, len) == 0)
|
|
|
|
mail_sl_add(words, estrdup(*p));
|
|
|
|
|
|
|
|
rv = complete_ambiguous(el, word, dolist, words);
|
2006-09-18 23:48:44 +04:00
|
|
|
|
|
|
|
sl_free(words, 1);
|
|
|
|
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
return rv;
|
2006-09-18 23:48:44 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
#ifdef THREAD_SUPPORT
|
|
|
|
static unsigned char
|
|
|
|
complete_thread_key(EditLine *el, char *word, int dolist)
|
2006-09-18 23:48:44 +04:00
|
|
|
{
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
const char **ap;
|
|
|
|
const char **p;
|
|
|
|
const char *name;
|
|
|
|
size_t len;
|
|
|
|
StringList *words;
|
|
|
|
unsigned char rv;
|
|
|
|
int cnt;
|
|
|
|
const void *cookie;
|
2006-09-18 23:48:44 +04:00
|
|
|
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
len = strlen(word);
|
|
|
|
words = sl_init();
|
2006-09-18 23:48:44 +04:00
|
|
|
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
/* count the entries in the table */
|
|
|
|
/* XXX - have a function return this rather than counting? */
|
|
|
|
cnt = 1; /* count the NULL terminator */
|
|
|
|
cookie = NULL;
|
|
|
|
while (thread_next_key_name(&cookie) != NULL)
|
|
|
|
cnt++;
|
2006-09-18 23:48:44 +04:00
|
|
|
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
/* allocate sufficient space for the pointers */
|
2007-10-30 02:20:37 +03:00
|
|
|
ap = salloc(cnt * sizeof(*ap));
|
2006-09-18 23:48:44 +04:00
|
|
|
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
/* load the array */
|
|
|
|
p = ap;
|
|
|
|
cookie = NULL;
|
|
|
|
while ((name = thread_next_key_name(&cookie)) != NULL)
|
|
|
|
*p++ = name;
|
|
|
|
*p = NULL;
|
|
|
|
sort(ap);
|
|
|
|
for (p = ap; *p != NULL; p++)
|
|
|
|
if (len == 0 || strncmp(*p, word, len) == 0)
|
|
|
|
mail_sl_add(words, estrdup(*p));
|
2006-09-18 23:48:44 +04:00
|
|
|
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
rv = complete_ambiguous(el, word, dolist, words);
|
2006-09-18 23:48:44 +04:00
|
|
|
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
sl_free(words, 1);
|
2006-09-18 23:48:44 +04:00
|
|
|
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
return rv;
|
2006-09-18 23:48:44 +04:00
|
|
|
}
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
#endif /* THREAD_SUPPORT */
|
2006-09-18 23:48:44 +04:00
|
|
|
|
2006-10-22 01:37:20 +04:00
|
|
|
/* from /usr/src/usr.bin/ftp/main.c(1.101) - end */
|
2006-09-18 23:48:44 +04:00
|
|
|
/************************************************************************/
|
|
|
|
|
2006-10-22 01:37:20 +04:00
|
|
|
/* Some people like to bind file completion to CTRL-D. In emacs mode,
|
|
|
|
* CTRL-D is also used to delete the current character, we have to
|
|
|
|
* special case this situation.
|
|
|
|
*/
|
|
|
|
#define EMACS_CTRL_D_BINDING_HACK
|
|
|
|
|
|
|
|
#ifdef EMACS_CTRL_D_BINDING_HACK
|
|
|
|
static int
|
|
|
|
is_emacs_mode(EditLine *el)
|
|
|
|
{
|
|
|
|
char *mode;
|
From Anon Ymous:
- Remove all longjmp(3) calls from signal handlers. Instead, we post
to an internal signal queue and check that periodically. All signal
related code is now in sig.c, except for the SIGCHLD handler which
remains in popen.c as it is intimately tied to routines there.
- Handle SIGPIPE in type1() regardless of mime support, or else the
handler in execute() will prevent our error code from being returned
resulting in 'sawcom' not being set on the first command as it should.
This only affected the initial behavior of the "next" command without
mime support.
- Add the 'T' flag to many commands in cmdtab.c that should not look
like the first command. E.g., start mail on a mailbox with multiple
messages, run "set foo", then "next", and watch the second message get
displayed rather than the first as is the case without the first "set"
command.
- Add file descriptor and file handle leak detection. Enabled by
DEBUG_FILE_LEAK. This will likely disappear in the future.
- Fix a long standing (since import in 1993) longjmp() bug in
edstop(): the jmpbuf was invalid when quit() is called at the end of
main.
- Fix a long standing bug (since import in 1993) in snarf() where it
didn't strip whitespace correctly if the line consisted only of
whitespace.
- Lint cleanup.
- New Feature: "Header" command. This allows miscellaneous header
fields to be added to the header, e.g., "X-Organization:" or
"Reply-To:" fields.
- New Feature: "page-also" variable. This allows the specification of
additional commands to page. It is more flexible than "crt".
- Document the "pager-off" variable: if set, it disables paging
entirely.
2009-04-10 17:08:24 +04:00
|
|
|
|
2006-10-22 01:37:20 +04:00
|
|
|
if (el_get(el, EL_EDITOR, &mode) == -1)
|
|
|
|
return 0;
|
|
|
|
return equal(mode, "emacs");
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
emacs_ctrl_d(EditLine *el, const LineInfo *lf, int ch)
|
2006-10-22 01:37:20 +04:00
|
|
|
{
|
|
|
|
static char delunder[3] = { CTRL('f'), CTRL('h'), '\0' };
|
From Anon Ymous:
- Remove all longjmp(3) calls from signal handlers. Instead, we post
to an internal signal queue and check that periodically. All signal
related code is now in sig.c, except for the SIGCHLD handler which
remains in popen.c as it is intimately tied to routines there.
- Handle SIGPIPE in type1() regardless of mime support, or else the
handler in execute() will prevent our error code from being returned
resulting in 'sawcom' not being set on the first command as it should.
This only affected the initial behavior of the "next" command without
mime support.
- Add the 'T' flag to many commands in cmdtab.c that should not look
like the first command. E.g., start mail on a mailbox with multiple
messages, run "set foo", then "next", and watch the second message get
displayed rather than the first as is the case without the first "set"
command.
- Add file descriptor and file handle leak detection. Enabled by
DEBUG_FILE_LEAK. This will likely disappear in the future.
- Fix a long standing (since import in 1993) longjmp() bug in
edstop(): the jmpbuf was invalid when quit() is called at the end of
main.
- Fix a long standing bug (since import in 1993) in snarf() where it
didn't strip whitespace correctly if the line consisted only of
whitespace.
- Lint cleanup.
- New Feature: "Header" command. This allows miscellaneous header
fields to be added to the header, e.g., "X-Organization:" or
"Reply-To:" fields.
- New Feature: "page-also" variable. This allows the specification of
additional commands to page. It is more flexible than "crt".
- Document the "pager-off" variable: if set, it disables paging
entirely.
2009-04-10 17:08:24 +04:00
|
|
|
|
2006-10-22 01:37:20 +04:00
|
|
|
if (ch == CTRL('d') && is_emacs_mode(el)) { /* CTRL-D is special */
|
2007-10-23 18:58:43 +04:00
|
|
|
if (lf->buffer == lf->lastchar)
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
return CC_EOF;
|
|
|
|
if (lf->cursor != lf->lastchar) { /* delete without using ^D */
|
2006-10-22 01:37:20 +04:00
|
|
|
el_push(el, delunder); /* ^F^H */
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
return CC_NORM;
|
2006-10-22 01:37:20 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
#endif /* EMACS_CTRL_D_BINDING_HACK */
|
2006-09-18 23:48:44 +04:00
|
|
|
|
|
|
|
/*
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
* Check if this is the second request made for this line indicating
|
|
|
|
* the need to list all the completion possibilities.
|
2006-09-18 23:48:44 +04:00
|
|
|
*/
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
static int
|
|
|
|
get_dolist(const LineInfo *lf)
|
2006-09-18 23:48:44 +04:00
|
|
|
{
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
static char last_line[LINESIZE];
|
|
|
|
static char *last_cursor_pos;
|
|
|
|
char *cursor_pos;
|
|
|
|
int dolist;
|
|
|
|
size_t len;
|
|
|
|
|
|
|
|
len = lf->lastchar - lf->buffer;
|
|
|
|
if (len >= sizeof(last_line) - 1)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
cursor_pos = last_line + (lf->cursor - lf->buffer);
|
|
|
|
dolist =
|
|
|
|
cursor_pos == last_cursor_pos &&
|
|
|
|
strncmp(last_line, lf->buffer, len) == 0;
|
|
|
|
|
|
|
|
(void)strlcpy(last_line, lf->buffer, len + 1);
|
|
|
|
last_cursor_pos = cursor_pos;
|
|
|
|
|
|
|
|
return dolist;
|
|
|
|
}
|
2006-09-18 23:48:44 +04:00
|
|
|
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
/*
|
|
|
|
* Take the full line (lf) including the command and split it into a
|
|
|
|
* sub-line (returned) and a completion context (cmplarray).
|
|
|
|
*/
|
|
|
|
static LineInfo *
|
|
|
|
split_line(const char **cmplarray, const LineInfo *lf)
|
|
|
|
{
|
|
|
|
static LineInfo li;
|
2006-09-18 23:48:44 +04:00
|
|
|
const struct cmd *c;
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
char *cmdname;
|
|
|
|
char line[LINESIZE];
|
|
|
|
char *cp;
|
2006-09-18 23:48:44 +04:00
|
|
|
size_t len;
|
|
|
|
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
len = lf->cursor - lf->buffer;
|
|
|
|
if (len + 1 > sizeof(line))
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
(void)strlcpy(line, lf->buffer, len + 1);
|
|
|
|
|
|
|
|
li.cursor = line + len;
|
|
|
|
li.lastchar = line + len;
|
2007-10-23 18:58:43 +04:00
|
|
|
|
|
|
|
cp = skip_WSP(line);
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
cmdname = get_cmdname(cp);
|
|
|
|
cp += strlen(cmdname);
|
|
|
|
|
|
|
|
if (cp == li.cursor) {
|
|
|
|
*cmplarray = "c";
|
|
|
|
li.buffer = cmdname;
|
|
|
|
return &li;
|
|
|
|
}
|
|
|
|
|
|
|
|
c = lex(cmdname);
|
|
|
|
if (c == NULL)
|
|
|
|
return NULL;
|
2007-10-23 18:58:43 +04:00
|
|
|
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
*cmplarray = c->c_complete;
|
|
|
|
if (c->c_pipe) {
|
|
|
|
char *cp2;
|
|
|
|
if ((cp2 = shellpr(cp)) != NULL) {
|
|
|
|
cp = cp2;
|
2007-10-23 18:58:43 +04:00
|
|
|
# define XX(a) ((a) + ((a)[1] == '>' ? 2 : 1))
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
while ((cp2 = shellpr(XX(cp))) != NULL)
|
|
|
|
cp = cp2;
|
2007-10-23 18:58:43 +04:00
|
|
|
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
if (*cp == '|') {
|
|
|
|
*cmplarray = "xF";
|
2007-10-23 18:58:43 +04:00
|
|
|
cp = skip_WSP(cp + 1);
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
assert(*cp == '>');
|
2007-10-23 18:58:43 +04:00
|
|
|
cp = skip_WSP(XX(cp));
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
*cmplarray = "f";
|
|
|
|
}
|
|
|
|
# undef XX
|
|
|
|
}
|
|
|
|
}
|
|
|
|
li.buffer = cp;
|
|
|
|
return &li;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Split a sub-line and a completion context into a word and a
|
|
|
|
* completion type. Use the editline tokenizer to handle the quoting
|
|
|
|
* and splitting.
|
|
|
|
*/
|
|
|
|
static char *
|
|
|
|
split_word(int *cmpltype, const char *cmplarray, LineInfo *li)
|
|
|
|
{
|
|
|
|
static Tokenizer *t = NULL;
|
|
|
|
const char **argv;
|
|
|
|
char *word;
|
|
|
|
int argc;
|
|
|
|
int cursorc;
|
|
|
|
int cursoro;
|
|
|
|
int arraylen;
|
|
|
|
|
|
|
|
if (t != NULL)
|
|
|
|
tok_reset(t);
|
|
|
|
else {
|
|
|
|
if ((t = tok_init(NULL)) == NULL)
|
|
|
|
err(EXIT_FAILURE, "tok_init");
|
|
|
|
}
|
|
|
|
if (tok_line(t, li, &argc, &argv, &cursorc, &cursoro) == -1)
|
|
|
|
err(EXIT_FAILURE, "tok_line");
|
2007-10-23 18:58:43 +04:00
|
|
|
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
if (cursorc >= argc)
|
|
|
|
word = __UNCONST("");
|
|
|
|
else {
|
|
|
|
word = salloc((size_t)cursoro + 1);
|
|
|
|
(void)strlcpy(word, argv[cursorc], (size_t)cursoro + 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* check for 'continuation' completes (which are uppercase) */
|
From Anon Ymous:
- Remove all longjmp(3) calls from signal handlers. Instead, we post
to an internal signal queue and check that periodically. All signal
related code is now in sig.c, except for the SIGCHLD handler which
remains in popen.c as it is intimately tied to routines there.
- Handle SIGPIPE in type1() regardless of mime support, or else the
handler in execute() will prevent our error code from being returned
resulting in 'sawcom' not being set on the first command as it should.
This only affected the initial behavior of the "next" command without
mime support.
- Add the 'T' flag to many commands in cmdtab.c that should not look
like the first command. E.g., start mail on a mailbox with multiple
messages, run "set foo", then "next", and watch the second message get
displayed rather than the first as is the case without the first "set"
command.
- Add file descriptor and file handle leak detection. Enabled by
DEBUG_FILE_LEAK. This will likely disappear in the future.
- Fix a long standing (since import in 1993) longjmp() bug in
edstop(): the jmpbuf was invalid when quit() is called at the end of
main.
- Fix a long standing bug (since import in 1993) in snarf() where it
didn't strip whitespace correctly if the line consisted only of
whitespace.
- Lint cleanup.
- New Feature: "Header" command. This allows miscellaneous header
fields to be added to the header, e.g., "X-Organization:" or
"Reply-To:" fields.
- New Feature: "page-also" variable. This allows the specification of
additional commands to page. It is more flexible than "crt".
- Document the "pager-off" variable: if set, it disables paging
entirely.
2009-04-10 17:08:24 +04:00
|
|
|
arraylen = (int)strlen(cmplarray);
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
if (cursorc >= arraylen &&
|
|
|
|
arraylen > 0 &&
|
|
|
|
isupper((unsigned char)cmplarray[arraylen - 1]))
|
|
|
|
cursorc = arraylen - 1;
|
2007-10-23 18:58:43 +04:00
|
|
|
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
if (cursorc >= arraylen)
|
|
|
|
return NULL;
|
2007-10-23 18:58:43 +04:00
|
|
|
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
*cmpltype = cmplarray[cursorc];
|
|
|
|
return word;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* A generic complete routine for the mail command line.
|
|
|
|
*/
|
|
|
|
static unsigned char
|
|
|
|
mail_complete(EditLine *el, int ch)
|
|
|
|
{
|
|
|
|
LineInfo *li;
|
|
|
|
const LineInfo *lf;
|
|
|
|
const char *cmplarray;
|
|
|
|
int dolist;
|
|
|
|
int cmpltype;
|
|
|
|
char *word;
|
|
|
|
|
2006-09-18 23:48:44 +04:00
|
|
|
lf = el_line(el);
|
2006-10-22 01:37:20 +04:00
|
|
|
|
|
|
|
#ifdef EMACS_CTRL_D_BINDING_HACK
|
|
|
|
{
|
|
|
|
int cc_ret;
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
if ((cc_ret = emacs_ctrl_d(el, lf, ch)) != -1)
|
2006-10-22 01:37:20 +04:00
|
|
|
return cc_ret;
|
2006-09-18 23:48:44 +04:00
|
|
|
}
|
2006-10-22 01:37:20 +04:00
|
|
|
#endif /* EMACS_CTRL_D_BINDING_HACK */
|
|
|
|
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
if ((dolist = get_dolist(lf)) == -1)
|
|
|
|
return CC_ERROR;
|
2006-09-18 23:48:44 +04:00
|
|
|
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
if ((li = split_line(&cmplarray, lf)) == NULL)
|
|
|
|
return CC_ERROR;
|
2006-09-18 23:48:44 +04:00
|
|
|
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
if ((word = split_word(&cmpltype, cmplarray, li)) == NULL)
|
|
|
|
return CC_ERROR;
|
2006-09-18 23:48:44 +04:00
|
|
|
|
|
|
|
switch (cmpltype) {
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
case 'a': /* alias complete */
|
|
|
|
case 'A':
|
|
|
|
return complete_alias(el, word, dolist);
|
2007-10-23 18:58:43 +04:00
|
|
|
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
case 'c': /* command complete */
|
|
|
|
case 'C':
|
|
|
|
return complete_command(el, word, dolist);
|
2007-10-23 18:58:43 +04:00
|
|
|
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
case 'f': /* filename complete */
|
|
|
|
case 'F':
|
|
|
|
return complete_filename(el, word, dolist);
|
2007-10-23 18:58:43 +04:00
|
|
|
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
case 'm':
|
|
|
|
case 'M':
|
|
|
|
return complete_smopts(el, word, dolist);
|
2007-10-23 18:58:43 +04:00
|
|
|
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
case 'n': /* no complete */
|
|
|
|
case 'N': /* no complete */
|
|
|
|
return CC_ERROR;
|
2007-10-23 18:58:43 +04:00
|
|
|
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
case 's':
|
|
|
|
case 'S':
|
|
|
|
return complete_set(el, word, dolist);
|
|
|
|
#ifdef THREAD_SUPPORT
|
|
|
|
case 't':
|
|
|
|
case 'T':
|
|
|
|
return complete_thread_key(el, word, dolist);
|
2006-10-31 23:07:32 +03:00
|
|
|
#endif
|
2006-09-18 23:48:44 +04:00
|
|
|
case 'x': /* executable complete */
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
case 'X':
|
|
|
|
return complete_executable(el, word, dolist);
|
2007-10-23 18:58:43 +04:00
|
|
|
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
default:
|
|
|
|
warnx("unknown complete type `%c'", cmpltype);
|
|
|
|
#if 0
|
|
|
|
assert(/*CONSTCOND*/0);
|
|
|
|
#endif
|
|
|
|
return CC_ERROR;
|
2006-09-18 23:48:44 +04:00
|
|
|
}
|
|
|
|
/* NOTREACHED */
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-10-22 01:37:20 +04:00
|
|
|
/*
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
* A generic file completion routine.
|
2006-10-22 01:37:20 +04:00
|
|
|
*/
|
|
|
|
static unsigned char
|
|
|
|
file_complete(EditLine *el, int ch)
|
2006-09-18 23:48:44 +04:00
|
|
|
{
|
2006-10-22 01:37:20 +04:00
|
|
|
static char word[LINESIZE];
|
|
|
|
const LineInfo *lf;
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
size_t word_len;
|
|
|
|
int dolist;
|
2006-09-18 23:48:44 +04:00
|
|
|
|
2006-10-22 01:37:20 +04:00
|
|
|
lf = el_line(el);
|
2006-09-18 23:48:44 +04:00
|
|
|
|
2006-10-22 01:37:20 +04:00
|
|
|
#ifdef EMACS_CTRL_D_BINDING_HACK
|
|
|
|
{
|
|
|
|
int cc_ret;
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
if ((cc_ret = emacs_ctrl_d(el, lf, ch)) != -1)
|
2006-10-22 01:37:20 +04:00
|
|
|
return cc_ret;
|
|
|
|
}
|
|
|
|
#endif /* EMACS_CTRL_D_BINDING_HACK */
|
2006-09-18 23:48:44 +04:00
|
|
|
|
2006-10-22 01:37:20 +04:00
|
|
|
word_len = lf->cursor - lf->buffer;
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
if (word_len + 1 > sizeof(word))
|
|
|
|
return CC_ERROR;
|
|
|
|
|
2006-10-22 01:37:20 +04:00
|
|
|
(void)strlcpy(word, lf->buffer, word_len + 1); /* do not use estrlcpy here! */
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
|
|
|
|
if ((dolist = get_dolist(lf)) == -1)
|
|
|
|
return CC_ERROR;
|
|
|
|
|
|
|
|
return complete_filename(el, word, dolist);
|
2006-09-18 23:48:44 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-10-22 01:37:20 +04:00
|
|
|
#ifdef MIME_SUPPORT
|
2006-09-24 18:01:48 +04:00
|
|
|
/*
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
* Complete mime_transfer_encoding type.
|
2006-09-24 18:01:48 +04:00
|
|
|
*/
|
2006-10-22 01:37:20 +04:00
|
|
|
static unsigned char
|
|
|
|
mime_enc_complete(EditLine *el, int ch)
|
|
|
|
{
|
|
|
|
static char word[LINESIZE];
|
|
|
|
StringList *words;
|
|
|
|
unsigned char rv;
|
|
|
|
const LineInfo *lf;
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
size_t word_len;
|
|
|
|
int dolist;
|
2006-10-22 01:37:20 +04:00
|
|
|
|
|
|
|
lf = el_line(el);
|
|
|
|
|
|
|
|
#ifdef EMACS_CTRL_D_BINDING_HACK
|
|
|
|
{
|
|
|
|
int cc_ret;
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
if ((cc_ret = emacs_ctrl_d(el, lf, ch)) != -1)
|
2006-10-22 01:37:20 +04:00
|
|
|
return cc_ret;
|
|
|
|
}
|
|
|
|
#endif /* EMACS_CTRL_D_BINDING_HACK */
|
|
|
|
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
word_len = lf->cursor - lf->buffer;
|
|
|
|
if (word_len >= sizeof(word) - 1)
|
|
|
|
return CC_ERROR;
|
2006-10-22 01:37:20 +04:00
|
|
|
|
|
|
|
words = mail_sl_init();
|
|
|
|
{
|
|
|
|
const char *ename;
|
|
|
|
const void *cookie;
|
|
|
|
cookie = NULL;
|
|
|
|
for (ename = mime_next_encoding_name(&cookie);
|
|
|
|
ename;
|
|
|
|
ename = mime_next_encoding_name(&cookie))
|
|
|
|
if (word_len == 0 ||
|
|
|
|
strncmp(lf->buffer, ename, word_len) == 0) {
|
|
|
|
char *cp;
|
|
|
|
cp = estrdup(ename);
|
|
|
|
mail_sl_add(words, cp);
|
|
|
|
}
|
|
|
|
}
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
(void)strlcpy(word, lf->buffer, word_len + 1);
|
2006-10-22 01:37:20 +04:00
|
|
|
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
if ((dolist = get_dolist(lf)) == -1)
|
|
|
|
return CC_ERROR;
|
|
|
|
|
|
|
|
rv = complete_ambiguous(el, word, dolist, words);
|
2006-10-22 01:37:20 +04:00
|
|
|
|
|
|
|
sl_free(words, 1);
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
return rv;
|
2006-10-22 01:37:20 +04:00
|
|
|
}
|
|
|
|
#endif /* MIME_SUPPORT */
|
|
|
|
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
|
2006-10-22 01:37:20 +04:00
|
|
|
/*************************************************************************
|
|
|
|
* Our public interface to el_gets():
|
|
|
|
*
|
|
|
|
* init_editline()
|
|
|
|
* Initializes of all editline and completion data strutures.
|
|
|
|
*
|
|
|
|
* my_gets()
|
From Anon Ymous:
- Remove all longjmp(3) calls from signal handlers. Instead, we post
to an internal signal queue and check that periodically. All signal
related code is now in sig.c, except for the SIGCHLD handler which
remains in popen.c as it is intimately tied to routines there.
- Handle SIGPIPE in type1() regardless of mime support, or else the
handler in execute() will prevent our error code from being returned
resulting in 'sawcom' not being set on the first command as it should.
This only affected the initial behavior of the "next" command without
mime support.
- Add the 'T' flag to many commands in cmdtab.c that should not look
like the first command. E.g., start mail on a mailbox with multiple
messages, run "set foo", then "next", and watch the second message get
displayed rather than the first as is the case without the first "set"
command.
- Add file descriptor and file handle leak detection. Enabled by
DEBUG_FILE_LEAK. This will likely disappear in the future.
- Fix a long standing (since import in 1993) longjmp() bug in
edstop(): the jmpbuf was invalid when quit() is called at the end of
main.
- Fix a long standing bug (since import in 1993) in snarf() where it
didn't strip whitespace correctly if the line consisted only of
whitespace.
- Lint cleanup.
- New Feature: "Header" command. This allows miscellaneous header
fields to be added to the header, e.g., "X-Organization:" or
"Reply-To:" fields.
- New Feature: "page-also" variable. This allows the specification of
additional commands to page. It is more flexible than "crt".
- Document the "pager-off" variable: if set, it disables paging
entirely.
2009-04-10 17:08:24 +04:00
|
|
|
* Displays prompt, calls el_gets() and deals with history.
|
|
|
|
* Returns the next line of input as a NULL termnated string
|
|
|
|
* without the trailing newline, or NULL if el_gets() sees is an
|
|
|
|
* error or signal.
|
2006-10-22 01:37:20 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
static const char *el_prompt;
|
|
|
|
|
2007-10-23 18:58:43 +04:00
|
|
|
/*ARGSUSED*/
|
2006-10-22 01:37:20 +04:00
|
|
|
static const char *
|
|
|
|
show_prompt(EditLine *e __unused)
|
|
|
|
{
|
|
|
|
return el_prompt;
|
|
|
|
}
|
|
|
|
|
From Anon Ymous:
- Remove all longjmp(3) calls from signal handlers. Instead, we post
to an internal signal queue and check that periodically. All signal
related code is now in sig.c, except for the SIGCHLD handler which
remains in popen.c as it is intimately tied to routines there.
- Handle SIGPIPE in type1() regardless of mime support, or else the
handler in execute() will prevent our error code from being returned
resulting in 'sawcom' not being set on the first command as it should.
This only affected the initial behavior of the "next" command without
mime support.
- Add the 'T' flag to many commands in cmdtab.c that should not look
like the first command. E.g., start mail on a mailbox with multiple
messages, run "set foo", then "next", and watch the second message get
displayed rather than the first as is the case without the first "set"
command.
- Add file descriptor and file handle leak detection. Enabled by
DEBUG_FILE_LEAK. This will likely disappear in the future.
- Fix a long standing (since import in 1993) longjmp() bug in
edstop(): the jmpbuf was invalid when quit() is called at the end of
main.
- Fix a long standing bug (since import in 1993) in snarf() where it
didn't strip whitespace correctly if the line consisted only of
whitespace.
- Lint cleanup.
- New Feature: "Header" command. This allows miscellaneous header
fields to be added to the header, e.g., "X-Organization:" or
"Reply-To:" fields.
- New Feature: "page-also" variable. This allows the specification of
additional commands to page. It is more flexible than "crt".
- Document the "pager-off" variable: if set, it disables paging
entirely.
2009-04-10 17:08:24 +04:00
|
|
|
/*
|
|
|
|
* Write the current INTR character to fp in a friendly form.
|
|
|
|
*/
|
|
|
|
static void
|
|
|
|
echo_INTR(void *p)
|
|
|
|
{
|
|
|
|
struct termios ttybuf;
|
|
|
|
char buf[5];
|
|
|
|
FILE *fp;
|
|
|
|
|
|
|
|
fp = p;
|
|
|
|
if (tcgetattr(fileno(stdin), &ttybuf) == -1)
|
|
|
|
warn("tcgetattr");
|
|
|
|
else {
|
|
|
|
(void)vis(buf, ttybuf.c_cc[VINTR], VIS_SAFE | VIS_NOSLASH, 0);
|
|
|
|
(void)fprintf(fp, "%s", buf);
|
|
|
|
(void)fflush(fp);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static sig_t old_sigint;
|
|
|
|
static void
|
|
|
|
comp_intr(int signo)
|
|
|
|
{
|
|
|
|
|
|
|
|
echo_INTR(stdout);
|
|
|
|
old_sigint(signo);
|
|
|
|
}
|
|
|
|
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
PUBLIC char *
|
2006-10-22 01:37:20 +04:00
|
|
|
my_gets(el_mode_t *em, const char *prompt, char *string)
|
2006-09-18 23:48:44 +04:00
|
|
|
{
|
From Anon Ymous:
- Remove all longjmp(3) calls from signal handlers. Instead, we post
to an internal signal queue and check that periodically. All signal
related code is now in sig.c, except for the SIGCHLD handler which
remains in popen.c as it is intimately tied to routines there.
- Handle SIGPIPE in type1() regardless of mime support, or else the
handler in execute() will prevent our error code from being returned
resulting in 'sawcom' not being set on the first command as it should.
This only affected the initial behavior of the "next" command without
mime support.
- Add the 'T' flag to many commands in cmdtab.c that should not look
like the first command. E.g., start mail on a mailbox with multiple
messages, run "set foo", then "next", and watch the second message get
displayed rather than the first as is the case without the first "set"
command.
- Add file descriptor and file handle leak detection. Enabled by
DEBUG_FILE_LEAK. This will likely disappear in the future.
- Fix a long standing (since import in 1993) longjmp() bug in
edstop(): the jmpbuf was invalid when quit() is called at the end of
main.
- Fix a long standing bug (since import in 1993) in snarf() where it
didn't strip whitespace correctly if the line consisted only of
whitespace.
- Lint cleanup.
- New Feature: "Header" command. This allows miscellaneous header
fields to be added to the header, e.g., "X-Organization:" or
"Reply-To:" fields.
- New Feature: "page-also" variable. This allows the specification of
additional commands to page. It is more flexible than "crt".
- Document the "pager-off" variable: if set, it disables paging
entirely.
2009-04-10 17:08:24 +04:00
|
|
|
static char line[LINE_MAX];
|
2006-10-22 01:37:20 +04:00
|
|
|
size_t len;
|
From Anon Ymous:
- Remove all longjmp(3) calls from signal handlers. Instead, we post
to an internal signal queue and check that periodically. All signal
related code is now in sig.c, except for the SIGCHLD handler which
remains in popen.c as it is intimately tied to routines there.
- Handle SIGPIPE in type1() regardless of mime support, or else the
handler in execute() will prevent our error code from being returned
resulting in 'sawcom' not being set on the first command as it should.
This only affected the initial behavior of the "next" command without
mime support.
- Add the 'T' flag to many commands in cmdtab.c that should not look
like the first command. E.g., start mail on a mailbox with multiple
messages, run "set foo", then "next", and watch the second message get
displayed rather than the first as is the case without the first "set"
command.
- Add file descriptor and file handle leak detection. Enabled by
DEBUG_FILE_LEAK. This will likely disappear in the future.
- Fix a long standing (since import in 1993) longjmp() bug in
edstop(): the jmpbuf was invalid when quit() is called at the end of
main.
- Fix a long standing bug (since import in 1993) in snarf() where it
didn't strip whitespace correctly if the line consisted only of
whitespace.
- Lint cleanup.
- New Feature: "Header" command. This allows miscellaneous header
fields to be added to the header, e.g., "X-Organization:" or
"Reply-To:" fields.
- New Feature: "page-also" variable. This allows the specification of
additional commands to page. It is more flexible than "crt".
- Document the "pager-off" variable: if set, it disables paging
entirely.
2009-04-10 17:08:24 +04:00
|
|
|
int cnt;
|
2006-10-22 01:37:20 +04:00
|
|
|
const char *buf;
|
|
|
|
HistEvent ev;
|
2006-09-18 23:48:44 +04:00
|
|
|
|
From Anon Ymous:
- Remove all longjmp(3) calls from signal handlers. Instead, we post
to an internal signal queue and check that periodically. All signal
related code is now in sig.c, except for the SIGCHLD handler which
remains in popen.c as it is intimately tied to routines there.
- Handle SIGPIPE in type1() regardless of mime support, or else the
handler in execute() will prevent our error code from being returned
resulting in 'sawcom' not being set on the first command as it should.
This only affected the initial behavior of the "next" command without
mime support.
- Add the 'T' flag to many commands in cmdtab.c that should not look
like the first command. E.g., start mail on a mailbox with multiple
messages, run "set foo", then "next", and watch the second message get
displayed rather than the first as is the case without the first "set"
command.
- Add file descriptor and file handle leak detection. Enabled by
DEBUG_FILE_LEAK. This will likely disappear in the future.
- Fix a long standing (since import in 1993) longjmp() bug in
edstop(): the jmpbuf was invalid when quit() is called at the end of
main.
- Fix a long standing bug (since import in 1993) in snarf() where it
didn't strip whitespace correctly if the line consisted only of
whitespace.
- Lint cleanup.
- New Feature: "Header" command. This allows miscellaneous header
fields to be added to the header, e.g., "X-Organization:" or
"Reply-To:" fields.
- New Feature: "page-also" variable. This allows the specification of
additional commands to page. It is more flexible than "crt".
- Document the "pager-off" variable: if set, it disables paging
entirely.
2009-04-10 17:08:24 +04:00
|
|
|
sig_check();
|
2006-09-18 23:48:44 +04:00
|
|
|
|
From Anon Ymous:
- Remove all longjmp(3) calls from signal handlers. Instead, we post
to an internal signal queue and check that periodically. All signal
related code is now in sig.c, except for the SIGCHLD handler which
remains in popen.c as it is intimately tied to routines there.
- Handle SIGPIPE in type1() regardless of mime support, or else the
handler in execute() will prevent our error code from being returned
resulting in 'sawcom' not being set on the first command as it should.
This only affected the initial behavior of the "next" command without
mime support.
- Add the 'T' flag to many commands in cmdtab.c that should not look
like the first command. E.g., start mail on a mailbox with multiple
messages, run "set foo", then "next", and watch the second message get
displayed rather than the first as is the case without the first "set"
command.
- Add file descriptor and file handle leak detection. Enabled by
DEBUG_FILE_LEAK. This will likely disappear in the future.
- Fix a long standing (since import in 1993) longjmp() bug in
edstop(): the jmpbuf was invalid when quit() is called at the end of
main.
- Fix a long standing bug (since import in 1993) in snarf() where it
didn't strip whitespace correctly if the line consisted only of
whitespace.
- Lint cleanup.
- New Feature: "Header" command. This allows miscellaneous header
fields to be added to the header, e.g., "X-Organization:" or
"Reply-To:" fields.
- New Feature: "page-also" variable. This allows the specification of
additional commands to page. It is more flexible than "crt".
- Document the "pager-off" variable: if set, it disables paging
entirely.
2009-04-10 17:08:24 +04:00
|
|
|
el_prompt = prompt;
|
2006-09-18 23:48:44 +04:00
|
|
|
if (string)
|
2006-10-22 01:37:20 +04:00
|
|
|
el_push(em->el, string);
|
|
|
|
|
From Anon Ymous:
- Remove all longjmp(3) calls from signal handlers. Instead, we post
to an internal signal queue and check that periodically. All signal
related code is now in sig.c, except for the SIGCHLD handler which
remains in popen.c as it is intimately tied to routines there.
- Handle SIGPIPE in type1() regardless of mime support, or else the
handler in execute() will prevent our error code from being returned
resulting in 'sawcom' not being set on the first command as it should.
This only affected the initial behavior of the "next" command without
mime support.
- Add the 'T' flag to many commands in cmdtab.c that should not look
like the first command. E.g., start mail on a mailbox with multiple
messages, run "set foo", then "next", and watch the second message get
displayed rather than the first as is the case without the first "set"
command.
- Add file descriptor and file handle leak detection. Enabled by
DEBUG_FILE_LEAK. This will likely disappear in the future.
- Fix a long standing (since import in 1993) longjmp() bug in
edstop(): the jmpbuf was invalid when quit() is called at the end of
main.
- Fix a long standing bug (since import in 1993) in snarf() where it
didn't strip whitespace correctly if the line consisted only of
whitespace.
- Lint cleanup.
- New Feature: "Header" command. This allows miscellaneous header
fields to be added to the header, e.g., "X-Organization:" or
"Reply-To:" fields.
- New Feature: "page-also" variable. This allows the specification of
additional commands to page. It is more flexible than "crt".
- Document the "pager-off" variable: if set, it disables paging
entirely.
2009-04-10 17:08:24 +04:00
|
|
|
/*
|
|
|
|
* Let el_gets() deal with flow control. Also, make sure we
|
|
|
|
* output a ^C when we get a SIGINT as el_gets() doesn't echo
|
|
|
|
* one.
|
|
|
|
*/
|
|
|
|
old_sigint = sig_signal(SIGINT, comp_intr);
|
2006-10-22 01:37:20 +04:00
|
|
|
buf = el_gets(em->el, &cnt);
|
From Anon Ymous:
- Remove all longjmp(3) calls from signal handlers. Instead, we post
to an internal signal queue and check that periodically. All signal
related code is now in sig.c, except for the SIGCHLD handler which
remains in popen.c as it is intimately tied to routines there.
- Handle SIGPIPE in type1() regardless of mime support, or else the
handler in execute() will prevent our error code from being returned
resulting in 'sawcom' not being set on the first command as it should.
This only affected the initial behavior of the "next" command without
mime support.
- Add the 'T' flag to many commands in cmdtab.c that should not look
like the first command. E.g., start mail on a mailbox with multiple
messages, run "set foo", then "next", and watch the second message get
displayed rather than the first as is the case without the first "set"
command.
- Add file descriptor and file handle leak detection. Enabled by
DEBUG_FILE_LEAK. This will likely disappear in the future.
- Fix a long standing (since import in 1993) longjmp() bug in
edstop(): the jmpbuf was invalid when quit() is called at the end of
main.
- Fix a long standing bug (since import in 1993) in snarf() where it
didn't strip whitespace correctly if the line consisted only of
whitespace.
- Lint cleanup.
- New Feature: "Header" command. This allows miscellaneous header
fields to be added to the header, e.g., "X-Organization:" or
"Reply-To:" fields.
- New Feature: "page-also" variable. This allows the specification of
additional commands to page. It is more flexible than "crt".
- Document the "pager-off" variable: if set, it disables paging
entirely.
2009-04-10 17:08:24 +04:00
|
|
|
(void)sig_signal(SIGINT, old_sigint);
|
2006-09-24 18:01:48 +04:00
|
|
|
|
From Anon Ymous:
- Remove all longjmp(3) calls from signal handlers. Instead, we post
to an internal signal queue and check that periodically. All signal
related code is now in sig.c, except for the SIGCHLD handler which
remains in popen.c as it is intimately tied to routines there.
- Handle SIGPIPE in type1() regardless of mime support, or else the
handler in execute() will prevent our error code from being returned
resulting in 'sawcom' not being set on the first command as it should.
This only affected the initial behavior of the "next" command without
mime support.
- Add the 'T' flag to many commands in cmdtab.c that should not look
like the first command. E.g., start mail on a mailbox with multiple
messages, run "set foo", then "next", and watch the second message get
displayed rather than the first as is the case without the first "set"
command.
- Add file descriptor and file handle leak detection. Enabled by
DEBUG_FILE_LEAK. This will likely disappear in the future.
- Fix a long standing (since import in 1993) longjmp() bug in
edstop(): the jmpbuf was invalid when quit() is called at the end of
main.
- Fix a long standing bug (since import in 1993) in snarf() where it
didn't strip whitespace correctly if the line consisted only of
whitespace.
- Lint cleanup.
- New Feature: "Header" command. This allows miscellaneous header
fields to be added to the header, e.g., "X-Organization:" or
"Reply-To:" fields.
- New Feature: "page-also" variable. This allows the specification of
additional commands to page. It is more flexible than "crt".
- Document the "pager-off" variable: if set, it disables paging
entirely.
2009-04-10 17:08:24 +04:00
|
|
|
if (buf == NULL) {
|
|
|
|
sig_check();
|
2006-10-22 01:37:20 +04:00
|
|
|
return NULL;
|
2006-09-24 18:01:48 +04:00
|
|
|
}
|
2006-09-18 23:48:44 +04:00
|
|
|
|
2010-01-12 17:44:24 +03:00
|
|
|
if (cnt > 0) {
|
|
|
|
if (buf[cnt - 1] == '\n')
|
|
|
|
cnt--; /* trash the trailing LF */
|
From Anon Ymous:
- Remove all longjmp(3) calls from signal handlers. Instead, we post
to an internal signal queue and check that periodically. All signal
related code is now in sig.c, except for the SIGCHLD handler which
remains in popen.c as it is intimately tied to routines there.
- Handle SIGPIPE in type1() regardless of mime support, or else the
handler in execute() will prevent our error code from being returned
resulting in 'sawcom' not being set on the first command as it should.
This only affected the initial behavior of the "next" command without
mime support.
- Add the 'T' flag to many commands in cmdtab.c that should not look
like the first command. E.g., start mail on a mailbox with multiple
messages, run "set foo", then "next", and watch the second message get
displayed rather than the first as is the case without the first "set"
command.
- Add file descriptor and file handle leak detection. Enabled by
DEBUG_FILE_LEAK. This will likely disappear in the future.
- Fix a long standing (since import in 1993) longjmp() bug in
edstop(): the jmpbuf was invalid when quit() is called at the end of
main.
- Fix a long standing bug (since import in 1993) in snarf() where it
didn't strip whitespace correctly if the line consisted only of
whitespace.
- Lint cleanup.
- New Feature: "Header" command. This allows miscellaneous header
fields to be added to the header, e.g., "X-Organization:" or
"Reply-To:" fields.
- New Feature: "page-also" variable. This allows the specification of
additional commands to page. It is more flexible than "crt".
- Document the "pager-off" variable: if set, it disables paging
entirely.
2009-04-10 17:08:24 +04:00
|
|
|
|
2010-01-12 17:44:24 +03:00
|
|
|
len = MIN(sizeof(line) - 1, (size_t)cnt);
|
|
|
|
(void)memcpy(line, buf, len);
|
|
|
|
}
|
2006-09-18 23:48:44 +04:00
|
|
|
line[cnt] = '\0';
|
|
|
|
|
2006-10-22 01:37:20 +04:00
|
|
|
/* enter non-empty lines into history */
|
|
|
|
if (em->hist) {
|
|
|
|
const char *p;
|
From Anon Ymous:
- Remove all longjmp(3) calls from signal handlers. Instead, we post
to an internal signal queue and check that periodically. All signal
related code is now in sig.c, except for the SIGCHLD handler which
remains in popen.c as it is intimately tied to routines there.
- Handle SIGPIPE in type1() regardless of mime support, or else the
handler in execute() will prevent our error code from being returned
resulting in 'sawcom' not being set on the first command as it should.
This only affected the initial behavior of the "next" command without
mime support.
- Add the 'T' flag to many commands in cmdtab.c that should not look
like the first command. E.g., start mail on a mailbox with multiple
messages, run "set foo", then "next", and watch the second message get
displayed rather than the first as is the case without the first "set"
command.
- Add file descriptor and file handle leak detection. Enabled by
DEBUG_FILE_LEAK. This will likely disappear in the future.
- Fix a long standing (since import in 1993) longjmp() bug in
edstop(): the jmpbuf was invalid when quit() is called at the end of
main.
- Fix a long standing bug (since import in 1993) in snarf() where it
didn't strip whitespace correctly if the line consisted only of
whitespace.
- Lint cleanup.
- New Feature: "Header" command. This allows miscellaneous header
fields to be added to the header, e.g., "X-Organization:" or
"Reply-To:" fields.
- New Feature: "page-also" variable. This allows the specification of
additional commands to page. It is more flexible than "crt".
- Document the "pager-off" variable: if set, it disables paging
entirely.
2009-04-10 17:08:24 +04:00
|
|
|
|
2007-10-23 18:58:43 +04:00
|
|
|
p = skip_WSP(line);
|
2006-10-22 01:37:20 +04:00
|
|
|
if (*p && history(em->hist, &ev, H_ENTER, line) == 0)
|
|
|
|
(void)printf("Failed history entry: %s", line);
|
|
|
|
}
|
From Anon Ymous:
- Remove all longjmp(3) calls from signal handlers. Instead, we post
to an internal signal queue and check that periodically. All signal
related code is now in sig.c, except for the SIGCHLD handler which
remains in popen.c as it is intimately tied to routines there.
- Handle SIGPIPE in type1() regardless of mime support, or else the
handler in execute() will prevent our error code from being returned
resulting in 'sawcom' not being set on the first command as it should.
This only affected the initial behavior of the "next" command without
mime support.
- Add the 'T' flag to many commands in cmdtab.c that should not look
like the first command. E.g., start mail on a mailbox with multiple
messages, run "set foo", then "next", and watch the second message get
displayed rather than the first as is the case without the first "set"
command.
- Add file descriptor and file handle leak detection. Enabled by
DEBUG_FILE_LEAK. This will likely disappear in the future.
- Fix a long standing (since import in 1993) longjmp() bug in
edstop(): the jmpbuf was invalid when quit() is called at the end of
main.
- Fix a long standing bug (since import in 1993) in snarf() where it
didn't strip whitespace correctly if the line consisted only of
whitespace.
- Lint cleanup.
- New Feature: "Header" command. This allows miscellaneous header
fields to be added to the header, e.g., "X-Organization:" or
"Reply-To:" fields.
- New Feature: "page-also" variable. This allows the specification of
additional commands to page. It is more flexible than "crt".
- Document the "pager-off" variable: if set, it disables paging
entirely.
2009-04-10 17:08:24 +04:00
|
|
|
sig_check();
|
2006-09-18 23:48:44 +04:00
|
|
|
return line;
|
|
|
|
}
|
|
|
|
|
2006-10-22 01:37:20 +04:00
|
|
|
static el_mode_t
|
|
|
|
init_el_mode(
|
|
|
|
const char *el_editor,
|
|
|
|
unsigned char (*completer)(EditLine *, int),
|
|
|
|
struct name *keys,
|
|
|
|
int history_size)
|
2006-09-18 23:48:44 +04:00
|
|
|
{
|
2009-02-11 22:10:08 +03:00
|
|
|
FILE *nullfp;
|
2006-10-22 01:37:20 +04:00
|
|
|
el_mode_t em;
|
2009-02-11 22:10:08 +03:00
|
|
|
|
2006-10-22 01:37:20 +04:00
|
|
|
(void)memset(&em, 0, sizeof(em));
|
2006-09-18 23:48:44 +04:00
|
|
|
|
2009-02-11 22:10:08 +03:00
|
|
|
if ((nullfp = fopen(_PATH_DEVNULL, "w")) == NULL)
|
2009-02-11 22:22:22 +03:00
|
|
|
err(EXIT_FAILURE, "Cannot open `%s'", _PATH_DEVNULL);
|
2009-02-11 22:10:08 +03:00
|
|
|
|
|
|
|
if ((em.el = el_init(getprogname(), stdin, stdout, nullfp)) == NULL) {
|
2006-12-25 21:43:29 +03:00
|
|
|
warn("el_init");
|
|
|
|
return em;
|
|
|
|
}
|
2009-02-11 22:10:08 +03:00
|
|
|
(void)fflush(nullfp);
|
|
|
|
(void)dup2(STDERR_FILENO, fileno(nullfp));
|
2006-10-22 01:37:20 +04:00
|
|
|
|
|
|
|
(void)el_set(em.el, EL_PROMPT, show_prompt);
|
2006-12-25 21:43:29 +03:00
|
|
|
(void)el_set(em.el, EL_SIGNAL, 1); /* editline handles the signals. */
|
2007-10-23 18:58:43 +04:00
|
|
|
|
2006-10-22 01:37:20 +04:00
|
|
|
if (el_editor)
|
|
|
|
(void)el_set(em.el, EL_EDITOR, el_editor);
|
|
|
|
|
|
|
|
if (completer) {
|
|
|
|
struct name *np;
|
|
|
|
(void)el_set(em.el, EL_ADDFN, "mail-complete",
|
|
|
|
"Context sensitive argument completion", completer);
|
|
|
|
for (np = keys; np; np = np->n_flink)
|
|
|
|
(void)el_set(em.el, EL_BIND, np->n_name,
|
|
|
|
"mail-complete", NULL);
|
2006-09-24 18:01:48 +04:00
|
|
|
}
|
2006-09-18 23:48:44 +04:00
|
|
|
|
2006-10-22 01:37:20 +04:00
|
|
|
if (history_size) {
|
|
|
|
HistEvent ev;
|
2006-12-25 21:43:29 +03:00
|
|
|
if ((em.hist = history_init()) == NULL) {
|
|
|
|
warn("history_init");
|
|
|
|
return em;
|
|
|
|
}
|
|
|
|
if (history(em.hist, &ev, H_SETSIZE, history_size) == -1)
|
2006-10-22 01:37:20 +04:00
|
|
|
(void)printf("history: %s\n", ev.str);
|
|
|
|
(void)el_set(em.el, EL_HIST, history, em.hist);
|
|
|
|
}
|
2006-09-18 23:48:44 +04:00
|
|
|
|
2006-10-22 01:37:20 +04:00
|
|
|
(void)el_source(em.el, NULL); /* read ~/.editrc */
|
|
|
|
|
|
|
|
return em;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
struct el_modes_s elm = {
|
|
|
|
.command = { .el = NULL, .hist = NULL, },
|
|
|
|
.string = { .el = NULL, .hist = NULL, },
|
|
|
|
.filec = { .el = NULL, .hist = NULL, },
|
|
|
|
#ifdef MIME_SUPPORT
|
|
|
|
.mime_enc = { .el = NULL, .hist = NULL, },
|
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
PUBLIC void
|
2006-10-22 01:37:20 +04:00
|
|
|
init_editline(void)
|
|
|
|
{
|
|
|
|
const char *mode;
|
|
|
|
int hist_size;
|
|
|
|
struct name *keys;
|
|
|
|
char *cp;
|
|
|
|
|
|
|
|
mode = value(ENAME_EL_EDITOR);
|
2007-10-23 18:58:43 +04:00
|
|
|
|
2006-10-22 01:37:20 +04:00
|
|
|
cp = value(ENAME_EL_HISTORY_SIZE);
|
|
|
|
hist_size = cp ? atoi(cp) : 0;
|
2006-09-18 23:48:44 +04:00
|
|
|
|
2006-10-22 01:37:20 +04:00
|
|
|
cp = value(ENAME_EL_COMPLETION_KEYS);
|
|
|
|
keys = cp && *cp ? lexpand(cp, 0) : NULL;
|
2006-09-18 23:48:44 +04:00
|
|
|
|
2006-10-22 01:37:20 +04:00
|
|
|
elm.command = init_el_mode(mode, mail_complete, keys, hist_size);
|
|
|
|
elm.filec = init_el_mode(mode, file_complete, keys, 0);
|
|
|
|
elm.string = init_el_mode(mode, NULL, NULL, 0);
|
|
|
|
#ifdef MIME_SUPPORT
|
|
|
|
elm.mime_enc = init_el_mode(mode, mime_enc_complete, keys, 0);
|
|
|
|
#endif
|
2006-09-18 23:48:44 +04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2006-10-22 01:37:20 +04:00
|
|
|
#endif /* USE_EDITLINE */
|