AcePerl
view release on metacpan or search on metacpan
acelib/filsubs.c view on Meta::CPAN
/* File: filsubs.c
* Author: Jean Thierry-Mieg (mieg@mrc-lmb.cam.ac.uk)
* Copyright (C) J Thierry-Mieg and R Durbin, 1991
*-------------------------------------------------------------------
* This file is part of the ACEDB genome database package, written by
* Richard Durbin (MRC LMB, UK) rd@mrc-lmb.cam.ac.uk, and
* Jean Thierry-Mieg (CRBM du CNRS, France) mieg@kaa.cnrs-mop.fr
*
* Description:
* cross platform file system routines
*
* Exported functions:
* HISTORY:
* Last edited: Jan 5 16:36 1999 (fw)
* * Dec 8 10:20 1998 (fw): new function filAge to determine time since
* last modification of file
* * Oct 22 16:17 1998 (edgrif): Replace unsafe strtok with strstr.
* * Oct 15 11:47 1998 (fw): include messSysErrorText in some messges
* * Sep 30 09:37 1998 (edgrif): Replaced my strdup with acedb strnew.
* * Sep 9 14:07 1998 (edgrif): Add filGetFilename routine that will
* return the filename given a pathname
* (NOT the same as the UNIX basename).
* * DON'T KNOW WHO DID THE BELOW..assume Richard Bruskiewich (edgrif)
* - fix root path detection for default drives (in WIN32)
* * Oct 8 23:34 1996 (rd)
* filDirectory() returns a sorted Array of character
* strings of the names of files, with specified ending
* and spec's, listed in a given directory "dirName";
* If !dirName or directory is inaccessible,
* the function returns 0
* * Jun 6 17:58 1996 (rd)
* * Mar 24 02:42 1995 (mieg)
* * Feb 13 16:11 1993 (rd): allow "" endName, and call getwd if !*dname
* * Sep 14 15:57 1992 (mieg): sorted alphabetically
* * Sep 4 13:10 1992 (mieg): fixed NULL used improperly when 0 is meant
* * Jul 20 09:35 1992 (aochi): Add directory names to query file chooser
* * Jan 11 01:59 1992 (mieg): If file has no ending i suppress the point
* * Nov 29 19:15 1991 (mieg): If file had no ending, we were losing the
last character in dirDraw()
* Created: Fri Nov 29 19:15:34 1991 (mieg)
*-------------------------------------------------------------------
*/
/* $Id: filsubs.c,v 1.2 2002/11/24 19:27:20 lstein Exp $ */
#include "regular.h"
#include "mytime.h"
#include "call.h" /* for callScript (to mail stuff) */
/********************************************************************/
#include "mydirent.h"
#if !defined(WIN32)
/* UNIX */
#include <sys/file.h>
#define HOME_DIR_ENVP "HOME"
#define ABSOLUTE_PATH(path) *path == SUBDIR_DELIMITER
#else /* Utility macros for WIN32 only */
#include <tchar.h>
#include <direct.h> /* for getwcd() and _getdrive() */
/* simple, single letter logical drives assumed here */
static const char *DRIVES = "abcdefghijklmnopqrstuvwxyz";
#define DRIVE_NO(drv) ((drv)-'a'+1)
#define GET_CURRENT_DRIVE *( DRIVES + _getdrive() - 1 )
#define HOME_DIR_ENVP "HOMEPATH"
#include <ctype.h> /* for isalpha() */
#define ABSOLUTE_PATH(path) \
( run in 0.736 second using v1.01-cache-2.11-cpan-6aa56a78535 )