]> cygwin.com Git - cygwin-apps/setup.git/blob - version.cc
2002-02-19 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 static char nv[3][100];
36 static int idx = 0;
37 char *np;
38 const char *dp;
39 int i;
40
41 idx = (idx + 1) % 3;
42 np = nv[idx];
43
44 while (*v)
45 {
46 if (isdigit (*v))
47 {
48 for (dp = v; *dp && isdigit (*dp); dp++);
49 for (i = dp - v; i < 12; i++)
50 *np++ = '0';
51 while (v < dp)
52 *np++ = *v++;
53 }
54 else
55 *np++ = *v++;
56 }
57 *np++ = 0;
58 delete[] v;
59 return nv[idx];
60 }
This page took 0.033878 seconds and 5 git commands to generate.