Skip to content

Commit

Permalink
fix: reinstated interpretation of NULL file name as stdin, so dctimes…
Browse files Browse the repository at this point in the history
…tep works
  • Loading branch information
Gregungory committed Jan 22, 2021
1 parent 5529d7a commit 7cc1bd2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
10 changes: 6 additions & 4 deletions src/util/cmatrix.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef lint
static const char RCSid[] = "$Id: cmatrix.c,v 2.32 2021/01/19 23:32:00 greg Exp $";
static const char RCSid[] = "$Id: cmatrix.c,v 2.33 2021/01/22 16:19:15 greg Exp $";
#endif
/*
* Color matrix routines.
Expand Down Expand Up @@ -219,11 +219,13 @@ cm_load(const char *inspec, int nrows, int ncols, int dtype)
COLOR scale;
CMATRIX *cm;

if (!inspec || !*inspec)
if (!inspec)
inspec = stdin_name;
else if (!*inspec)
return(NULL);
if (inspec == stdin_name)
if (inspec == stdin_name) { /* reading from stdin? */
fp = stdin;
else if (inspec[0] == '!') {
} else if (inspec[0] == '!') {
fp = popen(inspec+1, "r");
if (!fp) {
sprintf(errmsg, "cannot start command '%s'", inspec);
Expand Down
6 changes: 4 additions & 2 deletions src/util/rmatrix.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef lint
static const char RCSid[] = "$Id: rmatrix.c,v 2.46 2021/01/19 23:32:00 greg Exp $";
static const char RCSid[] = "$Id: rmatrix.c,v 2.47 2021/01/22 16:19:15 greg Exp $";
#endif
/*
* General matrix operations.
Expand Down Expand Up @@ -209,7 +209,9 @@ rmx_load(const char *inspec, RMPref rmp)
RMATRIX dinfo;
RMATRIX *dnew;

if (!inspec || !*inspec)
if (!inspec)
inspec = stdin_name;
else if (!*inspec)
return(NULL);
if (inspec == stdin_name) { /* reading from stdin? */
fp = stdin;
Expand Down

0 comments on commit 7cc1bd2

Please sign in to comment.