Use gcc -ansi -pedantic in 9c. Fix many non-C89-isms.

This commit is contained in:
rsc 2006-04-01 19:24:03 +00:00
parent 226d80b821
commit cbeb0b26e4
492 changed files with 3218 additions and 3167 deletions

View file

@ -37,7 +37,7 @@ Rune snarfrune[NSnarf+1];
char *fontnames[2] =
{
"/lib/font/bit/lucsans/euro.8.font",
"/lib/font/bit/lucm/unicode.9.font",
"/lib/font/bit/lucm/unicode.9.font"
};
Command *command;
@ -160,7 +160,7 @@ threadmain(int argc, char *argv[])
d = display;
font = d->defaultfont;
//assert(font);
/*assert(font); */
reffont.f = font;
reffonts[0] = &reffont;
@ -355,8 +355,8 @@ killprocs(void)
Command *c;
fsysclose();
// if(display)
// flushimage(display, 1);
/* if(display) */
/* flushimage(display, 1); */
for(c=command; c; c=c->next)
postnote(PNGROUP, c->pid, "hangup");

View file

@ -15,13 +15,13 @@ enum
{
None = 0,
Fore = '+',
Back = '-',
Back = '-'
};
enum
{
Char,
Line,
Line
};
int

View file

@ -13,7 +13,7 @@
enum
{
Slop = 100, /* room to grow with reallocation */
Slop = 100 /* room to grow with reallocation */
};
static

View file

@ -21,7 +21,7 @@ enum
QWwrsel,
QWtag,
QWxdata,
QMAX,
QMAX
};
enum
@ -29,7 +29,7 @@ enum
Blockincr = 256,
Maxblock = 8*1024,
NRange = 10,
Infinity = 0x7FFFFFFF, /* huge value for regexp address */
Infinity = 0x7FFFFFFF /* huge value for regexp address */
};
#define Buffer AcmeBuffer
@ -166,7 +166,7 @@ enum /* Text.what */
Columntag,
Rowtag,
Tag,
Body,
Body
};
struct Text
@ -463,7 +463,7 @@ enum
Scrollwid = 12, /* width of scroll bar */
Scrollgap = 4, /* gap right of scroll bar */
Margin = 4, /* margin around text */
Border = 2, /* line between rows, cols, windows */
Border = 2 /* line between rows, cols, windows */
};
#define QID(w,q) ((w<<8)|(q))
@ -477,7 +477,7 @@ enum
{
FALSE,
TRUE,
XXX,
XXX
};
enum
@ -487,14 +487,14 @@ enum
Delete = 'd',
Insert = 'i',
Replace = 'r',
Filename = 'f',
Filename = 'f'
};
enum /* editing */
{
Inactive = 0,
Inserting,
Collecting,
Collecting
};
uint globalincref;
@ -545,7 +545,7 @@ int dodollarsigns;
enum
{
Kscrolloneup = KF|0x20,
Kscrollonedown = KF|0x21,
Kscrollonedown = KF|0x21
};
Channel *cplumb; /* chan(Plumbmsg*) */

View file

