projects
/
mmh
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Added test of -nosequence to test-pick.
[mmh]
/
uip
/
ap.c
diff --git
a/uip/ap.c
b/uip/ap.c
index
a0f7f77
..
80ce8a3
100644
(file)
--- a/
uip/ap.c
+++ b/
uip/ap.c
@@
-42,11
+42,6
@@
static struct format *fmt;
static int dat[5];
/*
static int dat[5];
/*
- * prototypes
- */
-int sc_width (void); /* from termsbr.c */
-
-/*
* static prototypes
*/
static int process (char *, int, int);
* static prototypes
*/
static int process (char *, int, int);
@@
-87,10
+82,10
@@
main (int argc, char **argv)
snprintf (buf, sizeof(buf), "%s [switches] addrs ...",
invo_name);
print_help (buf, switches, 1);
snprintf (buf, sizeof(buf), "%s [switches] addrs ...",
invo_name);
print_help (buf, switches, 1);
- done (1);
+ done (0);
case VERSIONSW:
print_version (invo_name);
case VERSIONSW:
print_version (invo_name);
- done (1);
+ done (0);
case FORMSW:
if (!(form = *argp++) || *form == '-')
case FORMSW:
if (!(form = *argp++) || *form == '-')
@@
-138,7
+133,7
@@
main (int argc, char **argv)
if (width > WBUFSIZ)
width = WBUFSIZ;
fmt_norm = normalize;
if (width > WBUFSIZ)
width = WBUFSIZ;
fmt_norm = normalize;
- fmt_compile (nfs, &fmt);
+ fmt_compile (nfs, &fmt, 1);
dat[0] = 0;
dat[1] = 0;
dat[0] = 0;
dat[1] = 0;
@@
-149,6
+144,7
@@
main (int argc, char **argv)
for (addrp = 0; addrs[addrp]; addrp++)
status += process (addrs[addrp], width, normalize);
for (addrp = 0; addrs[addrp]; addrp++)
status += process (addrs[addrp], width, normalize);
+ fmt_free (fmt, 1);
done (status);
return 1;
}
done (status);
return 1;
}
@@
-188,17
+184,26
@@
process (char *arg, int length, int norm)
}
for (p = pq.pq_next; p; p = q) {
}
for (p = pq.pq_next; p; p = q) {
- FINDCOMP (cptr, "text");
- if (cptr)
+ cptr = fmt_findcomp ("text");
+ if (cptr) {
+ if (cptr->c_text)
+ free(cptr->c_text);
cptr->c_text = p->pq_text;
cptr->c_text = p->pq_text;
- FINDCOMP (cptr, "error");
- if (cptr)
+ p->pq_text = NULL;
+ }
+ cptr = fmt_findcomp ("error");
+ if (cptr) {
+ if (cptr->c_text)
+ free(cptr->c_text);
cptr->c_text = p->pq_error;
cptr->c_text = p->pq_error;
+ p->pq_error = NULL;
+ }
- fmt_scan (fmt, buffer, length, dat);
+ fmt_scan (fmt, buffer, sizeof buffer - 1, length, dat);
fputs (buffer, stdout);
fputs (buffer, stdout);
- free (p->pq_text);
+ if (p->pq_text)
+ free (p->pq_text);
if (p->pq_error)
free (p->pq_error);
q = p->pq_next;
if (p->pq_error)
free (p->pq_error);
q = p->pq_next;