title: Removing single dot path names in URL in C
body: <p>I'm making a function in an apache module which is supposed to fix URLs that are thrown at it. Currently I'm trying to remove single dot path names.</p>
  
  <p>For example, if my URL is:</p>
  
  <pre><code>http://example.com/1/./2/./3/./4.php
  </code></pre>
  
  <p>Then I want the URL to be:</p>
  
  <pre><code>http://example.com/1/2/3/4.php
  </code></pre>
  
  <p>However I'm stuck with the logic. I'm using pointers in an effort to make this function run as fast as possible. I'm confused at the logic I should apply at the lines with <code>//?</code> added to the end of them.</p>
  
  <p>Can someone give me advice on how to proceed? Even if its some hidden manual online? I searched bing and google for answers with no success.</p>
  
  <pre><code>static long fixurl(char *u){
    char u1[10000];
    char *u11=u1,*uu1=u;
    long ct=0,fx=0;
    while (*uu1){
      *u11=*uu1;
      if (*uu1=='/'){
        ct++;
        if (ct &gt;=2){
          uu1++;
          break;
        }
      } else {
        ct=0;
      }
    }
  
    while (*uu1){ 
      if (*uu1!='/') { //?
        if (*uu1!='.') {
          *u11=*uu1;
           u11++;
        } //?
      } //?
      uu1++;
    }
  
    *u11='\0';
    strcpy(u,u1);
    return fx;
  }
  </code></pre>