root/src/vfs/fish/fishdef.h

/* [previous][next][first][last][top][bottom][index][help]  */

INCLUDED FROM


   1 
   2 /**
   3  * \file
   4  * \brief Header: FISH script defaults
   5  */
   6 
   7 #ifndef MC__FISH_DEF_H
   8 #define MC__FISH_DEF_H
   9 
  10 /*** typedefs(not structures) and defined constants **********************************************/
  11 
  12 /* default 'ls' script */
  13 #define FISH_LS_DEF_CONTENT ""                                            \
  14 "#LIST /${FISH_FILENAME}\n"                                               \
  15 "export LC_TIME=C\n"                                                      \
  16 "ls -Qlan \"/${FISH_FILENAME}\" 2>/dev/null | grep '^[^cbt]' | (\n"       \
  17 "while read p l u g s m d y n; do\n"                                      \
  18 "    echo \"P$p $u.$g\"\n"                                                \
  19 "    echo \"S$s\"\n"                                                      \
  20 "    echo \"d$m $d $y\"\n"                                                \
  21 "    echo \":$n\"\n"                                                      \
  22 "    echo\n"                                                              \
  23 "done\n"                                                                  \
  24 ")\n"                                                                     \
  25 "ls -Qlan \"/${FISH_FILENAME}\" 2>/dev/null | grep '^[cb]' | (\n"         \
  26 "while read p l u g a i m d y n; do\n"                                    \
  27 "    echo \"P$p $u.$g\"\n"                                                \
  28 "    echo \"E$a$i\"\n"                                                    \
  29 "    echo \"d$m $d $y\"\n"                                                \
  30 "    echo \":$n\"\n"                                                      \
  31 "    echo\n"                                                              \
  32 "done\n"                                                                  \
  33 ")\n"                                                                     \
  34 "echo \"### 200\"\n"
  35 
  36 /* default file exisits script */
  37 #define FISH_EXISTS_DEF_CONTENT ""                                        \
  38 "#ISEXISTS $FISH_FILENAME\n"                                              \
  39 "ls -l \"/${FISH_FILENAME}\" >/dev/null 2>/dev/null\n"                    \
  40 "echo '### '$?\n"
  41 
  42 /* default 'mkdir' script */
  43 #define FISH_MKDIR_DEF_CONTENT ""                                         \
  44 "#MKD $FISH_FILENAME\n"                                                   \
  45 "if mkdir \"/${FISH_FILENAME}\" 2>/dev/null; then\n"                      \
  46 "    echo \"### 000\"\n"                                                  \
  47 "else\n"                                                                  \
  48 "    echo \"### 500\"\n"                                                  \
  49 "fi\n"
  50 
  51 /* default 'unlink' script */
  52 #define FISH_UNLINK_DEF_CONTENT ""                                        \
  53 "#DELE $FISH_FILENAME\n"                                                  \
  54 "if rm -f \"/${FISH_FILENAME}\" 2>/dev/null; then\n"                      \
  55 "    echo \"### 000\"\n"                                                  \
  56 "else\n"                                                                  \
  57 "    echo \"### 500\"\n"                                                  \
  58 "fi\n"
  59 /* default 'chown' script */
  60 #define FISH_CHOWN_DEF_CONTENT ""                                           \
  61 "#CHOWN $FISH_FILEOWNER:$FISH_FILEGROUP $FISH_FILENAME\n"                   \
  62 "if chown ${FISH_FILEOWNER}:${FISH_FILEGROUP} \"/${FISH_FILENAME}\"; then\n"\
  63 "    echo \"### 000\"\n"                                                    \
  64 "else\n"                                                                    \
  65 "    echo \"### 500\"\n"                                                    \
  66 "fi\n"
  67 
  68 /* default 'chmod' script */
  69 #define FISH_CHMOD_DEF_CONTENT ""                                           \
  70 "#CHMOD $FISH_FILEMODE $FISH_FILENAME\n"                                    \
  71 "if chmod ${FISH_FILEMODE} \"/${FISH_FILENAME}\" 2>/dev/null; then\n"       \
  72 "    echo \"### 000\"\n"                                                    \
  73 "else\n"                                                                    \
  74 "    echo \"### 500\"\n"                                                    \
  75 "fi\n"
  76 
  77 /* default 'utime' script */
  78 #define FISH_UTIME_DEF_CONTENT ""                                                                         \
  79 "#UTIME \"$FISH_TOUCHATIME_W_NSEC\" \"$FISH_TOUCHMTIME_W_NSEC\" $FISH_FILENAME\n"                         \
  80 "if TZ=UTC touch -h -m -d \"$FISH_TOUCHMTIME_W_NSEC\" \"/${FISH_FILENAME}\" 2>/dev/null && \\\n"          \
  81 "   TZ=UTC touch -h -a -d \"$FISH_TOUCHATIME_W_NSEC\" \"/${FISH_FILENAME}\" 2>/dev/null; then\n"          \
  82 "  echo \"### 000\"\n"                                                                                    \
  83 "elif TZ=UTC touch -h -m -t $FISH_TOUCHMTIME \"/${FISH_FILENAME}\" 2>/dev/null && \\\n"                   \
  84 "     TZ=UTC touch -h -a -t $FISH_TOUCHATIME \"/${FISH_FILENAME}\" 2>/dev/null; then\n"                   \
  85 "  echo \"### 000\"\n"                                                                                    \
  86 "elif [ -n \"$FISH_HAVE_PERL\" ] && \\\n"                                                                 \
  87 "   perl -e 'utime '$FISH_FILEATIME','$FISH_FILEMTIME',@ARGV;' \"/${FISH_FILENAME}\" 2>/dev/null; then\n" \
  88 "  echo \"### 000\"\n"                                                                                    \
  89 "else\n"                                                                                                  \
  90 "  echo \"### 500\"\n"                                                                                    \
  91 "fi\n"
  92 
  93 
  94 /* default 'rmdir' script */
  95 #define FISH_RMDIR_DEF_CONTENT ""                                           \
  96 "#RMD $FISH_FILENAME\n"                                                     \
  97 "if rmdir \"/${FISH_FILENAME}\" 2>/dev/null; then\n"                        \
  98 "   echo \"### 000\"\n"                                                     \
  99 "else\n"                                                                    \
 100 "   echo \"### 500\"\n"                                                     \
 101 "fi\n"
 102 
 103 /* default 'ln -s' symlink script */
 104 #define FISH_LN_DEF_CONTENT ""                                              \
 105 "#SYMLINK $FISH_FILEFROM $FISH_FILETO\n"                                    \
 106 "if ln -s \"/${FISH_FILEFROM}\" \"/${FISH_FILETO}\" 2>/dev/null; then\n"    \
 107 "   echo \"### 000\"\n"                                                     \
 108 "else\n"                                                                    \
 109 "   echo \"### 500\"\n"                                                     \
 110 "fi\n"
 111 
 112 /* default 'mv' script */
 113 #define FISH_MV_DEF_CONTENT ""                                              \
 114 "#RENAME $FISH_FILEFROM $FISH_FILETO\n"                                     \
 115 "if mv \"/${FISH_FILEFROM}\" \"/${FISH_FILETO}\" 2>/dev/null; then\n"       \
 116 "   echo \"### 000\"\n"                                                     \
 117 "else\n"                                                                    \
 118 "   echo \"### 500\"\n"                                                     \
 119 "fi\n"
 120 
 121 /* default 'ln' hardlink script */
 122 #define FISH_HARDLINK_DEF_CONTENT ""                                        \
 123 "#LINK $FISH_FILEFROM $FISH_FILETO\n"                                       \
 124 "if ln \"/${FISH_FILEFROM}\" \"/${FISH_FILETO}\" 2>/dev/null; then\n"       \
 125 "   echo \"### 000\"\n"                                                     \
 126 "else\n"                                                                    \
 127 "   echo \"### 500\"\n"                                                     \
 128 "fi\n"
 129 
 130 /* default 'retr'  script */
 131 #define FISH_GET_DEF_CONTENT ""                                                 \
 132 "export LC_TIME=C\n"                                                            \
 133 "#RETR $FISH_FILENAME\n"                                                        \
 134 "if dd if=\"/${FISH_FILENAME}\" of=/dev/null bs=1 count=1 2>/dev/null ; then\n" \
 135 "    ls -ln \"/${FISH_FILENAME}\" 2>/dev/null | (\n"                            \
 136 "       read p l u g s r\n"                                                     \
 137 "       echo $s\n"                                                              \
 138 "    )\n"                                                                       \
 139 "    echo \"### 100\"\n"                                                        \
 140 "    cat \"/${FISH_FILENAME}\"\n"                                               \
 141 "    echo \"### 200\"\n"                                                        \
 142 "else\n"                                                                        \
 143 "    echo \"### 500\"\n"                                                        \
 144 "fi\n"
 145 
 146 /* default 'stor'  script */
 147 #define FISH_SEND_DEF_CONTENT ""                                          \
 148 "FILENAME=\"/${FISH_FILENAME}\"\n"                                        \
 149 "FILESIZE=${FISH_FILESIZE}\n"                                             \
 150 "#STOR $FILESIZE $FILENAME\n"                                             \
 151 "echo \"### 001\"\n"                                                      \
 152 "{\n"                                                                     \
 153 "    while [ $FILESIZE -gt 0 ]; do\n"                                     \
 154 "        cnt=`expr \\( $FILESIZE + 255 \\) / 256`\n"                      \
 155 "        n=`dd bs=256 count=$cnt | tee -a \"${FILENAME}\" | wc -c`\n"     \
 156 "        FILESIZE=`expr $FILESIZE - $n`\n"                                \
 157 "    done\n"                                                              \
 158 "}; echo \"### 200\"\n"
 159 
 160 /* default 'appe'  script */
 161 #define FISH_APPEND_DEF_CONTENT ""                                        \
 162 "FILENAME=\"/${FISH_FILENAME}\"\n"                                        \
 163 "FILESIZE=${FISH_FILESIZE}\n"                                             \
 164 "#APPE $FILESIZE $FILENAME\n"                                             \
 165 "echo \"### 001\"\n"                                                      \
 166 "res=`exec 3>&1\n"                                                        \
 167 "(\n"                                                                     \
 168 "    head -c $FILESIZE -q - || echo DD >&3\n"                             \
 169 ") 2>/dev/null | (\n"                                                     \
 170 "    cat > \"${FILENAME}\"\n"                                             \
 171 "    cat > /dev/null\n"                                                   \
 172 ")`; [ \"$res\" = DD ] && {\n"                                            \
 173 "    > \"${FILENAME}\"\n"                                                 \
 174 "    while [ $FILESIZE -gt 0 ]\n"                                         \
 175 "    do\n"                                                                \
 176 "       cnt=`expr \\( $FILESIZE + 255 \\) / 256`\n"                       \
 177 "       n=`dd bs=256 count=$cnt | tee -a \"${FILENAME}\" | wc -c`\n"      \
 178 "       FILESIZE=`expr $FILESIZE - $n`\n"                                 \
 179 "    done\n"                                                              \
 180 "}; echo \"### 200\"\n"
 181 
 182 /* default 'info'  script */
 183 #define FISH_INFO_DEF_CONTENT ""                                          \
 184 "export LC_TIME=C\n"                                                      \
 185 "#FISH_HAVE_HEAD         1\n"                                             \
 186 "#FISH_HAVE_SED          2\n"                                             \
 187 "#FISH_HAVE_AWK          4\n"                                             \
 188 "#FISH_HAVE_PERL         8\n"                                             \
 189 "#FISH_HAVE_LSQ         16\n"                                             \
 190 "#FISH_HAVE_DATE_MDYT   32\n"                                             \
 191 "#FISH_HAVE_TAIL        64\n"                                             \
 192 "res=0\n"                                                                 \
 193 "if `echo yes| head -c 1 > /dev/null 2>&1` ; then\n"                      \
 194 "    res=`expr $res + 1`\n"                                               \
 195 "fi\n"                                                                    \
 196 "if `sed --version >/dev/null 2>&1` ; then\n"                             \
 197 "    res=`expr $res + 2`\n"                                               \
 198 "fi\n"                                                                    \
 199 "if `awk --version > /dev/null 2>&1` ; then\n"                            \
 200 "    res=`expr $res + 4`\n"                                               \
 201 "fi\n"                                                                    \
 202 "if `perl -v > /dev/null 2>&1` ; then\n"                                  \
 203 "    res=`expr $res + 8`\n"                                               \
 204 "fi\n"                                                                    \
 205 "if `ls -Q / >/dev/null 2>&1` ; then\n"                                   \
 206 "    res=`expr $res + 16`\n"                                              \
 207 "fi\n"                                                                    \
 208 "dat=`ls -lan / 2>/dev/null | head -n 3 | tail -n 1 | (\n"                \
 209 "    while read p l u g s rec; do\n"                                      \
 210 "        if [ -n \"$g\" ]; then\n"                                        \
 211 "            if [ -n \"$l\" ]; then\n"                                    \
 212 "                echo \"$rec\"\n"                                         \
 213 "            fi\n"                                                        \
 214 "        fi\n"                                                            \
 215 "    done\n"                                                              \
 216 ") | cut -c1 2>/dev/null`\n"                                              \
 217 "r=`echo \"0123456789\"| grep \"$dat\"`\n"                                \
 218 "if [ -z \"$r\" ]; then\n"                                                \
 219 "    res=`expr $res + 32`\n"                                              \
 220 "fi\n"                                                                    \
 221 "if `echo yes| tail -c +1 - > /dev/null 2>&1` ; then\n"                   \
 222 "    res=`expr $res + 64`\n"                                              \
 223 "fi\n"                                                                    \
 224 "echo $res\n"                                                             \
 225 "echo \"### 200\"\n"
 226 
 227 /*** enums ***************************************************************************************/
 228 
 229 /*** structures declarations (and typedefs of structures)*****************************************/
 230 
 231 /*** global variables defined in .c file *********************************************************/
 232 
 233 /*** declarations of public functions ************************************************************/
 234 
 235 /*** inline functions ****************************************************************************/
 236 #endif

/* [previous][next][first][last][top][bottom][index][help]  */