src/cmd/fsexam/src/fsexam-helper.h
author yz157939@agc105
Fri, 25 Apr 2008 17:02:23 +0800
changeset 147 8c4ef02c14b8
permissions -rw-r--r--
replace new version of fsexam, old version 0.3.1 is not used any more
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
147
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
     1
/*
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
     2
 * CDDL HEADER START
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
     3
 *
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
     4
 * The contents of this file are subject to the terms of the
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
     5
 * Common Development and Distribution License (the "License").
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
     6
 * You may not use this file except in compliance with the License.
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
     7
 *
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
     8
 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
     9
 * or http://www.opensolaris.org/os/licensing.
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    10
 * See the License for the specific language governing permissions
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    11
 * and limitations under the License.
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    12
 *
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    13
 * When distributing Covered Code, include this CDDL HEADER in each
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    14
 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    15
 * If applicable, add the following below this CDDL HEADER, with the
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    16
 * fields enclosed by brackets "[]" replaced with your own identifying
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    17
 * information: Portions Copyright [yyyy] [name of copyright owner]
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    18
 *
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    19
 * CDDL HEADER END
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    20
 */
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    21
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    22
/*
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    23
 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    24
 * Use is subject to license terms.
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    25
 */
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    26
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    27
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    28
#ifndef _FSEXAM_HELPER_H_
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    29
#define _FSEXAM_HELPER_H_
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    30
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    31
#define FREE(p) if (p) {        \
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    32
                    free (p); \
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    33
                    p = NULL;   \
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    34
                }
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    35
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    36
/*=========================================================================
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    37
 *  Function Name:  str_isascii
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    38
 *
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    39
 *  Parameters:
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    40
 *
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    41
 *  Desc:
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    42
 *      Determine whether the parameter str contains only ascii characters.
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    43
 *
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    44
 *  Return value:
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    45
 *      Return True if str contain only ASCII
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    46
 *      Otherwise False
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    47
 *
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    48
 *  Author:     Yandong Yao 2006/08/24
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    49
 ========================================================================*/
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    50
gboolean str_isascii (const gchar *str, gint len);
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    51
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    52
/*============================================================================
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    53
 *  Function Name:  get_abs_path
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    54
 *
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    55
 *  Parameters:
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    56
 *      const gchar *file: the path
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    57
 *
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    58
 *  Desc:
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    59
 *      Convert relative path to absolute path, eliminate all '.', '..' 
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    60
 *      in the path
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    61
 *
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    62
 *  Return value:
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    63
 *      If the file exist, then return its absolute path
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    64
 *      if not exist or error occur, then return NULL.
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    65
 *
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    66
 *      As we can't determine whether the path is abs path already unless 
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    67
 *      traverse the whole string, so we always return a new string which 
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    68
 *      you need free when don't use them any more.
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    69
 *
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    70
 *  Author:     Yandong Yao 2006/08/24
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    71
 ============================================================================*/
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    72
gchar * get_abs_path (const gchar *file);
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    73
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    74
/*============================================================================
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    75
 *  Function Name:  file_exist
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    76
 *
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    77
 *  Parameters:
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    78
 *
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    79
 *  Desc:
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    80
 *      Determine whether file exist and S_ISREG || s_ISDIR || S_ISLNK 
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    81
 *
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    82
 *  Return value:
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    83
 *      Return True if file exist and S_ISREG || s_ISDIR || S_ISLNK 
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    84
 *      Otherwise return False.
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    85
 *
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    86
 *  Author:     Yandong Yao 2006/08/24
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    87
 ===========================================================================*/
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    88
gboolean file_exist (gchar *file);
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    89
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    90
/*============================================================================
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    91
 *  Function Name:  str_chomp
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    92
 *
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    93
 *  Parameters:
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    94
 *
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    95
 *  Desc:   
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    96
 *      Remove trailing newline '\n'
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    97
 *      Remove heading space
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    98
 *
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
    99
 *  Return value:
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   100
 *      Return the original string, won't allocate any new memory
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   101
 *
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   102
 *  Author:     Yandong Yao 2006/08/24
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   103
 ===========================================================================*/
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   104
gchar * str_chomp (gchar *str);
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   105
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   106
/*====================================================================
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   107
 *  Function Name:  str_compress
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   108
 *
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   109
 *  Parameters:
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   110
 *      gchar *string:  the original string, null terminated.
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   111
 *      gboolean *tab:  whether contain '\t' before the first non-space char
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   112
 *
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   113
 *  Desc:
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   114
 *      str_compress() function will remove any heading or tailing space.
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   115
 *      The modification is in-place, so it will change the original string.
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   116
 *
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   117
 *      if string contain '\t' before first non-space char, then *tab = TRUE;
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   118
 *
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   119
 *  Return value:
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   120
 *      The new start position in original string
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   121
 *
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   122
 *  Exception:
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   123
 *
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   124
 *  Author:     Yandong Yao 2006/08/30
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   125
 ========================================================================*/ 
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   126
gchar *str_compress (gchar *string, gboolean *tab);
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   127
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   128
/*====================================================================
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   129
 *  Function Name:  str_split
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   130
 *
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   131
 *  Parameters:
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   132
 *      gchar *str: The original string
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   133
 *      gchar **str1: pointer to the first string
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   134
 *      gchar **str2: pointer to the second string
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   135
 *
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   136
 *  Desc:
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   137
 *      Split the original string into two separate string according to space 
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   138
 *      chars. If there is no space,the *str2 = NULL;
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   139
 *
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   140
 *  Return value:
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   141
 *      N/A
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   142
 *
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   143
 *  Author:     Yandong Yao 2006/08/31
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   144
 ========================================================================*/ 
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   145
void str_split (gchar *str, gchar **str1, gchar **str2);
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   146
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   147
/*===================================================================
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   148
 *  Function Name:  list_free
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   149
 *
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   150
 *  Parameters:
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   151
 *      gpointer data:  the data stored in GList or GSList
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   152
 *      gpointer user_data: arbitrary user data
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   153
 *
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   154
 *  Desc:
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   155
 *      This function is just a wrap of g_free, so that it can be
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   156
 *      used as g_list_foreach to free the glist data memory
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   157
 *
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   158
 *  Return value:
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   159
 *
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   160
 *  Author:     Yandong Yao 2006/10/17
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   161
 ======================================================================*/
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   162
void list_free (gpointer data, gpointer user_data);
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   163
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   164
void list_print (gpointer data, gpointer user_data);
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   165
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   166
/*===================================================================
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   167
 *  Function Name:  encoding_string_parse
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   168
 *
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   169
 *  Parameters:
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   170
 *      const gchar *encoding_string: one string contain encoding name 
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   171
 *      separated by ',' or ':'
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   172
 *
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   173
 *  Desc:
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   174
 *      Split ',' or ':' separated encoding string into encoding list
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   175
 *
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   176
 *  Return value:
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   177
 *      GSList *, need free when don't use at more
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   178
 *
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   179
 *  Author:     Yandong Yao 2006/11/15
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   180
  ==========================================================================*/
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   181
GSList *encoding_string_parse (const gchar *encoding_string);
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   182
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   183
gchar *get_abs_path_for_symlink_target (const gchar *symlink);
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   184
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   185
void hash_print (gpointer key, gpointer value, gpointer data);
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   186
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   187
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   188
void fsexam_list_free (GList *list);
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   189
void fsexam_slist_free (GSList *list);
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   190
void fsexam_hash_remove_all (GHashTable *hash);
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   191
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   192
gchar   *get_sample_text (const gchar *contents, guint *length);
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   193
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   194
GList   *remove_string_from_list (GList *list, const gchar *str);
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   195
GSList  *remove_string_from_slist (GSList *list, const gchar *str);
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   196
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   197
gboolean fsexam_is_subpath (const gchar *path1, const gchar *path2);
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   198
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   199
/* 
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   200
 * get the display name
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   201
 */
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   202
gchar   *fsexam_filename_display_name (const gchar *filename);
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   203
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   204
/*
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   205
 * get the display name: this func will anaylize '/'
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   206
 */
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   207
gchar   *fsexam_filename_display_basename (const gchar *filename);
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   208
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   209
/*
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   210
 * escape string
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   211
 */
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   212
gchar   *fsexam_string_escape (const gchar *string);
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   213
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   214
gchar   *fsexam_print_hex (const gchar *str);
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   215
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   216
#ifndef HAVE_STRLCPY
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   217
size_t strlcpy (char *dst, const char *src, size_t len);
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   218
#endif
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   219
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   220
#ifndef HAVE_STRLCAT
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   221
size_t strlcat (char *dst, const char *src, size_t dstsize);
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   222
#endif
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   223
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   224
#ifdef HAVE_NO_GLIB_2_8
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   225
gboolean g_file_set_contents (const gchar *filename, const gchar *contents,
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   226
        gssize length, GError **error);
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   227
#endif
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   228
8c4ef02c14b8 replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff changeset
   229
#endif //_FSEXAM_HELPER_H_