~mdw
/
xtoys
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
New source file for manipulating atom-valued window properties.
[xtoys]
/
xgetline.c
diff --git
a/xgetline.c
b/xgetline.c
index
91b1f1e
..
322f7aa
100644
(file)
--- a/
xgetline.c
+++ b/
xgetline.c
@@
-1,6
+1,6
@@
/* -*-c-*-
*
/* -*-c-*-
*
- * $Id: xgetline.c,v 1.
8 1998/12/16 19:58:53
mdw Exp $
+ * $Id: xgetline.c,v 1.
10 1999/05/21 22:09:19
mdw Exp $
*
* Fetch a line of text from the user
*
*
* Fetch a line of text from the user
*
@@
-29,6
+29,12
@@
/*----- Revision history --------------------------------------------------*
*
* $Log: xgetline.c,v $
/*----- Revision history --------------------------------------------------*
*
* $Log: xgetline.c,v $
+ * Revision 1.10 1999/05/21 22:09:19 mdw
+ * Take advantage of new dynamic string macros.
+ *
+ * Revision 1.9 1999/05/05 18:54:37 mdw
+ * Keep blank lines out of the history list.
+ *
* Revision 1.8 1998/12/16 19:58:53 mdw
* Stop the dropdown list from dropping down when you press enter.
*
* Revision 1.8 1998/12/16 19:58:53 mdw
* Stop the dropdown list from dropping down when you press enter.
*
@@
-344,9
+350,8
@@
int main(int argc, char *argv[])
hist = 0;
if (fp) {
hist = 0;
if (fp) {
- dstr d;
+ dstr d
= DSTR_INIT
;
- dstr_create(&d);
while (dstr_putline(&d, fp) != EOF) {
hist = g_list_append(hist, xstrdup(d.buf));
dstr_destroy(&d);
while (dstr_putline(&d, fp) != EOF) {
hist = g_list_append(hist, xstrdup(d.buf));
dstr_destroy(&d);
@@
-430,10
+435,11
@@
int main(int argc, char *argv[])
/* --- If history is enabled, output a new history file --- *
*
/* --- If history is enabled, output a new history file --- *
*
- * If the first entry was accepted verbatim, don't bother.
+ * If the first entry was accepted verbatim, or if the entry is a blank
+ * line, don't bother.
*/
*/
- if (f & f_history && !(hist && strcmp(p, hist->data) == 0)) {
+ if (f & f_history &&
*p &&
!(hist && strcmp(p, hist->data) == 0)) {
int fd;
FILE *fp;
int i;
int fd;
FILE *fp;
int i;
@@
-450,7
+456,7
@@
int main(int argc, char *argv[])
fputc('\n', fp);
for (i = 1, g = hist; (histmax < 1 || i < histmax) && g; g = g->next) {
fputc('\n', fp);
for (i = 1, g = hist; (histmax < 1 || i < histmax) && g; g = g->next) {
- if (strcmp(g->data, p) != 0) {
+ if (
*(char *)g->data &&
strcmp(g->data, p) != 0) {
fputs(g->data, fp);
fputc('\n', fp);
i++;
fputs(g->data, fp);
fputc('\n', fp);
i++;