summaryrefslogtreecommitdiff
path: root/do/close
diff options
context:
space:
mode:
Diffstat (limited to 'do/close')
-rw-r--r--do/close45
1 files changed, 0 insertions, 45 deletions
diff --git a/do/close b/do/close
deleted file mode 100644
index 2ddc1428b9..0000000000
--- a/do/close
+++ /dev/null
@@ -1,45 +0,0 @@
-bool
-do_close(stab,explicit)
-STAB *stab;
-bool explicit;
-{
- bool retval = FALSE;
- register STIO *stio;
- int status;
-
- if (!stab)
- stab = argvstab;
- if (!stab) {
- errno = EBADF;
- return FALSE;
- }
- stio = stab_io(stab);
- if (!stio) { /* never opened */
- if (dowarn && explicit)
- warn("Close on unopened file <%s>",stab_ename(stab));
- return FALSE;
- }
- if (stio->ifp) {
- if (stio->type == '|') {
- status = mypclose(stio->ifp);
- retval = (status == 0);
- statusvalue = (unsigned short)status & 0xffff;
- }
- else if (stio->type == '-')
- retval = TRUE;
- else {
- if (stio->ofp && stio->ofp != stio->ifp) { /* a socket */
- retval = (fclose(stio->ofp) != EOF);
- fclose(stio->ifp); /* clear stdio, fd already closed */
- }
- else
- retval = (fclose(stio->ifp) != EOF);
- }
- stio->ofp = stio->ifp = Nullfp;
- }
- if (explicit)
- stio->lines = 0;
- stio->type = ' ';
- return retval;
-}
-