]>
cygwin.com Git - cygwin-apps/setup.git/blob - package_source.cc
2 * Copyright (c) 2001, Robert Collins.
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.
9 * A copy of the GNU General Public License can be found at
12 * Written by Robert Collins <rbtcollins@hotmail.com>
16 /* this is the parent class for all package source (not source code - installation
17 * source as in http/ftp/disk file) operations.
21 static const char *cvsid
=
27 #include "package_source.h"
30 packagesource::set_canonical (char const *fn
)
34 canonical
= new char[strlen (fn
) + 1];
35 strcpy (canonical
, fn
);
37 /* The base is from the last '/' to the first '.' following the last - */
38 char const *bstart
= strchr (fn
, '/');
40 while (bstart
&& (tmp
= strchr (bstart
+ 1, '/')))
45 char const *bend
= strchr (bstart
, '-');
46 while (bend
&& (tmp
= strchr (bend
+ 1, '-')))
49 bend
= strchr (bend
, '.');
51 bend
= strchr (bstart
, '.');
54 bend
= strchr (bstart
, '\0');
55 char const *end
= strchr (fn
, '\0');
58 base
= new char[bend
- bstart
];
59 memcpy (base
, bstart
+ 1, bend
- bstart
- 1);
60 base
[bend
- bstart
- 1] = '\0';
64 filename
= new char[end
- bstart
];
65 memcpy (filename
, bstart
+ 1, end
- bstart
- 1);
66 filename
[end
- bstart
- 1] = '\0';
74 packagesource::set_cached (char const *fp
)
78 cached
= new char[strlen (fp
) + 1];
This page took 0.035484 seconds and 5 git commands to generate.