~ubuntu-branches/ubuntu/gutsy/xmedcon/gutsy

« back to all changes in this revision

Viewing changes to source/m-files.c

  • Committer: Bazaar Package Importer
  • Author(s): Roland Marcus Rutschmann
  • Date: 2004-11-11 15:53:37 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20041111155337-tgza2ptocg0g3wsj
Tags: 0.9.8.1-1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
 *                MdcNewExt()           - Create filename extension        *
30
30
 *                MdcPrefix()           - Create filename prefix           * 
31
31
 *                MdcGetPrefixNr()      - Get proper filename prefix       *
32
 
 *                MdcGetLastPathSlash() - Get pointer to last path-slash   * 
 
32
 *                MdcGetLastPathDelim() - Get pointer last path delimiter  * 
33
33
 *                MdcMySplitPath()      - Split path from filename         *
34
34
 *                MdcMyMergePath()      - Merge path to filename           *
35
35
 *                MdcNewExt()           - Give filename a new extension    *
47
47
 *                MdcGetHeartRate()     - Get heart rate from gated data   *
48
48
 *                                                                         *
49
49
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
50
 
/* $Id: m-files.c,v 1.87 2004/05/09 22:48:03 enlf Exp $ 
 
50
/* $Id: m-files.c,v 1.91 2004/09/25 22:26:55 enlf Exp $ 
51
51
 */
52
52
 
53
53
/*
914
914
{
915
915
  char *p;
916
916
 
917
 
  p = MdcGetLastPathSlash(path);
 
917
  p = MdcGetLastPathDelim(path);
918
918
 
919
919
  if ( p == NULL ) return(path);
920
920
 
1161
1161
  MdcPrntScrn("\tRENAME FILE\n");
1162
1162
  MdcPrintLine('-',MDC_FULL_LENGTH);
1163
1163
 
1164
 
  pbegin = MdcGetLastPathSlash(name);    /* get the basename  */
 
1164
  pbegin = MdcGetLastPathDelim(name);    /* point to basename */
1165
1165
 
1166
1166
  if (pbegin == NULL) pbegin = name;
1167
1167
  else pbegin = pbegin + 1;
1181
1181
 
1182
1182
}
1183
1183
 
1184
 
char *MdcGetLastPathSlash(char *path)
 
1184
/* always check for both path delimiters */
 
1185
char *MdcGetLastPathDelim(char *path)
1185
1186
{
1186
1187
  char *p=NULL;
1187
1188
 
1188
1189
  if (path == NULL) return NULL;
1189
1190
 
1190
 
#ifdef MDC_DOS
 
1191
  p = (char *)strrchr(path,'/');
 
1192
  if (p != NULL) return(p);
 
1193
 
1191
1194
  p = (char *)strrchr(path,'\\');
1192
 
  if (p != NULL) return(p);
1193
 
#endif
1194
 
  p = (char *)strrchr(path,'/');
1195
1195
  return(p);
1196
1196
 
1197
1197
}
1201
1201
{
1202
1202
  char *p=NULL;
1203
1203
 
1204
 
  p = MdcGetLastPathSlash(path);       /* last slash becomes '\0'      */
 
1204
  p = MdcGetLastPathDelim(path);       /* last path delim becomes '\0'       */
1205
1205
 
1206
1206
  if ( p == NULL ) {
1207
1207
    *fname=&path[0];
1215
1215
}
1216
1216
 
1217
1217
void MdcMyMergePath(char path[], char *dir, char **fname) 
1218
 
                                      /* first '\0' becomes slash again */
 
1218
                                      /* first '\0' becomes path delim again */
1219
1219
{
1220
1220
  char *p;
1221
1221
 
1222
1222
  if ( dir != NULL ) {
1223
1223
    p=(char *)strchr(path,'\0');
1224
 
    if ( p != NULL )
1225
 
#ifdef MDC_DOS
1226
 
      *p='\\';
1227
 
#else
1228
 
      *p='/';
1229
 
#endif
 
1224
    if ( p != NULL ) *p=MDC_PATH_DELIM_CHR;
1230
1225
  }
1231
1226
 
1232
1227
  *fname = &path[0];