~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to mysys/mf_pack.cc

  • Committer: Brian Aker
  • Date: 2009-11-24 02:06:37 UTC
  • mfrom: (1223.1.7 push)
  • Revision ID: brian@gaz-20091124020637-9gb65vj98x1arydm
Merge for staging.

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
 
12
12
   You should have received a copy of the GNU General Public License
13
13
   along with this program; if not, write to the Free Software
14
 
   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA */
15
 
 
16
 
#include "config.h"
17
 
 
18
 
#include "drizzled/internal/my_sys.h"
19
 
 
 
14
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
 
15
 
 
16
#include "mysys/mysys_priv.h"
 
17
#include <mystrings/m_string.h>
 
18
#include "my_static.h"
 
19
#ifdef HAVE_PWD_H
20
20
#include <pwd.h>
21
 
 
22
 
#include "drizzled/internal/m_string.h"
23
 
#include "my_static.h"
24
 
 
25
 
namespace drizzled
26
 
{
27
 
namespace internal
28
 
{
 
21
#endif
29
22
 
30
23
static char * expand_tilde(char * *path);
31
24
static size_t system_filename(char * to, const char *from);
231
224
{
232
225
  if (path[0][0] == FN_LIBCHAR)
233
226
    return home_dir;                    /* ~/ expanded to home */
234
 
  char *str,save;
235
 
  struct passwd *user_entry;
 
227
#ifdef HAVE_GETPWNAM
 
228
  {
 
229
    char *str,save;
 
230
    struct passwd *user_entry;
236
231
 
237
 
  if (!(str=strchr(*path,FN_LIBCHAR)))
238
 
    str= strchr(*path, '\0');
239
 
  save= *str; *str= '\0';
240
 
  user_entry=getpwnam(*path);
241
 
  *str=save;
242
 
  endpwent();
243
 
  if (user_entry)
244
 
  {
245
 
    *path=str;
246
 
    return user_entry->pw_dir;
 
232
    if (!(str=strchr(*path,FN_LIBCHAR)))
 
233
      str= strchr(*path, '\0');
 
234
    save= *str; *str= '\0';
 
235
    user_entry=getpwnam(*path);
 
236
    *str=save;
 
237
    endpwent();
 
238
    if (user_entry)
 
239
    {
 
240
      *path=str;
 
241
      return user_entry->pw_dir;
 
242
    }
247
243
  }
 
244
#endif
248
245
  return NULL;
249
246
}
250
247
 
309
306
  (void) strcpy(to + to_length,from+length);
310
307
  return (to);
311
308
} /* intern_filename */
312
 
 
313
 
} /* namespace internal */
314
 
} /* namespace drizzled */