Main Page   Class Hierarchy   Alphabetical List   Data Structures   File List   Data Fields   Globals  

inetnull.cc

Go to the documentation of this file.
00001 
00002 /**********************************************************************
00003 * FILE: inetnull.cc
00004 * Purpose: This file provides the same set of functions as inetfile.cc
00005 * but with local file reading capabilities only.
00006 ***********************************************************************/
00007 
00008 #include "rcs_defs.hh"
00009 #include "inetfile.hh"
00010 
00011 #ifdef NO_STDIO
00012 #error This file can not be compiled without stdio, remove it from the project if stdio is not available.
00013 #endif
00014 
00015 #include <stdio.h>
00016 
00017 class INET_FILE
00018 {
00019 public:
00020   FILE * fp;
00021 };
00022 
00023 
00024 int
00025 inet_file_init (const char *agent_name, char *agent_version, int debug)
00026 {
00027   return 0;
00028 }
00029 
00030 
00031 INET_FILE *
00032 inet_file_open (const char *url, char *type)
00033 {
00034 
00035   FILE *fp = NULL;
00036   INET_FILE *inet_file = NULL;
00037 
00038   fp = fopen (url, type);
00039   if (NULL == fp)
00040     {
00041       return NULL;
00042     }
00043   inet_file = new INET_FILE;
00044   if (NULL != inet_file)
00045     {
00046       inet_file->fp = fp;
00047     }
00048   return inet_file;
00049 }
00050 
00051 
00052 
00053 char *
00054 inet_file_gets (char *str, int maxlen, INET_FILE * inet_file)
00055 {
00056   if (NULL == inet_file)
00057     {
00058       return NULL;
00059     }
00060   return fgets (str, maxlen, inet_file->fp);
00061 }
00062 
00063 
00064 int
00065 inet_file_close (INET_FILE * inet_file)
00066 {
00067   if (NULL != inet_file)
00068     {
00069       fclose (inet_file->fp);
00070       delete inet_file;
00071     }
00072   return 0;
00073 }
00074 
00075 int
00076 inet_file_eof (INET_FILE * inet_file)
00077 {
00078   if (NULL == inet_file)
00079     {
00080       return 1;
00081     }
00082   return feof (inet_file->fp);
00083 }
00084 
00085 
00086 int
00087 inet_file_exit ()
00088 {
00089   return 0;
00090 }
00091 
00092 
00093 RCS_EXPORT int
00094 inet_file_rewind (INET_FILE * ifp)
00095 {
00096   if (NULL == ifp)
00097     {
00098       return -1;
00099     }
00100   if (ifp->fp != NULL)
00101     {
00102       rewind (ifp->fp);
00103       return 0;
00104     }
00105 }

Generated on Sun Dec 2 15:56:49 2001 for rcslib by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001