httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jim Jagielski <...@jaguNET.com>
Subject mod_imap.c - sscanf workaround patch
Date Tue, 28 May 1996 23:46:23 GMT
Here's an ugly patch that works around the lack of "%n" in non-ANSI versions
of sscanf(). Using this patch, I've finally gotten the imap module to
work (yee-freaking-Ha!)

Comments welcome!

===========
Index: apache/src/Makefile.tmpl
===================================================================
RCS file: /export/home/cvs/apache/src/Makefile.tmpl,v
retrieving revision 1.11
diff -c -r1.11 Makefile.tmpl
*** Makefile.tmpl	1996/05/27 22:34:06	1.11
--- Makefile.tmpl	1996/05/28 23:42:33
***************
*** 35,41 ****
  		Configuration Configure Makefile.tmpl Makefile *.h *.c
  
  # Work around broken compilers
! http_bprintf.o:
  	$(CC) -c $(CFLAGS) $(AUX_CFLAGS) $(BROKEN_BPRINTF_FLAGS) $<
  
  #Dependencies
--- 35,41 ----
  		Configuration Configure Makefile.tmpl Makefile *.h *.c
  
  # Work around broken compilers
! http_bprintf.o: http_bprintf.c
  	$(CC) -c $(CFLAGS) $(AUX_CFLAGS) $(BROKEN_BPRINTF_FLAGS) $<
  
  #Dependencies
Index: apache/src/mod_imap.c
===================================================================
RCS file: /export/home/cvs/apache/src/mod_imap.c,v
retrieving revision 1.6
diff -c -r1.6 mod_imap.c
*** mod_imap.c	1996/04/22 09:13:10	1.6
--- mod_imap.c	1996/05/28 23:42:36
***************
*** 269,275 ****
  
  double get_x_coord(char *args) 
  {
!   char *endptr = NULL;
    double x_coord = -1;    /* -1 is returned if no coordinate is given */
  
    if (args == NULL)
--- 269,275 ----
  
  double get_x_coord(char *args) 
  {
!   char *endptr = "";      /* we want it non-null */
    double x_coord = -1;    /* -1 is returned if no coordinate is given */
  
    if (args == NULL)
***************
*** 288,294 ****
  
  double get_y_coord(char *args) 
  {
!   char *endptr = NULL;
    char *start_of_y = NULL;
    double y_coord = -1;    /* -1 is returned on error */
  
--- 288,294 ----
  
  double get_y_coord(char *args) 
  {
!   char *endptr = "";      /* we want it non-null */
    char *start_of_y = NULL;
    double y_coord = -1;    /* -1 is returned on error */
  
***************
*** 659,668 ****
      } /* blank lines and comments are ignored if we aren't printing a menu */
  
  
!     if (sscanf(input, "%s %s %n", directive, value, &chars_read) != 2) {
        continue;                           /* make sure we read two fields */
      }
!     string_pos += chars_read;
      
      if ( ! strncasecmp(directive, "base", 4 ) ) {       /* base, base_uri */
        imap_url(r, NULL, value, base);
--- 659,674 ----
      } /* blank lines and comments are ignored if we aren't printing a menu */
  
  
!     if (sscanf(input, "%s %s", directive, value) != 2) {
        continue;                           /* make sure we read two fields */
      }
!     /* Now skip what we just read */
!     while (!(isspace(*string_pos)))	/* past directive */
! 	string_pos++;
!     while (isspace(*string_pos))	/* and whitespace */
! 	string_pos++;
!     while (!(isspace(*string_pos)))	/* and value... have to watch it */
! 	string_pos++;			/* can have punctuation and stuff */
      
      if ( ! strncasecmp(directive, "base", 4 ) ) {       /* base, base_uri */
        imap_url(r, NULL, value, base);
***************
*** 686,694 ****
  
      vertex = 0;
      while ( vertex < MAXVERTS &&  
! 	   sscanf(string_pos, "%lf,%lf %n", &pointarray[vertex][X], 
! 		  &pointarray[vertex][Y], &chars_read)   == 2) {
!       string_pos += chars_read;
        vertex++;
      }                /* so long as there are more vertices to read, and
  			we have room, read them in.  We start where we left
--- 692,706 ----
  
      vertex = 0;
      while ( vertex < MAXVERTS &&  
! 	   sscanf(string_pos, "%lf,%lf", &pointarray[vertex][X], 
! 		  &pointarray[vertex][Y])   == 2) {
!       while(isspace(*string_pos))	/* past whitespace */
! 	string_pos++;
!       while(isdigit(*string_pos))	/* and the 1st number */
! 	string_pos++;
!       string_pos++;			/* skip the ',' */
!       while(isdigit(*string_pos))	/* 2nd number */
! 	string_pos++;
        vertex++;
      }                /* so long as there are more vertices to read, and
  			we have room, read them in.  We start where we left
-- 
Jim Jagielski  << jim@jaguNET.com >>   |      "That's a Smith & Wesson,
  **  jaguNET Access Services  **      |       and you've had your six" 
      Email: info@jaguNET.com          |             - James Bond
++    http://www.jaguNET.com/         +++      Voice/Fax: 410-931-3157       ++

Mime
View raw message