@ -898,14 +898,14 @@ alllooper(Window *w, void *v)
lp = v;
cp = lp->cp;
// if(w->isscratch || w->isdir)
// return;
/* if(w->isscratch || w->isdir) */
/* return; */
t = &w->body;
/* only use this window if it's the current window for the file */
if(t->file->curtext != t)
return;
// if(w->nopen[QWevent] > 0)
// return;
/* if(w->nopen[QWevent] > 0) */
/* return; */
/* no auto-execute on files without names */
if(cp->re==nil && t->file->nname==0)
return;
@ -1012,7 +1012,7 @@ cmdaddress(Addr *ap, Address a, int sign)
case '\'':
editerror("can't handle '");
// a.r = f->mark;
/* a.r = f->mark; */
break;
case '?':
@ -1093,8 +1093,8 @@ alltofile(Window *w, void *v)
/* only use this window if it's the current window for the file */
if(t->file->curtext != t)
return;
// if(w->nopen[QWevent] > 0)
// return;
/* if(w->nopen[QWevent] > 0) */
/* return; */
if(runeeq(tp->r->r, tp->r->n, t->file->name, t->file->nname))
tp->f = t->file;
}
@ -1127,8 +1127,8 @@ allmatchfile(Window *w, void *v)
/* only use this window if it's the current window for the file */
if(t->file->curtext != t)
return;
// if(w->nopen[QWevent] > 0)
// return;
/* if(w->nopen[QWevent] > 0) */
/* return; */
if(filematch(w->body.file, tp->r)){
if(tp->f != nil)
editerror("too many files match \"%S\"", tp->r->r);

View file

@ -49,7 +49,7 @@ struct cmdtab cmdtab[]={
'q', 0, 0, 0, 0, aNo, 0, 0, q_cmd,
'!', 0, 0, 0, 0, aNo, 0, linex, plan9_cmd,
*/
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0
};
Cmd *parsecmd(int);
@ -82,8 +82,8 @@ editthread(void *v)
USED(v);
threadsetname("editthread");
while((cmdp=parsecmd(0)) != 0){
// ocurfile = curfile;
// loaded = curfile && !curfile->unread;
/* ocurfile = curfile; */
/* loaded = curfile && !curfile->unread; */
if(cmdexec(curtext, cmdp) == 0)
break;
freecmd();

View file

@ -76,7 +76,7 @@ struct List /* code depends on a long being able to hold a pointer */
enum Defaddr{ /* default addresses */
aNo,
aDot,
aAll,
aAll
};
int nl_cmd(Text*, Cmd*), a_cmd(Text*, Cmd*), b_cmd(Text*, Cmd*);

View file

@ -36,7 +36,7 @@ struct Buflog
enum
{
Buflogsize = sizeof(Buflog)/sizeof(Rune),
Buflogsize = sizeof(Buflog)/sizeof(Rune)
};
/*
@ -46,7 +46,7 @@ enum
enum
{
Minstring = 16, /* distance beneath which we merge changes */
Maxstring = RBUFSIZE, /* maximum length of change we will merge into one */
Maxstring = RBUFSIZE /* maximum length of change we will merge into one */
};
void

View file

@ -108,7 +108,7 @@ Exectab exectab[] = {
{ LTab, tab, FALSE, XXX, XXX },
{ LUndo, undo, FALSE, TRUE, XXX },
{ LZerox, zeroxx, FALSE, XXX, XXX },
{ nil, 0, 0, 0, 0 },
{ nil, 0, 0, 0, 0 }
};
Exectab*
@ -1198,7 +1198,7 @@ enum {
IGlobal = -2,
IError = -1,
Ion = 0,
Ioff = 1,
Ioff = 1
};
static int
@ -1318,7 +1318,7 @@ runproc(void *argvp)
char buf[512];
int olddir;
int ret;
//static void *parg[2];
/*static void *parg[2]; */
char *rcarg[4];
void **argv;
CFsys *fs;

View file

@ -33,7 +33,7 @@ struct Undo
enum
{
Undosize = sizeof(Undo)/sizeof(Rune),
Undosize = sizeof(Undo)/sizeof(Rune)
};
File*

View file

@ -467,8 +467,10 @@ fsyswalk(Xfid *x, Fid *f)
goto Accept;
Regular:
// if(FILE(f->qid) == Qacme) /* empty directory */
// break;
/*
if(FILE(f->qid) == Qacme) // empty directory
break;
*/
if(strcmp(x->fcall.wname[i], "new") == 0){
if(w)
error("w set in walk to new");

View file

@ -7,7 +7,7 @@ enum
{
STACK = 8192,
EVENTSIZE = 256,
NEVENT = 5,
NEVENT = 5
};
struct Event

View file

@ -42,7 +42,7 @@ char *goodtypes[] = {
"text/richtext",
"text/tab-separated-values",
"application/octet-stream",
nil,
nil
};
char *okheaders[] =
@ -60,7 +60,7 @@ char *extraheaders[] =
"Resent-From:",
"Resent-To:",
"Sort:",
nil,
nil
};
char*
@ -100,10 +100,10 @@ mkaddrs(char *t)
for(i=0; i+1<nf; i+=2){
if(i > 0)
fmtprint(&fmt, ", ");
// if(f[i][0] == 0 || strcmp(f[i], f[i+1]) == 0)
/* if(f[i][0] == 0 || strcmp(f[i], f[i+1]) == 0) */
fmtprint(&fmt, "%s", f[i+1]);
// else
// fmtprint(&fmt, "%s <%s>", f[i], f[i+1]);
/* else */
/* fmtprint(&fmt, "%s <%s>", f[i], f[i+1]); */
}
free(f);
return fmtstrflush(&fmt);
@ -752,10 +752,10 @@ mesgcommand(Message *m, char *cmd)
mesgmenumarkundel(wbox, &mbox, m);
goto Return;
}
// if(strcmp(args[0], "Headers") == 0){
// m->showheaders();
// return True;
// }
/* if(strcmp(args[0], "Headers") == 0){ */
/* m->showheaders(); */
/* return True; */
/* } */
ret = 0;
@ -1149,8 +1149,8 @@ tokenizec(char *str, char **args, int max, char *splitc)
if(max <= 0)
return 0;
// if(strchr(str, ',') || strchr(str, '"') || strchr(str, '<') || strchr(str, '('))
// splitc = ",";
/* if(strchr(str, ',') || strchr(str, '"') || strchr(str, '<') || strchr(str, '(')) */
/* splitc = ","; */
for(na=0; *str != '\0';str++){
if(strchr(splitc, *str) == nil){
if(intok)
@ -1331,7 +1331,7 @@ mesgopen(Message *mbox, char *dir, char *s, Message *mesg, int plumbed, char *di
winopenbody(m->w, OWRITE);
mesgload(m, dir, m->name, m->w);
winclosebody(m->w);
// sleep(100);
/* sleep(100); */
winclean(m->w);
m->opened = 1;
if(ndirelem == 1){
@ -1405,7 +1405,7 @@ mesglookupfile(Message *mbox, char *name, char *digest)
k = strlen(name);
n = strlen(mbox->name);
if(k==0 || strncmp(name, mbox->name, n) != 0){
// fprint(2, "Mail: message %s not in this mailbox\n", name);
/* fprint(2, "Mail: message %s not in this mailbox\n", name); */
return nil;
}
return mesglookup(mbox, name+n, digest);

View file

@ -240,7 +240,7 @@ enum{
CC,
FROM,
INCLUDE,
TO,
TO
};
char *headers[] = {
@ -250,7 +250,7 @@ char *headers[] = {
"from:",
"include:",
"to:",
nil,
nil
};
int
@ -516,7 +516,7 @@ mesgsend(Message *m)
e->sync = sync;
proccreate(execproc, e, EXECSTACK);
recvul(sync);
// close(p[0]);
/* close(p[0]); */
/* using marshal -8, so generate rfc822 headers */
if(nto > 0){

View file

@ -74,7 +74,7 @@ textscrdraw(Text *t)
r2.min.x = r2.max.x-1;
draw(b, r2, t->fr.cols[BORD], nil, ZP);
draw(t->fr.b, r, b, nil, Pt(0, r1.min.y));
/*flushimage(display, 1);*//*BUG?*/
/*flushimage(display, 1); // BUG? */
}
}

View file

@ -1174,7 +1174,7 @@ textsetselect(Text *t, uint q0, uint q1)
*/
enum {
DELAY = 2,
MINMOVE = 4,
MINMOVE = 4
};
uint

View file

@ -53,7 +53,7 @@ wininit(Window *w, Window *clone, Rectangle r)
filereset(w->tag.file);
textsetselect(&w->tag, nc, nc);
}
//assert(w->body.w == w);
/*assert(w->body.w == w); */
r1 = r;
r1.min.y += w->taglines*font->height + 1;
if(r1.max.y < r1.min.y)
@ -66,7 +66,7 @@ wininit(Window *w, Window *clone, Rectangle r)
rf = rfget(FALSE, FALSE, FALSE, clone->body.reffont->f->name);
}else
rf = rfget(FALSE, FALSE, FALSE, nil);
//assert(w->body.w == w);
/*assert(w->body.w == w); */
f = fileaddtext(f, &w->body);
w->body.what = Body;
textinit(&w->body, f, r1, rf, textcols);
@ -82,7 +82,7 @@ wininit(Window *w, Window *clone, Rectangle r)
w->filemenu = TRUE;
w->maxlines = w->body.fr.maxlines;
w->autoindent = globalautoindent;
//assert(w->body.w == w);
/*assert(w->body.w == w); */
if(clone){
w->dirty = clone->dirty;
w->autoindent = clone->autoindent;