]> cygwin.com Git - cygwin-apps/setup.git/blame - version.cc
2004-12-25 Max Bowsher <maxb@ukf.net>
[cygwin-apps/setup.git] / version.cc
CommitLineData
de6a1a64
RC
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
17static 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
3c054baf
RC
28#include "version.h"
29
30String
31canonicalize_version (String const &aString)
de6a1a64 32{
768d880e 33 const char *v =aString.cstr_oneuse();
de6a1a64
RC
34 static char nv[3][100];
35 static int idx = 0;
36 char *np;
37 const char *dp;
38 int i;
39
40 idx = (idx + 1) % 3;
41 np = nv[idx];
42
43 while (*v)
44 {
45 if (isdigit (*v))
46 {
47 for (dp = v; *dp && isdigit (*dp); dp++);
48 for (i = dp - v; i < 12; i++)
49 *np++ = '0';
50 while (v < dp)
51 *np++ = *v++;
52 }
53 else
54 *np++ = *v++;
55 }
56 *np++ = 0;
57 return nv[idx];
58}
This page took 0.040259 seconds and 5 git commands to generate.