projects
/
mmh
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add test for empty sequence patch by c_14
[mmh]
/
uip
/
fmtdump.c
diff --git
a/uip/fmtdump.c
b/uip/fmtdump.c
index
a0e6e14
..
419d8ee
100644
(file)
--- a/
uip/fmtdump.c
+++ b/
uip/fmtdump.c
@@
-10,6
+10,8
@@
#include <h/fmt_scan.h>
#include <h/fmt_compile.h>
#include <h/scansbr.h>
#include <h/fmt_scan.h>
#include <h/fmt_compile.h>
#include <h/scansbr.h>
+#include <locale.h>
+#include <sysexits.h>
static struct swit switches[] = {
#define FORMSW 0
static struct swit switches[] = {
#define FORMSW 0
@@
-21,6
+23,8
@@
static struct swit switches[] = {
{ NULL, 0 }
};
{ NULL, 0 }
};
+char *version=VERSION;
+
/* for assignlabel */
static struct format *lvec[128];
static int lused = 0;
/* for assignlabel */
static struct format *lvec[128];
static int lused = 0;
@@
-60,49
+64,46
@@
main(int argc, char **argv)
switch (smatch(++cp, switches)) {
case AMBIGSW:
ambigsw(cp, switches);
switch (smatch(++cp, switches)) {
case AMBIGSW:
ambigsw(cp, switches);
- done(1);
+ exit(EX_USAGE);
case UNKWNSW:
case UNKWNSW:
- adios(NULL, "-%s unknown", cp);
+ adios(EX_USAGE, NULL, "-%s unknown", cp);
case HELPSW:
snprintf(buf, sizeof(buf), "%s [switches]",
invo_name);
print_help(buf, switches, 1);
case HELPSW:
snprintf(buf, sizeof(buf), "%s [switches]",
invo_name);
print_help(buf, switches, 1);
- done(1);
+ exit(argc == 2 ? EX_OK : EX_USAGE);
case VERSIONSW:
print_version(invo_name);
case VERSIONSW:
print_version(invo_name);
- done(1);
+ exit(argc == 2 ? EX_OK : EX_USAGE);
case FORMSW:
if (!(form = *argp++) || *form == '-')
case FORMSW:
if (!(form = *argp++) || *form == '-')
- adios(NULL, "missing argument to %s",
+ adios(EX_USAGE, NULL, "missing argument to %s",
argp[-2]);
continue;
}
}
if (form)
argp[-2]);
continue;
}
}
if (form)
- adios(NULL, "only one form at a time!");
+ adios(EX_USAGE, NULL, "only one form at a time!");
else
form = cp;
}
else
form = cp;
}
- /*
- ** Get new format string. Must be before chdir().
- */
- fmtstr = new_fs(form, FORMAT);
+ /* Set format string. Must be before chdir(). */
+ fmtstr = new_fs(form, scanformat);
fmt_compile(fmtstr, &fmt);
fmt_dump(fmt);
fmt_compile(fmtstr, &fmt);
fmt_dump(fmt);
- done(0);
- return 1;
+ return EX_OK;
}
static void
fmt_dump(struct format *fmth)
{
int i;
}
static void
fmt_dump(struct format *fmth)
{
int i;
- register struct format *fmt, *addr;
+ struct format *fmt, *addr;
/* Assign labels */
for (fmt = fmth; fmt; ++fmt) {
/* Assign labels */
for (fmt = fmth; fmt; ++fmt) {
@@
-130,7
+131,7
@@
fmt_dump(struct format *fmth)
static void
dumpone(struct format *fmt)
{
static void
dumpone(struct format *fmt)
{
- register int i;
+ int i;
if ((i = findlabel(fmt)) >= 0)
printf("L%d:", i);
if ((i = findlabel(fmt)) >= 0)
printf("L%d:", i);
@@
-304,6
+305,9
@@
dumpone(struct format *fmt)
case FT_LV_DAT:
printf(", value dat[%d]", fmt->f_value);
break;
case FT_LV_DAT:
printf(", value dat[%d]", fmt->f_value);
break;
+
+ case FT_LS_UNMAILTO:
+ break;
}
putchar('\n');
}
}
putchar('\n');
}
@@
-311,7
+315,7
@@
dumpone(struct format *fmt)
static int
findlabel(struct format *addr)
{
static int
findlabel(struct format *addr)
{
- register int i;
+ int i;
for (i = 0; i < lused; ++i)
if (addr == lvec[i])
for (i = 0; i < lused; ++i)
if (addr == lvec[i])
@@
-421,6
+425,7
@@
f_typestr(int t)
case FT_V_GT: return("V_GT");
case FT_V_MATCH: return("V_MATCH");
case FT_V_AMATCH: return("V_AMATCH");
case FT_V_GT: return("V_GT");
case FT_V_MATCH: return("V_MATCH");
case FT_V_AMATCH: return("V_AMATCH");
+ case FT_LS_UNMAILTO: return("LS_UNMAILTO");
default:
printf(buf, "/* ??? #%d */", t);
return(buf);
default:
printf(buf, "/* ??? #%d */", t);
return(buf);
@@
-435,7
+440,7
@@
f_typestr(int t)
static char *
c_typestr(int t)
{
static char *
c_typestr(int t)
{
- register int i;
+ int i;
static char buf[64];
buf[0] = '\0';
static char buf[64];
buf[0] = '\0';
@@
-452,7
+457,7
@@
c_typestr(int t)
static char *
c_flagsstr(int t)
{
static char *
c_flagsstr(int t)
{
- register int i;
+ int i;
static char buf[64];
buf[0] = '\0';
static char buf[64];
buf[0] = '\0';