More warning avoidance and code cleanup

This commit is contained in:
Linus Torvalds 2005-09-30 23:52:55 -07:00
parent d0ed902432
commit 8eab871e55
6 changed files with 30 additions and 27 deletions

View File

@ -409,10 +409,10 @@ KEYTAB keytab[NBINDS] = {
,
/* special internal bindings */
SPEC | META | 'W', wrapword, /* called on word wrap */
SPEC | META | 'C', nullproc, /* every command input */
SPEC | META | 'R', nullproc, /* on file read */
SPEC | META | 'X', nullproc, /* on window change P.K. */
{ SPEC | META | 'W', wrapword }, /* called on word wrap */
{ SPEC | META | 'C', nullproc }, /* every command input */
{ SPEC | META | 'R', nullproc }, /* on file read */
{ SPEC | META | 'X', nullproc }, /* on window change P.K. */
{0, NULL}
};

View File

@ -120,7 +120,7 @@ extern int istring(int f, int n);
extern int ovstring(int f, int n);
/* main.c */
extern int edinit(char *bname);
extern void edinit(char *bname);
extern int execute(int c, int f, int n);
extern int quickexit(int f, int n);
extern int quit(int f, int n);
@ -320,7 +320,7 @@ extern int cbuf40(int f, int n);
/* spawn.c */
extern int spawncli(int f, int n);
extern void bktoshell(void);
extern int bktoshell(int f, int n);
extern void rtfrmshell(void);
extern int spawn(int f, int n);
extern int execprg(int f, int n);

8
lock.c
View File

@ -14,9 +14,6 @@
#if BSD | SVR4
#include <sys/errno.h>
extern int sys_nerr; /* number of system error messages defined */
extern int errno; /* current error */
char *lname[NLOCKS]; /* names of all locked files */
int numlocks; /* # of current locks active */
@ -157,10 +154,7 @@ void lckerror(char *errstr)
strcpy(obuf, errstr);
strcat(obuf, " - ");
if (errno < sys_nerr)
strcat(obuf, sys_errlist[errno]);
else
strcat(obuf, "(can not get system error message)");
strcat(obuf, strerror(errno));
mlwrite(obuf);
}
#endif

23
main.c
View File

@ -94,7 +94,7 @@ int emacs(int argc, char **argv)
int main(int argc, char **argv)
#endif
{
register int c; /* command character */
register int c = -1; /* command character */
register int f; /* default flag */
register int n; /* numeric repeat count */
register int mflag; /* negative flag on repeat */
@ -115,7 +115,6 @@ int main(int argc, char **argv)
int cryptflag; /* encrypting on the way in? */
char ekey[NPAT]; /* startup encryption key */
#endif
extern *pathname[]; /* startup file path/name array */
int newc;
#if PKCODE & VMS
@ -373,7 +372,7 @@ int main(int argc, char **argv)
n = 4; /* with argument of 4 */
mflag = 0; /* that can be discarded. */
mlwrite("Arg: 4");
while ((c = getcmd()) >= '0' && c <= '9' || c == reptc
while (((c = getcmd()) >= '0' && c <= '9') || c == reptc
|| c == '-') {
if (c == reptc)
if ((n > 0) == ((n * 4) > 0))
@ -425,7 +424,7 @@ int main(int argc, char **argv)
* as an argument, because the main routine may have been told to read in a
* file by default, and we want the buffer name to be right.
*/
int edinit(char *bname)
void edinit(char *bname)
{
register BUFFER *bp;
register WINDOW *wp;
@ -706,20 +705,28 @@ int resterr(void)
return (FALSE);
}
/* user function that does NOTHING */
int nullproc(int f, int n)
{ /* user function that does NOTHING */
{
return (TRUE);
}
/* dummy function for binding to meta prefix */
int meta(int f, int n)
{ /* dummy function for binding to meta prefix */
{
return (TRUE);
}
/* dummy function for binding to control-x prefix */
int cex(int f, int n)
{ /* dummy function for binding to control-x prefix */
{
return (TRUE);
}
/* dummy function for binding to universal-argument */
int unarg(int f, int n)
{ /* dummy function for binding to universal-argument */
{
return (TRUE);
}
/***** Compiler specific Library functions ****/

View File

@ -13,6 +13,7 @@
#ifdef POSIX
#include <stdio.h>
#include <unistd.h>
#include "estruct.h"
#include "edef.h"
#include "efunc.h"
@ -23,9 +24,7 @@
#include <errno.h>
static int kbdflgs; /* saved keyboard fd flags */
static int kbdpoll; /* in O_NDELAY mode */
static int kbdqp; /* there is a char in kbdq */
static char kbdq; /* char we've already read */
static int kbdpoll; /* in O_NDELAY mode */
static struct termios otermios; /* original terminal characteristics */
static struct termios ntermios; /* charactoristics to use inside */
@ -101,6 +100,7 @@ void ttclose(void)
int ttputc(int c)
{
fputc(c, stdout);
return (TRUE);
}
/*

View File

@ -5,6 +5,7 @@
*/
#include <stdio.h>
#include <unistd.h>
#include "estruct.h"
#include "edef.h"
#include "efunc.h"
@ -104,16 +105,17 @@ int spawncli(int f, int n)
#if BSD | __hpux | SVR4
void bktoshell(void)
int bktoshell(int f, int n)
{ /* suspend MicroEMACS and wait to wake up */
int pid;
vttidy();
/******************************
int pid;
pid = getpid();
kill(pid,SIGTSTP);
******************************/
kill(0, SIGTSTP);
return (TRUE);
}
void rtfrmshell(void)