File: postprocess_test.c

package info (click to toggle)
libtext-bibtex-perl 0.63-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 1,380 kB
  • sloc: ansic: 9,453; perl: 1,808; makefile: 6
file content (39 lines) | stat: -rw-r--r-- 979 bytes parent folder | download | duplicates (4)
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
32
33
34
35
36
37
38
39
#include <stdlib.h>
#include <stdio.h>
#include "my_dmalloc.h"
#include "btparse.h"

void postprocess (char *);

void postprocess (char * string)
{
   char * buf;

   buf = (char *) malloc (strlen(string) + 1);
   strcpy (buf, string);
   bt_postprocess_string (buf, 0);
   printf ("[%s] -> [%s] (no collapse)\n", string, buf);
   bt_postprocess_string (buf, BTO_COLLAPSE);
   printf ("[%s] -> [%s] (collapse)\n", string, buf);
   free (buf);
}

int main (void)
{
   postprocess ("vanilla string");
   postprocess ("nospace");
   postprocess ("inner    space");
   postprocess (" leading");
   postprocess ("    leading");
   postprocess ("trailing ");   
   postprocess ("trailing   ");   
   postprocess ("");   
   postprocess ("   leading&trailing   ");   
   postprocess ("   leading & trailing   ");   
   postprocess ("   leading   and internal");   
   postprocess ("internal    and trailing   ");   
   postprocess ("    everything   at   once   ");

   return 0;
}