Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
John McEleney
/
mailutils
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit
7eb89932
...
7eb899324a1dbe4d3bfcc73d9c0da8b4d4991f3e
authored
2000-09-02 22:56:57 +0000
by
Jakob Kaivo
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
More mailx functionality
1 parent
88d64cd7
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
74 additions
and
6 deletions
mail/help.c
mail/list.c
mail/table.h
mail/help.c
View file @
7eb8993
...
...
@@ -16,16 +16,54 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "mail.h"
#include "table.h"
/*
* hel[p]
* ?
* *
* hel[p] [command]
* ? [command]
*/
int
mail_help
(
int
argc
,
char
**
argv
)
{
printf
(
"Function not implemented in %s line %d
\n
"
,
__FILE__
,
__LINE__
);
if
(
argc
<
2
)
{
int
i
=
0
;
while
(
mail_command_table
[
i
].
synopsis
!=
0
)
printf
(
"%s
\n
"
,
mail_command_table
[
i
++
].
synopsis
);
return
0
;
}
else
{
int
status
=
0
;
int
command
=
0
;
while
(
++
command
<
argc
)
{
char
*
cmd
=
argv
[
command
];
int
i
=
0
,
printed
=
0
,
sl
=
0
,
ll
=
0
,
len
=
strlen
(
cmd
);
while
(
mail_command_table
[
i
].
shortname
!=
0
&&
printed
==
0
)
{
sl
=
strlen
(
mail_command_table
[
i
].
shortname
);
ll
=
strlen
(
mail_command_table
[
i
].
longname
);
if
(
sl
==
len
&&
!
strcmp
(
mail_command_table
[
i
].
shortname
,
cmd
))
{
printed
=
1
;
printf
(
"%s
\n
"
,
mail_command_table
[
i
].
synopsis
);
}
else
if
(
sl
<
len
&&
!
strncmp
(
mail_command_table
[
i
].
longname
,
cmd
,
len
))
{
printed
=
1
;
printf
(
"%s
\n
"
,
mail_command_table
[
i
].
synopsis
);
}
i
++
;
}
if
(
printed
==
0
)
{
printf
(
"Unknown command: %s
\n
"
,
cmd
);
status
=
1
;
}
}
}
return
1
;
}
...
...
mail/list.c
View file @
7eb8993
...
...
@@ -16,14 +16,43 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "mail.h"
#include "table.h"
/*
* l[ist]
* *
*/
int
mail_list
(
int
argc
,
char
**
argv
)
{
printf
(
"Function not implemented in %s line %d
\n
"
,
__FILE__
,
__LINE__
);
return
1
;
int
i
=
0
,
pos
=
0
,
columns
=
80
,
len
=
0
;
char
*
cmd
;
char
*
col
=
getenv
(
"COLUMNS"
);
if
(
col
)
columns
=
strtol
(
col
,
NULL
,
10
);
for
(
i
=
0
;
mail_command_table
[
i
].
shortname
!=
0
;
i
++
)
{
len
=
strlen
(
mail_command_table
[
i
].
longname
);
if
(
len
<
1
)
{
cmd
=
mail_command_table
[
i
].
shortname
;
len
=
strlen
(
cmd
);
}
else
cmd
=
mail_command_table
[
i
].
longname
;
pos
+=
len
+
1
;
if
(
pos
>=
columns
)
{
pos
=
0
;
printf
(
"
\n
"
);
}
printf
(
"%s "
,
cmd
);
}
printf
(
"
\n
"
);
return
0
;
}
...
...
mail/table.h
View file @
7eb8993
...
...
@@ -117,6 +117,7 @@ static struct mail_command_entry mail_command_table[] = {
{
"z"
,
""
,
mail_z
,
"z[+|-]"
},
{
"!"
,
""
,
mail_bang
,
"!command"
},
{
"="
,
"="
,
mail_eq
,
"="
},
{
"#"
,
"#"
,
NULL
,
"# comment"
},
{
0
,
0
,
0
,
0
,}
};
...
...
Please
register
or
sign in
to post a comment