File: compare.C

package info (click to toggle)
peruser 4b33-10
  • links: PTS
  • area: main
  • in suites: woody
  • size: 2,944 kB
  • ctags: 1,064
  • sloc: cpp: 22,397; perl: 2,733; makefile: 345; sh: 335
file content (31 lines) | stat: -rw-r--r-- 643 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <ctype.h>

int compare( const void *a, const void *b )
{
   char *a_pointer;

   a_pointer = *( char **)a;
   if ( *a_pointer == '"' || *a_pointer == '(' )
      ++a_pointer;

   if ( !strncasecmp( a_pointer, "Re:", 3 ))
      a_pointer += 3;

   a_pointer += strspn( a_pointer, " \t" );
      
   char *b_pointer;

   b_pointer = *( char **)b;
   if ( *b_pointer == '"' || *b_pointer == '(' )
      ++b_pointer;

   if ( !strncasecmp( b_pointer, "Re:", 3 ))
      b_pointer += 3;

   b_pointer += strspn( b_pointer, " \t" );

   return strcasecmp( a_pointer, b_pointer );
}