src/findlib/create_file.c
static int separate_path_and_file(JCR *jcr, char *fname, char *ofile)
{
   char *f, *p, *q;
   int fnl, pnl;

   /* Separate pathname and filename */
   for (q=p=f=ofile; *p; p++) {
#ifdef HAVE_WIN32
      if (IsPathSeparator(*p)) {
         f = q;
         if (IsPathSeparator(p[1])) {
            p++;
         }
      }
      *q++ = *p;                   /* copy data */
#else
      if (IsPathSeparator(*p)) {
         f = q;                    /* possible filename */
      }
      q++;
#endif
   }

   if (IsPathSeparator(*f)) {
      f++;
   }
   *q = 0;                         /* terminate string */

   fnl = q - f;
   if (fnl == 0) {
      /* The filename length must not be zero here because we
       *  are dealing with a file (i.e. FT_REGE or FT_REG).
       */
      Jmsg1(jcr, M_ERROR, 0, _("Zero length filename: %s\n"), fname);
      return -1;
   }
   pnl = f - ofile - 1;
   return pnl;
}
/*
 *  Returns: > 0 index into path where last path char is.
 *           0  no path
 *           -1 filename is zero length
 */
> 0 index into path where last path char is.
0  no path
-1 filename is zero length
> 0 index into path where last path char is . 0 no path - 1 filename is zero length
static int separate_path_and_file(JCR *jcr, char *fname, char *ofile)
{
   char *f, *p, *q;
   int fnl, pnl;
   for (q=p=f=ofile; *p; p++) {
#ifdef HAVE_WIN32
      if (IsPathSeparator(*p)) {
         f = q;
         if (IsPathSeparator(p[1])) {
            p++;
         }
      }
      *q++ = *p;                   
#else
      if (IsPathSeparator(*p)) {
         f = q;                    
      }
      q++;
#endif
   }
   if (IsPathSeparator(*f)) {
      f++;
   }
   *q = 0;                         
   fnl = q - f;
   if (fnl == 0) {
      Jmsg1(jcr, M_ERROR, 0, _("Zero length filename: %s\n"), fname);
      return -1;
   }
   pnl = f - ofile - 1;
   return pnl;
}
static int separate_path_and_file ( JCR * jcr , char * fname , char * ofile ) { char * f , * p , * q ; int fnl , pnl ; for ( q = p = f = ofile ; * p ; p ++ ) { #ifdef HAVE_WIN32 if ( IsPathSeparator ( * p ) ) { f = q ; if ( IsPathSeparator ( p [ 1 ] ) ) { p ++ ; } } * q ++ = * p ; #else if ( IsPathSeparator ( * p ) ) { f = q ; } q ++ ; #endif } if ( IsPathSeparator ( * f ) ) { f ++ ; } * q = 0 ; fnl = q - f ; if ( fnl == 0 ) { Jmsg1 ( jcr , M_ERROR , 0 , _ ( " \n " ) , fname ) ; return -1 ; } pnl = f - ofile - 1 ; return pnl ; }
Returns: > 0 index into path where last path char is.
Returns : > 0 index into path where last path char is .
/* Separate pathname and filename */ /* copy data */ /* possible filename */ /* terminate string */ /* The filename length must not be zero here because we
       *  are dealing with a file (i.e. FT_REGE or FT_REG).
       */