Ticket #180: 180_concat_dir_and_null.patch

File 180_concat_dir_and_null.patch, 1.8 KB (added by styx, 16 years ago)

sorry, I'm messed up! this one should be

  • src/util.c

    From 1916bc0c2d90a006c5beac64adbda0ee86f950fd Mon Sep 17 00:00:00 2001
    From: Mikhail S. Pobolovets <styx.mp@gmail.com>
    Date: Sun, 25 Jan 2009 23:11:09 +0200
    Subject: [PATCH] Originally by adamw
     http://svn.mandriva.com/cgi-bin/viewvc.cgi/packages/cooker/mc/current/SOURCES/mc-concat.patch?view=markup
     + some additional modifications
    
    Signed-off-by: Mikhail S. Pobolovets <styx.mp@gmail.com>
    ---
     src/util.c |   12 ++++++++++--
     src/util.h |    2 +-
     2 files changed, 11 insertions(+), 3 deletions(-)
    
    diff --git a/src/util.c b/src/util.c
    index edc759a..e4cd308 100644
    a b diff_two_paths (const char *first, const char *second) 
    12471247 
    12481248/* If filename is NULL, then we just append PATH_SEP to the dir */ 
    12491249char * 
    1250 concat_dir_and_file (const char *dir, const char *file) 
     1250concat_dir_and_file (const char *dir, const char *filename) 
    12511251{ 
    12521252    int i = strlen (dir); 
    1253      
     1253    const char *file = filename; 
     1254 
     1255    /* Return filename when dir is empty */ 
     1256    if (!i) return g_strdup (filename); 
     1257 
     1258    /* Is this one: *file == PATH_SEP seems to be not fully portable? */ 
     1259    if (file != NULL && *file == PATH_SEP) 
     1260        file++; 
     1261 
    12541262    if (dir [i-1] == PATH_SEP) 
    12551263        return  g_strconcat (dir, file, (char *) NULL); 
    12561264    else 
  • src/util.h

    diff --git a/src/util.h b/src/util.h
    index 4e9a113..64e5843 100644
    a b char *strip_password (char *path, int has_prefix); 
    6666const char *strip_home_and_password (const char *dir); 
    6767 
    6868const char *extension (const char *); 
    69 char *concat_dir_and_file (const char *dir, const char *file); 
     69char *concat_dir_and_file (const char *dir, const char *filename); 
    7070const char *unix_error_string (int error_num); 
    7171const char *skip_separators (const char *s); 
    7272const char *skip_numbers (const char *s);