/[monit]/monit/socket.c
ViewVC logotype

Diff of /monit/socket.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.48 by hauk, Wed Oct 19 00:50:24 2005 UTC revision 1.49 by hauk, Thu Oct 20 23:08:58 2005 UTC
# Line 58  Line 58 
58  /* ------------------------------------------------------------- Definitions */  /* ------------------------------------------------------------- Definitions */
59    
60  #define TYPE_LOCAL   0  #define TYPE_LOCAL   0
61  #define TYPE_ACCEPT 1  #define TYPE_ACCEPT  1
62  #define RBUFFER_SIZE 1024  #define RBUFFER_SIZE 1024
63    
64  struct Socket_T {  struct Socket_T {
# Line 312  void socket_free(Socket_T *S) { Line 312  void socket_free(Socket_T *S) {
312  }  }
313    
314    
315  /* -------------------------------------------------------------- Properties */  /* ------------------------------------------------------------ Properties */
316    
317    
318  /**  /**
# Line 413  const char *socket_get_remote_host(Socke Line 413  const char *socket_get_remote_host(Socke
413  }  }
414    
415    
416  /* ------------------------------------------------------------------ Public */  /* ---------------------------------------------------------------- Public */
417    
418    
419  /**  /**
# Line 489  int socket_write(Socket_T S, void *b, in Line 489  int socket_write(Socket_T S, void *b, in
489   * @param S A Socket_T object   * @param S A Socket_T object
490   * @return The byte read, or -1 if the end of the stream has been reached   * @return The byte read, or -1 if the end of the stream has been reached
491   */   */
492  int Socket_readByte(Socket_T S) {  int socket_read_byte(Socket_T S) {
493        
494    ASSERT(S);    ASSERT(S);
495        
# Line 513  int Socket_readByte(Socket_T S) { Line 513  int Socket_readByte(Socket_T S) {
513  int socket_read(Socket_T S, void *b, int size) {  int socket_read(Socket_T S, void *b, int size) {
514        
515    int c;    int c;
516    unsigned char *p= (unsigned char*)b;    unsigned char *p= b;
517        
518    ASSERT(S);    ASSERT(S);
519        
520    while((size-- > 0) && ((c= Socket_readByte(S)) >= 0)) {    while((size-- > 0) && ((c= socket_read_byte(S)) >= 0)) {
521      *p++= c;      *p++= c;
522    }    }
523        
# Line 543  char *socket_readln(Socket_T S, char *s, Line 543  char *socket_readln(Socket_T S, char *s,
543        
544    ASSERT(S);    ASSERT(S);
545        
546    while(--size && ((*s= Socket_readByte(S)) > 0)) {    while(--size && ((*s= socket_read_byte(S)) > 0)) {
547      if(*s++ == 10)      if(*s++ == 10)
548        break;        break;
549    }    }
# Line 572  void socket_reset(Socket_T S) { Line 572  void socket_reset(Socket_T S) {
572  }  }
573    
574    
575  /* ----------------------------------------------------------------- Private */  /* --------------------------------------------------------------- Private */
576    
577    
578  /*  /*

Legend:
Removed from v.1.48  
changed lines
  Added in v.1.49

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26