4 * \brief Header: FISH script defaults
10 /*** typedefs(not structures) and defined constants **********************************************/
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" \
20 " echo \"d$m $d $y\"\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" \
29 " echo \"d$m $d $y\"\n" \
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" \
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" \
48 " echo \"### 500\"\n" \
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" \
57 " echo \"### 500\"\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" \
65 " echo \"### 500\"\n" \
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" \
74 " echo \"### 500\"\n" \
77 /* default 'utime' script */
78 #define FISH_UTIME_DEF_CONTENT "" \
79 "#UTIME $FISH_FILEATIME $FISH_FILEMTIME $FISH_FILENAME\n" \
80 "if [ -n \"$FISH_HAVE_PERL\" ] && \\\n" \
81 " perl -e 'utime '$FISH_FILEATIME','$FISH_FILEMTIME',@ARGV;' \"/${FISH_FILENAME}\" 2>/dev/null; then\n" \
82 " echo \"### 000\"\n" \
83 "elif TZ=UTC touch -m -t $FISH_TOUCHMTIME \"/${FISH_FILENAME}\" 2>/dev/null && \\\n" \
84 " TZ=UTC touch -a -t $FISH_TOUCHATIME \"/${FISH_FILENAME}\" 2>/dev/null; then\n" \
85 " echo \"### 000\"\n" \
87 " echo \"### 500\"\n" \
90 /* default 'rmdir' script */
91 #define FISH_RMDIR_DEF_CONTENT "" \
92 "#RMD $FISH_FILENAME\n" \
93 "if rmdir \"/${FISH_FILENAME}\" 2>/dev/null; then\n" \
94 " echo \"### 000\"\n" \
96 " echo \"### 500\"\n" \
99 /* default 'ln -s' symlink script */
100 #define FISH_LN_DEF_CONTENT "" \
101 "#SYMLINK $FISH_FILEFROM $FISH_FILETO\n" \
102 "if ln -s \"/${FISH_FILEFROM}\" \"/${FISH_FILETO}\" 2>/dev/null; then\n" \
103 " echo \"### 000\"\n" \
105 " echo \"### 500\"\n" \
108 /* default 'mv' script */
109 #define FISH_MV_DEF_CONTENT "" \
110 "#RENAME $FISH_FILEFROM $FISH_FILETO\n" \
111 "if mv \"/${FISH_FILEFROM}\" \"/${FISH_FILETO}\" 2>/dev/null; then\n" \
112 " echo \"### 000\"\n" \
114 " echo \"### 500\"\n" \
117 /* default 'ln' hardlink script */
118 #define FISH_HARDLINK_DEF_CONTENT "" \
119 "#LINK $FISH_FILEFROM $FISH_FILETO\n" \
120 "if ln \"/${FISH_FILEFROM}\" \"/${FISH_FILETO}\" 2>/dev/null; then\n" \
121 " echo \"### 000\"\n" \
123 " echo \"### 500\"\n" \
126 /* default 'retr' script */
127 #define FISH_GET_DEF_CONTENT "" \
128 "export LC_TIME=C\n" \
129 "#RETR $FISH_FILENAME\n" \
130 "if dd if=\"/${FISH_FILENAME}\" of=/dev/null bs=1 count=1 2>/dev/null ; then\n" \
131 " ls -ln \"/${FISH_FILENAME}\" 2>/dev/null | (\n" \
132 " read p l u g s r\n" \
135 " echo \"### 100\"\n" \
136 " cat \"/${FISH_FILENAME}\"\n" \
137 " echo \"### 200\"\n" \
139 " echo \"### 500\"\n" \
142 /* default 'stor' script */
143 #define FISH_SEND_DEF_CONTENT "" \
144 "FILENAME=\"/${FISH_FILENAME}\"\n" \
145 "FILESIZE=${FISH_FILESIZE}\n" \
146 "#STOR $FILESIZE $FILENAME\n" \
147 "echo \"### 001\"\n" \
149 " while [ $FILESIZE -gt 0 ]; do\n" \
150 " cnt=`expr \\( $FILESIZE + 255 \\) / 256`\n" \
151 " n=`dd bs=256 count=$cnt | tee -a \"${FILENAME}\" | wc -c`\n" \
152 " FILESIZE=`expr $FILESIZE - $n`\n" \
154 "}; echo \"### 200\"\n"
156 /* default 'appe' script */
157 #define FISH_APPEND_DEF_CONTENT "" \
158 "FILENAME=\"/${FISH_FILENAME}\"\n" \
159 "FILESIZE=${FISH_FILESIZE}\n" \
160 "#APPE $FILESIZE $FILENAME\n" \
161 "echo \"### 001\"\n" \
164 " head -c $FILESIZE -q - || echo DD >&3\n" \
165 ") 2>/dev/null | (\n" \
166 " cat > \"${FILENAME}\"\n" \
167 " cat > /dev/null\n" \
168 ")`; [ \"$res\" = DD ] && {\n" \
169 " > \"${FILENAME}\"\n" \
170 " while [ $FILESIZE -gt 0 ]\n" \
172 " cnt=`expr \\( $FILESIZE + 255 \\) / 256`\n" \
173 " n=`dd bs=256 count=$cnt | tee -a \"${FILENAME}\" | wc -c`\n" \
174 " FILESIZE=`expr $FILESIZE - $n`\n" \
176 "}; echo \"### 200\"\n"
178 /* default 'info' script */
179 #define FISH_INFO_DEF_CONTENT "" \
180 "export LC_TIME=C\n" \
181 "#FISH_HAVE_HEAD 1\n" \
182 "#FISH_HAVE_SED 2\n" \
183 "#FISH_HAVE_AWK 4\n" \
184 "#FISH_HAVE_PERL 8\n" \
185 "#FISH_HAVE_LSQ 16\n" \
186 "#FISH_HAVE_DATE_MDYT 32\n" \
187 "#FISH_HAVE_TAIL 64\n" \
189 "if `echo yes| head -c 1 > /dev/null 2>&1` ; then\n" \
190 " res=`expr $res + 1`\n" \
192 "if `sed --version >/dev/null 2>&1` ; then\n" \
193 " res=`expr $res + 2`\n" \
195 "if `awk --version > /dev/null 2>&1` ; then\n" \
196 " res=`expr $res + 4`\n" \
198 "if `perl -v > /dev/null 2>&1` ; then\n" \
199 " res=`expr $res + 8`\n" \
201 "if `ls -Q / >/dev/null 2>&1` ; then\n" \
202 " res=`expr $res + 16`\n" \
204 "dat=`ls -lan / 2>/dev/null | head -n 3 | tail -n 1 | (\n" \
205 " while read p l u g s rec; do\n" \
206 " if [ -n \"$g\" ]; then\n" \
207 " if [ -n \"$l\" ]; then\n" \
212 ") | cut -c1 2>/dev/null`\n" \
213 "r=`echo \"0123456789\"| grep \"$dat\"`\n" \
214 "if [ -z \"$r\" ]; then\n" \
215 " res=`expr $res + 32`\n" \
217 "if `echo yes| tail -c +1 - > /dev/null 2>&1` ; then\n" \
218 " res=`expr $res + 64`\n" \
223 /*** enums ***************************************************************************************/
225 /*** structures declarations (and typedefs of structures)*****************************************/
227 /*** global variables defined in .c file *********************************************************/
229 /*** declarations of public functions ************************************************************/
231 /*** inline functions ****************************************************************************/