Use gcc -ansi -pedantic in 9c. Fix many non-C89-isms.
diff --git a/src/cmd/sam/buff.c b/src/cmd/sam/buff.c
index 9a525b6..c32c2ef 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 aa35695..a5b636a 100644
--- a/src/cmd/sam/cmd.c
+++ b/src/cmd/sam/cmd.c
@@ -37,7 +37,7 @@
'|', 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 d19b962..eb4e48f 100644
--- a/src/cmd/sam/error.c
+++ b/src/cmd/sam/error.c
@@ -50,7 +50,7 @@
"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 @@
"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 7bf46ea..5e88f49 100644
--- a/src/cmd/sam/errors.h
+++ b/src/cmd/sam/errors.h
@@ -48,7 +48,7 @@
Etmpovfl,
Eappend,
Ecantplumb,
- Ebufload,
+ Ebufload
}Err;
typedef enum Warn{
/* warn_s */
@@ -61,5 +61,5 @@
Wnulls,
Wpwd,
Wnotnewline,
- Wbadstatus,
+ Wbadstatus
}Warn;
diff --git a/src/cmd/sam/file.c b/src/cmd/sam/file.c
index bc3c0f4..875a26c 100644
--- a/src/cmd/sam/file.c
+++ b/src/cmd/sam/file.c
@@ -35,7 +35,7 @@
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 95c2e0c..8740c7c 100644
--- a/src/cmd/sam/io.c
+++ b/src/cmd/sam/io.c
@@ -223,7 +223,7 @@
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 8edd4b2..01016ce 100644
--- a/src/cmd/sam/mesg.c
+++ b/src/cmd/sam/mesg.c
@@ -46,7 +46,7 @@
[Hsnarflen] "Hsnarflen",
[Hack] "Hack",
[Hexit] "Hexit",
- [Hplumb] "Hplumb",
+ [Hplumb] "Hplumb"
};
char *tname[] = {
@@ -72,7 +72,7 @@
[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 6e34f66..2344149 100644
--- a/src/cmd/sam/mesg.h
+++ b/src/cmd/sam/mesg.h
@@ -34,7 +34,7 @@
Tack, /* acknowledge Hack */
Texit, /* exit */
Tplumb, /* send plumb message */
- TMAX,
+ TMAX
}Tmesg;
/*
* Messages originating at the host
@@ -67,7 +67,7 @@
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 12f293f..d5fabf1 100644
--- a/src/cmd/sam/parse.h
+++ b/src/cmd/sam/parse.h
@@ -48,7 +48,7 @@
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 eefb4b3..fa86efd 100644
--- a/src/cmd/sam/sam.h
+++ b/src/cmd/sam/sam.h
@@ -42,7 +42,7 @@
{
Clean = ' ',
Dirty = '\'',
- Unread = '-',
+ Unread = '-'
};
struct Range
@@ -97,7 +97,7 @@
Maxblock = 8*1024,
BUFSIZE = Maxblock, /* size from fbufalloc() */
- RBUFSIZE = BUFSIZE/sizeof(Rune),
+ RBUFSIZE = BUFSIZE/sizeof(Rune)
};
@@ -108,7 +108,7 @@
Insert = 'i',
Filename = 'f',
Dot = 'D',
- Mark = 'm',
+ Mark = 'm'
};
struct Block
@@ -168,10 +168,12 @@
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 @@
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 2505f85..a745a5b 100644
--- a/src/cmd/sam/unix.c
+++ b/src/cmd/sam/unix.c
@@ -128,7 +128,7 @@
void
hup(int sig)
{
- panicking = 1; // ???
+ panicking = 1; /* ??? */
rescue();
exit(1);
}
@@ -137,7 +137,7 @@
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;
}