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/sam/buff.c | 2 +- src/cmd/sam/cmd.c | 2 +- src/cmd/sam/error.c | 4 ++-- src/cmd/sam/errors.h | 4 ++-- src/cmd/sam/file.c | 2 +- src/cmd/sam/io.c | 2 +- src/cmd/sam/mesg.c | 4 ++-- src/cmd/sam/mesg.h | 4 ++-- src/cmd/sam/parse.h | 2 +- src/cmd/sam/sam.h | 12 +++++++----- src/cmd/sam/unix.c | 4 ++-- 11 files changed, 22 insertions(+), 20 deletions(-) (limited to 'src/cmd/sam') diff --git a/src/cmd/sam/buff.c b/src/cmd/sam/buff.c index 9a525b66..c32c2ef5 100644 --- a/src/cmd/sam/buff.c +++ b/src/cmd/sam/buff.c @@ -2,7 +2,7 @@ enum { - Slop = 100, /* room to grow with reallocation */ + Slop = 100 /* room to grow with reallocation */ }; static diff --git a/src/cmd/sam/cmd.c b/src/cmd/sam/cmd.c index aa356952..a5b636af 100644 --- a/src/cmd/sam/cmd.c +++ b/src/cmd/sam/cmd.c @@ -37,7 +37,7 @@ struct cmdtab cmdtab[]={ '|', 0, 0, 0, 0, aDot, 0, linex, plan9_cmd, '=', 0, 0, 0, 0, aDot, 0, linex, eq_cmd, 'c'|0x100,0, 0, 0, 0, aNo, 0, wordx, cd_cmd, - 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0 }; Cmd *parsecmd(int); Addr *compoundaddr(void); diff --git a/src/cmd/sam/error.c b/src/cmd/sam/error.c index d19b9621..eb4e48f4 100644 --- a/src/cmd/sam/error.c +++ b/src/cmd/sam/error.c @@ -50,7 +50,7 @@ static char *emsg[]={ "temporary file too large", "file is append-only", "no destination for plumb message", - "internal read error in buffer load", + "internal read error in buffer load" }; static char *wmsg[]={ /* warn_s */ @@ -63,7 +63,7 @@ static char *wmsg[]={ "null characters elided", "can't run pwd", "last char not newline", - "exit status not 0", + "exit status not 0" }; void diff --git a/src/cmd/sam/errors.h b/src/cmd/sam/errors.h index 7bf46ea1..5e88f492 100644 --- a/src/cmd/sam/errors.h +++ b/src/cmd/sam/errors.h @@ -48,7 +48,7 @@ typedef enum Err{ Etmpovfl, Eappend, Ecantplumb, - Ebufload, + Ebufload }Err; typedef enum Warn{ /* warn_s */ @@ -61,5 +61,5 @@ typedef enum Warn{ Wnulls, Wpwd, Wnotnewline, - Wbadstatus, + Wbadstatus }Warn; diff --git a/src/cmd/sam/file.c b/src/cmd/sam/file.c index bc3c0f4a..875a26c7 100644 --- a/src/cmd/sam/file.c +++ b/src/cmd/sam/file.c @@ -35,7 +35,7 @@ struct Merge enum { Maxmerge = 50, - Undosize = sizeof(Undo)/sizeof(Rune), + Undosize = sizeof(Undo)/sizeof(Rune) }; static Merge merge; diff --git a/src/cmd/sam/io.c b/src/cmd/sam/io.c index 95c2e0ce..8740c7ca 100644 --- a/src/cmd/sam/io.c +++ b/src/cmd/sam/io.c @@ -223,7 +223,7 @@ connectto(char *machine, char **argv) char **av; int ac; - // count args + /* count args */ for(av = argv; *av; av++) ; av = malloc(sizeof(char*)*((av-argv) + 5)); diff --git a/src/cmd/sam/mesg.c b/src/cmd/sam/mesg.c index 8edd4b2a..01016ce9 100644 --- a/src/cmd/sam/mesg.c +++ b/src/cmd/sam/mesg.c @@ -46,7 +46,7 @@ char *hname[] = { [Hsnarflen] "Hsnarflen", [Hack] "Hack", [Hexit] "Hexit", - [Hplumb] "Hplumb", + [Hplumb] "Hplumb" }; char *tname[] = { @@ -72,7 +72,7 @@ char *tname[] = { [Tsetsnarf] "Tsetsnarf", [Tack] "Tack", [Texit] "Texit", - [Tplumb] "Tplumb", + [Tplumb] "Tplumb" }; void diff --git a/src/cmd/sam/mesg.h b/src/cmd/sam/mesg.h index 6e34f664..23441499 100644 --- a/src/cmd/sam/mesg.h +++ b/src/cmd/sam/mesg.h @@ -34,7 +34,7 @@ typedef enum Tmesg Tack, /* acknowledge Hack */ Texit, /* exit */ Tplumb, /* send plumb message */ - TMAX, + TMAX }Tmesg; /* * Messages originating at the host @@ -67,7 +67,7 @@ typedef enum Hmesg Hack, /* request acknowledgement */ Hexit, Hplumb, /* return plumb message to terminal - version 1 */ - HMAX, + HMAX }Hmesg; typedef struct Header{ uchar type; /* one of the above */ diff --git a/src/cmd/sam/parse.h b/src/cmd/sam/parse.h index 12f293f2..d5fabf14 100644 --- a/src/cmd/sam/parse.h +++ b/src/cmd/sam/parse.h @@ -48,7 +48,7 @@ extern struct cmdtab{ enum Defaddr{ /* default addresses */ aNo, aDot, - aAll, + aAll }; int nl_cmd(File*, Cmd*), a_cmd(File*, Cmd*), b_cmd(File*, Cmd*); diff --git a/src/cmd/sam/sam.h b/src/cmd/sam/sam.h index eefb4b34..fa86efd1 100644 --- a/src/cmd/sam/sam.h +++ b/src/cmd/sam/sam.h @@ -42,7 +42,7 @@ enum State { Clean = ' ', Dirty = '\'', - Unread = '-', + Unread = '-' }; struct Range @@ -97,7 +97,7 @@ enum Maxblock = 8*1024, BUFSIZE = Maxblock, /* size from fbufalloc() */ - RBUFSIZE = BUFSIZE/sizeof(Rune), + RBUFSIZE = BUFSIZE/sizeof(Rune) }; @@ -108,7 +108,7 @@ enum Insert = 'i', Filename = 'f', Dot = 'D', - Mark = 'm', + Mark = 'm' }; struct Block @@ -168,10 +168,12 @@ struct File int mod; /* file appears modified in menu */ char rescuing; /* sam exiting; this file unusable */ +#if 0 // Text *curtext; /* most recently used associated text */ // Text **text; /* list of associated texts */ // int ntext; // int dumpid; /* used in dumping zeroxed windows */ +#endif Posn hiposn; /* highest address touched this Mod */ Address dot; /* current position */ @@ -187,10 +189,10 @@ struct File long prevseq; int prevmod; }; -//File* fileaddtext(File*, Text*); +/*File* fileaddtext(File*, Text*); */ void fileclose(File*); void filedelete(File*, uint, uint); -//void filedeltext(File*, Text*); +/*void filedeltext(File*, Text*); */ void fileinsert(File*, uint, Rune*, uint); uint fileload(File*, uint, int, int*); void filemark(File*); diff --git a/src/cmd/sam/unix.c b/src/cmd/sam/unix.c index 2505f854..a745a5bc 100644 --- a/src/cmd/sam/unix.c +++ b/src/cmd/sam/unix.c @@ -128,7 +128,7 @@ statfd(int fd, ulong *dev, uvlong *id, long *time, long *length, long *appendonl void hup(int sig) { - panicking = 1; // ??? + panicking = 1; /* ??? */ rescue(); exit(1); } @@ -137,7 +137,7 @@ int notify(void(*f)(void *, char *)) { signal(SIGINT, SIG_IGN); - signal(SIGPIPE, SIG_IGN); // XXX - bpipeok? + signal(SIGPIPE, SIG_IGN); /* XXX - bpipeok? */ signal(SIGHUP, hup); return 1; } -- cgit v1.2.3