From cbeb0b26e4c7caa8d1b47de791a7418dc20a4567 Mon Sep 17 00:00:00 2001 From: rsc Date: Sat, 1 Apr 2006 19:24:03 +0000 Subject: Use gcc -ansi -pedantic in 9c. Fix many non-C89-isms. --- src/cmd/acme/acme.c | 8 ++++---- src/cmd/acme/addr.c | 4 ++-- src/cmd/acme/buff.c | 2 +- src/cmd/acme/dat.h | 16 ++++++++-------- src/cmd/acme/ecmd.c | 18 +++++++++--------- src/cmd/acme/edit.c | 6 +++--- src/cmd/acme/edit.h | 2 +- src/cmd/acme/elog.c | 4 ++-- src/cmd/acme/exec.c | 6 +++--- src/cmd/acme/file.c | 2 +- src/cmd/acme/fsys.c | 6 ++++-- src/cmd/acme/mail/dat.h | 2 +- src/cmd/acme/mail/mesg.c | 26 +++++++++++++------------- src/cmd/acme/mail/reply.c | 6 +++--- src/cmd/acme/scrl.c | 2 +- src/cmd/acme/text.c | 2 +- src/cmd/acme/wind.c | 6 +++--- 17 files changed, 60 insertions(+), 58 deletions(-) (limited to 'src/cmd/acme') diff --git a/src/cmd/acme/acme.c b/src/cmd/acme/acme.c index f95c3a17..395033b1 100644 --- a/src/cmd/acme/acme.c +++ b/src/cmd/acme/acme.c @@ -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"); diff --git a/src/cmd/acme/addr.c b/src/cmd/acme/addr.c index 7af5f6be..3869e39b 100644 --- a/src/cmd/acme/addr.c +++ b/src/cmd/acme/addr.c @@ -15,13 +15,13 @@ enum { None = 0, Fore = '+', - Back = '-', + Back = '-' }; enum { Char, - Line, + Line }; int diff --git a/src/cmd/acme/buff.c b/src/cmd/acme/buff.c index 39982f17..875bb0b0 100644 --- a/src/cmd/acme/buff.c +++ b/src/cmd/acme/buff.c @@ -13,7 +13,7 @@ enum { - Slop = 100, /* room to grow with reallocation */ + Slop = 100 /* room to grow with reallocation */ }; static diff --git a/src/cmd/acme/dat.h b/src/cmd/acme/dat.h index d4438884..0bf82381 100644 --- a/src/cmd/acme/dat.h +++ b/src/cmd/acme/dat.h @@ -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*) */ diff --git a/src/cmd/acme/ecmd.c b/src/cmd/acme/ecmd.c index 6fef0698..ac578235 100644 --- a/src/cmd/acme/ecmd.c +++ b/src/cmd/acme/ecmd.c @@ -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); diff --git a/src/cmd/acme/edit.c b/src/cmd/acme/edit.c index 7bccd3ab..a6375f66 100644 --- a/src/cmd/acme/edit.c +++ b/src/cmd/acme/edit.c @@ -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(); diff --git a/src/cmd/acme/edit.h b/src/cmd/acme/edit.h index efa0b02e..211d58a2 100644 --- a/src/cmd/acme/edit.h +++ b/src/cmd/acme/edit.h @@ -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*); diff --git a/src/cmd/acme/elog.c b/src/cmd/acme/elog.c index 022d928e..0fd45ddd 100644 --- a/src/cmd/acme/elog.c +++ b/src/cmd/acme/elog.c @@ -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 diff --git a/src/cmd/acme/exec.c b/src/cmd/acme/exec.c index bd867c7c..1a4e097b 100644 --- a/src/cmd/acme/exec.c +++ b/src/cmd/acme/exec.c @@ -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; diff --git a/src/cmd/acme/file.c b/src/cmd/acme/file.c index cca91b2e..00d5d54c 100644 --- a/src/cmd/acme/file.c +++ b/src/cmd/acme/file.c @@ -33,7 +33,7 @@ struct Undo enum { - Undosize = sizeof(Undo)/sizeof(Rune), + Undosize = sizeof(Undo)/sizeof(Rune) }; File* diff --git a/src/cmd/acme/fsys.c b/src/cmd/acme/fsys.c index 033ce20d..9a7dbd10 100644 --- a/src/cmd/acme/fsys.c +++ b/src/cmd/acme/fsys.c @@ -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"); diff --git a/src/cmd/acme/mail/dat.h b/src/cmd/acme/mail/dat.h index 01d685be..a8321649 100644 --- a/src/cmd/acme/mail/dat.h +++ b/src/cmd/acme/mail/dat.h @@ -7,7 +7,7 @@ enum { STACK = 8192, EVENTSIZE = 256, - NEVENT = 5, + NEVENT = 5 }; struct Event diff --git a/src/cmd/acme/mail/mesg.c b/src/cmd/acme/mail/mesg.c index 0d894d93..1ba19c24 100644 --- a/src/cmd/acme/mail/mesg.c +++ b/src/cmd/acme/mail/mesg.c @@ -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 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); diff --git a/src/cmd/acme/mail/reply.c b/src/cmd/acme/mail/reply.c index 9d6fd35b..5dda0edc 100644 --- a/src/cmd/acme/mail/reply.c +++ b/src/cmd/acme/mail/reply.c @@ -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){ diff --git a/src/cmd/acme/scrl.c b/src/cmd/acme/scrl.c index 02340cc6..baf7ec79 100644 --- a/src/cmd/acme/scrl.c +++ b/src/cmd/acme/scrl.c @@ -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? */ } } diff --git a/src/cmd/acme/text.c b/src/cmd/acme/text.c index 44cb6544..9cfdb525 100644 --- a/src/cmd/acme/text.c +++ b/src/cmd/acme/text.c @@ -1174,7 +1174,7 @@ textsetselect(Text *t, uint q0, uint q1) */ enum { DELAY = 2, - MINMOVE = 4, + MINMOVE = 4 }; uint diff --git a/src/cmd/acme/wind.c b/src/cmd/acme/wind.c index 2f0328c8..510b4095 100644 --- a/src/cmd/acme/wind.c +++ b/src/cmd/acme/wind.c @@ -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; -- cgit v1.2.3