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
79aadeff
...
79aadeff3be8c1fd7cc10a05ad53f0b5f38e8862
authored
2001-06-30 09:30:27 +0000
by
Sergey Poznyakoff
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
removed mail_[set_]is_terminal(), interactive is used instead.
1 parent
2a4860b9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
25 deletions
mail/if.c
mail/source.c
mail/if.c
View file @
79aadef
...
...
@@ -17,8 +17,6 @@
#include "mail.h"
static
int
is_terminal
;
#define COND_STK_SIZE 64
#define COND_STK_INCR 16
static
int
*
_cond_stack
;
/* Stack of conditions */
...
...
@@ -54,7 +52,7 @@ _cond_push(int val)
if
(
!
_cond_stack
)
{
fprintf
(
ofile
,
"not enough meme
ory"
);
util_error
(
"not enough mem
ory"
);
exit
(
EXIT_FAILURE
);
}
_cond_stack
[
_cond_level
++
]
=
val
;
...
...
@@ -65,7 +63,7 @@ _cond_pop()
{
if
(
_cond_level
==
0
)
{
fprintf
(
ofile
,
"internal error: condition stack underflow
\n
"
);
util_error
(
"internal error: condition stack underflow
"
);
abort
();
}
return
_cond_stack
[
--
_cond_level
];
...
...
@@ -87,13 +85,13 @@ mail_if (int argc, char **argv)
if
(
argc
!=
2
)
{
fprintf
(
ofile
,
"if requires an argument: s | r | t
\n
"
);
util_error
(
"if requires an argument: s | r | t
"
);
return
1
;
}
if
(
argv
[
1
][
1
]
!=
0
)
{
fprintf
(
ofile
,
"valid if arguments are: s | r | t
\n
"
);
util_error
(
"valid if arguments are: s | r | t
"
);
return
1
;
}
...
...
@@ -117,10 +115,10 @@ mail_if (int argc, char **argv)
cond
=
strcmp
(
mode
->
value
,
"send"
)
!=
0
;
break
;
case
't'
:
/* Reading from a terminal */
cond
=
i
s_terminal
;
cond
=
i
nteractive
;
break
;
default:
fprintf
(
ofile
,
"valid if arguments are: s | r | t
\n
"
);
util_error
(
"valid if arguments are: s | r | t
"
);
return
1
;
}
}
...
...
@@ -135,7 +133,7 @@ mail_else (int argc, char **argv)
int
cond
;
if
(
_cond_level
==
0
)
{
fprintf
(
ofile
,
"else without matching if
\n
"
);
util_error
(
"else without matching if
"
);
return
1
;
}
cond
=
_cond_pop
();
...
...
@@ -150,21 +148,11 @@ mail_endif (int argc, char **argv)
{
if
(
_cond_level
==
0
)
{
fprintf
(
ofile
,
"endif without matching if
\n
"
);
util_error
(
"endif without matching if
"
);
return
1
;
}
_cond_pop
();
return
1
;
}
void
mail_set_is_terminal
(
int
val
)
{
is_terminal
=
val
;
}
int
mail_is_terminal
(
void
)
{
return
is_terminal
;
}
...
...
mail/source.c
View file @
79aadef
...
...
@@ -48,21 +48,21 @@ mail_source (int argc, char **argv)
if
(
argc
!=
2
)
{
fprintf
(
ofile
,
"source requires an argument
\n
"
);
util_error
(
"source requires an argument
"
);
return
1
;
}
fp
=
fopen
(
argv
[
1
],
"r"
);
if
(
!
fp
)
{
fprintf
(
ofile
,
"can't open `%s': %s
\n
"
,
argv
[
1
],
strerror
(
errno
));
util_error
(
"can't open `%s': %s
"
,
argv
[
1
],
strerror
(
errno
));
return
1
;
}
save_term
=
mail_is_terminal
()
;
mail_set_is_terminal
(
0
)
;
save_term
=
interactive
;
interactive
=
0
;
mail_mainloop
(
source_readline
,
fp
,
0
);
mail_set_is_terminal
(
save_term
)
;
interactive
=
save_term
;
fclose
(
fp
);
return
0
;
}
...
...
Please
register
or
sign in
to post a comment