]> cygwin.com Git - cygwin-apps/setup.git/blob - version.cc
2002-07-01 Robert Collins <rbtcollins@hotmail.com>
[cygwin-apps/setup.git] / version.cc
1 /*
2 * Copyright (c) 2000, Red Hat, Inc.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * A copy of the GNU General Public License can be found at
10 * http://www.gnu.org/
11 *
12 * Written by DJ Delorie <dj@cygnus.com>
13 *
14 */
15
16 #if 0
17 static const char *cvsid =
18 "\n%%% $Id$\n";
19 #endif
20
21 #include "win32.h"
22
23 #include <stdio.h>
24 #include <stdlib.h>
25 #include <unistd.h>
26 #include <ctype.h>
27
28 #include "port.h"
29 #include "version.h"
30
31 String
32 canonicalize_version (String const &aString)
33 {
34 char *v =aString.cstr();
35 char *savev = v;
36 static char nv[3][100];
37 static int idx = 0;
38 char *np;
39 const char *dp;
40 int i;
41
42 idx = (idx + 1) % 3;
43 np = nv[idx];
44
45 while (*v)
46 {
47 if (isdigit (*v))
48 {
49 for (dp = v; *dp && isdigit (*dp); dp++);
50 for (i = dp - v; i < 12; i++)
51 *np++ = '0';
52 while (v < dp)
53 *np++ = *v++;
54 }
55 else
56 *np++ = *v++;
57 }
58 *np++ = 0;
59 delete[] savev;
60 return nv[idx];
61 }
This page took 0.034878 seconds and 5 git commands to generate.