X-Git-Url: http://git.marmaro.de/?a=blobdiff_plain;ds=sidebyside;f=uip%2Fwhatnow.c;fp=uip%2Fwhatnow.c;h=914e2989cb6d08faa460cc640138e7320f9b5b0c;hb=6e5da31c92f5a3fa38e010052c5a7743bfe1cf11;hp=ff9d84ce8322e301d565870d3ff80705a180da63;hpb=3c2d2abb007c8d97c6a09d9be0e70367518afe30;p=mmh diff --git a/uip/whatnow.c b/uip/whatnow.c index ff9d84c..914e298 100644 --- a/uip/whatnow.c +++ b/uip/whatnow.c @@ -302,32 +302,28 @@ main(int argc, char **argv) ** working directory to relative path names. ** Add the attachment annotation to the draft. */ - if ((f = popen_in_dir(cwd, buf, "r"))) { - while (fgets(shell, sizeof(shell), f)) { - *(strchr(shell, '\n')) = '\0'; - - if (*shell == '/') - sprintf(file, "%s", shell); - else { - sprintf(file, "%s/%s", cwd, - shell); - } - if (execprogl("anno", "anno", - "-nodate", - "-append", "-comp", - attach_hdr, "-text", - file, drft, - (char *)NULL) - != 0) { - advise(NULL, "Could not add attachment header."); - } - } - - pclose(f); - } else { + if (!(f = popen_in_dir(cwd, buf, "r"))) { advise("popen", "could not get file from shell"); + break; } + while (fgets(shell, sizeof(shell), f)) { + *(strchr(shell, '\n')) = '\0'; + + if (*shell == '/') + sprintf(file, "%s", shell); + else { + sprintf(file, "%s/%s", cwd, shell); + } + if (execprogl("anno", "anno", + "-nodate", "-append", + "-comp", attach_hdr, + "-text", file, + drft, (char *)NULL) != 0) { + advise(NULL, "Could not add attachment header."); + } + } + pclose(f); break; case DETACHCMDSW: