close.c File Reference

#include "f2c.h"
#include "fio.h"
#include "stdlib.h"

Include dependency graph for close.c:

Go to the source code of this file.

Functions

int unlink (const char *)
integer f_clos (cllist *a)
void f_exit (void)
int flush_ (void)


Function Documentation

integer f_clos ( cllist a  ) 

Definition at line 30 of file close.c.

References a, b, Delete(), done, f__units, free(), MXUNIT, NULL, t_runc(), and unlink().

Referenced by f_exit(), and f_open().

00032 {       unit *b;
00033 
00034         if(a->cunit >= MXUNIT) return(0);
00035         b= &f__units[a->cunit];
00036         if(b->ufd==NULL)
00037                 goto done;
00038         if (b->uscrtch == 1)
00039                 goto Delete;
00040         if (!a->csta)
00041                 goto Keep;
00042         switch(*a->csta) {
00043                 default:
00044                 Keep:
00045                 case 'k':
00046                 case 'K':
00047                         if(b->uwrt == 1)
00048                                 t_runc((alist *)a);
00049                         if(b->ufnm) {
00050                                 fclose(b->ufd);
00051                                 free(b->ufnm);
00052                                 }
00053                         break;
00054                 case 'd':
00055                 case 'D':
00056                 Delete:
00057                         fclose(b->ufd);
00058                         if(b->ufnm) {
00059                                 unlink(b->ufnm); /*SYSDEP*/
00060                                 free(b->ufnm);
00061                                 }
00062                 }
00063         b->ufd=NULL;
00064  done:
00065         b->uend=0;
00066         b->ufnm=NULL;
00067         return(0);
00068         }

Here is the call graph for this function:

Here is the caller graph for this function:

void f_exit ( void   ) 

Definition at line 73 of file close.c.

References cllist::cerr, cllist::csta, cllist::cunit, f_clos(), i, MXUNIT, and NULL.

Referenced by exit_(), main(), s_1paus(), s_stop(), and sig_die().

00075 {       int i;
00076         static cllist xx;
00077         if (!xx.cerr) {
00078                 xx.cerr=1;
00079                 xx.csta=NULL;
00080                 for(i=0;i<MXUNIT;i++)
00081                 {
00082                         xx.cunit=i;
00083                         (void) f_clos(&xx);
00084                 }
00085         }
00086 }

Here is the call graph for this function:

Here is the caller graph for this function:

int flush_ ( void   ) 

Definition at line 91 of file close.c.

References f__units, i, MXUNIT, and NULL.

00093 {       int i;
00094         for(i=0;i<MXUNIT;i++)
00095                 if(f__units[i].ufd != NULL && f__units[i].uwrt)
00096                         fflush(f__units[i].ufd);
00097 return 0;
00098 }

int unlink ( const char *   ) 

Referenced by dynload(), f_clos(), main(), Sci_Delsym(), and Un_link_all().

Here is the caller graph for this function:


Generated on Sun Mar 4 15:04:11 2007 for Scilab [trunk] by  doxygen 1.5.1