1
0
mirror of https://github.com/rfivet/uemacs.git synced 2024-12-18 23:36:23 -05:00

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 */ /* special internal bindings */
SPEC | META | 'W', wrapword, /* called on word wrap */ { SPEC | META | 'W', wrapword }, /* called on word wrap */
SPEC | META | 'C', nullproc, /* every command input */ { SPEC | META | 'C', nullproc }, /* every command input */
SPEC | META | 'R', nullproc, /* on file read */ { SPEC | META | 'R', nullproc }, /* on file read */
SPEC | META | 'X', nullproc, /* on window change P.K. */ { SPEC | META | 'X', nullproc }, /* on window change P.K. */
{0, NULL} {0, NULL}
}; };

View File

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

8
lock.c
View File

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

23
main.c
View File

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

View File

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

View File

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