mostly more KNF

This commit is contained in:
mirabilos 2017-03-26 00:18:21 +01:00
parent 859746b30b
commit e216226f68
4 changed files with 8 additions and 12 deletions

2
edit.c
View File

@ -146,7 +146,7 @@ static int
x_getc(void)
{
#ifdef __OS2__
return _read_kbd(0, 1, 0);
return (_read_kbd(0, 1, 0));
#else
char c;
ssize_t n;

5
eval.c
View File

@ -883,9 +883,8 @@ expand(
#ifdef __OS2__
c == '\r' ||
#endif
c == '\n')
c == '\n') {
#ifdef __OS2__
{
if (c == '\r') {
c = shf_getc(x.u.shf);
switch (c) {
@ -903,9 +902,7 @@ expand(
if (c == '\n')
/* save newlines */
newlines++;
#ifdef __OS2__
}
#endif
if (newlines && c != -1) {
shf_ungetc(c, x.u.shf);
c = '\n';

2
exec.c
View File

@ -984,7 +984,7 @@ scriptexec(struct op *tp, const char **ap)
/* execute .cmd and .bat with OS2_SHELL, usually CMD.EXE */
sh = getenv("OS2_SHELL");
*tp->args-- = "/c";
/* convert slahes to back-slashes */
/* convert slahes to backslashes */
for (cp = tp->str; *cp; cp++) {
if (*cp == '/')
*cp = '\\';

11
sh.h
View File

@ -2439,13 +2439,12 @@ extern int tty_init_fd(void); /* initialise tty_fd, tty_devtty */
char mksh_cdirsep_c = (c); \
(mksh_cdirsep_c == '/' || mksh_cdirsep_c == '\\'); \
})
#define mksh_sdirsep(s) __extension__({ \
#define mksh_sdirsep(s) __extension__({ \
const char *mksh_sdirsep_s = (s); \
((char *)((ksh_isalphx(mksh_sdirsep_s[0]) && \
mksh_sdirsep_s[1] == ':' && \
!mksh_cdirsep(mksh_sdirsep_s[2])) ? \
(mksh_sdirsep_s + 1) : \
strpbrk(mksh_sdirsep_s, "/\\"))); \
((char *)((ksh_isalphx(mksh_sdirsep_s[0]) && \
mksh_sdirsep_s[1] == ':' && \
!mksh_cdirsep(mksh_sdirsep_s[2])) ? \
(mksh_sdirsep_s + 1) : strpbrk(mksh_sdirsep_s, "/\\"))); \
})
#define mksh_vdirsep(s) (mksh_sdirsep((s)) != NULL)
#else