50d019254986e657fbe385d9dc0b37e428202368
[oweals/busybox.git] / utility.c
1 /*
2  * Utility routines.
3  *
4  * Copyright (C) tons of folks.  Tracking down who wrote what
5  * isn't something I'm going to worry about...  If you wrote something
6  * here, please feel free to acknowledge your work.
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21  *
22  * Based in part on code from sash, Copyright (c) 1999 by David I. Bell 
23  * Permission has been granted to redistribute this code under the GPL.
24  *
25  */
26
27 #include "internal.h"
28 #include <stdio.h>
29 #include <string.h>
30 #include <errno.h>
31 #include <fcntl.h>
32 #include <dirent.h>
33 #include <time.h>
34 #include <utime.h>
35 #include <sys/stat.h>
36 #include <unistd.h>
37 #include <ctype.h>
38
39 #ifdef BB_MTAB
40 const char mtab_file[] = "/etc/mtab";
41 #else
42 #if defined BB_MOUNT || defined BB_UMOUNT || defined BB_DF
43 const char mtab_file[] = "/proc/mounts";
44 #endif
45 #endif
46
47
48 /* volatile so gcc knows this is the enod of the line */
49 volatile void usage(const char *usage)
50 {
51     fprintf(stderr, "BusyBox v%s (%s) multi-call binary -- GPL2\n\n", BB_VER, BB_BT);
52     fprintf(stderr, "Usage: %s\n", usage);
53     exit(FALSE);
54 }
55
56
57 #if defined (BB_INIT) || defined (BB_PS)
58
59 /* Returns kernel version encoded as major*65536 + minor*256 + patch,
60  * so, for example,  to check if the kernel is greater than 2.2.11:
61  *      if (get_kernel_revision() <= 2*65536+2*256+11) { <stuff> }
62  */
63 int
64 get_kernel_revision()
65 {
66   FILE *file;
67   int major=0, minor=0, patch=0;
68   char* filename="/proc/sys/kernel/osrelease";
69
70   file = fopen(filename,"r");
71   if (file == NULL) {
72     /* bummer, /proc must not be mounted... */
73     return( 0);
74   }
75   fscanf(file,"%d.%d.%d",&major,&minor,&patch);
76   fclose(file);
77   return major*65536 + minor*256 + patch;
78 }
79
80 #endif
81
82
83
84 #if defined (BB_CP) || defined (BB_MV)
85 /*
86  * Return TRUE if a fileName is a directory.
87  * Nonexistant files return FALSE.
88  */
89 int isDirectory(const char *name)
90 {
91     struct stat statBuf;
92
93     if (stat(name, &statBuf) < 0)
94         return FALSE;
95     if (S_ISDIR(statBuf.st_mode))
96         return TRUE;
97     return(FALSE);
98 }
99
100
101 /*
102  * Copy one file to another, while possibly preserving its modes, times,
103  * and modes.  Returns TRUE if successful, or FALSE on a failure with an
104  * error message output.  (Failure is not indicted if the attributes cannot
105  * be set.)
106  *  -Erik Andersen
107  */
108 int
109 copyFile( const char *srcName, const char *destName, 
110          int setModes, int followLinks)
111 {
112     int rfd;
113     int wfd;
114     int rcc;
115     int result;
116     char buf[BUF_SIZE];
117     struct stat srcStatBuf;
118     struct stat dstStatBuf;
119     struct utimbuf times;
120
121     if (followLinks == FALSE)
122         result = stat(srcName, &srcStatBuf);
123     else 
124         result = lstat(srcName, &srcStatBuf);
125     if (result < 0) {
126         perror(srcName);
127         return FALSE;
128     }
129
130     if (followLinks == FALSE)
131         result = stat(destName, &dstStatBuf);
132     else 
133         result = lstat(destName, &dstStatBuf);
134     if (result < 0) {
135         dstStatBuf.st_ino = -1;
136         dstStatBuf.st_dev = -1;
137     }
138
139     if ((srcStatBuf.st_dev == dstStatBuf.st_dev) &&
140         (srcStatBuf.st_ino == dstStatBuf.st_ino)) {
141         fprintf(stderr, "Copying file \"%s\" to itself\n", srcName);
142         return FALSE;
143     }
144
145     if (S_ISDIR(srcStatBuf.st_mode)) {
146         //fprintf(stderr, "copying directory %s to %s\n", srcName, destName);
147         /* Make sure the directory is writable */
148         if (mkdir(destName, 0777777 ^ umask(0))) {
149             perror(destName);
150             return (FALSE);
151         }
152     } else if (S_ISLNK(srcStatBuf.st_mode)) {
153         char *link_val;
154         int link_size;
155
156         //fprintf(stderr, "copying link %s to %s\n", srcName, destName);
157         link_val = (char *) alloca(PATH_MAX + 2);
158         link_size = readlink(srcName, link_val, PATH_MAX + 1);
159         if (link_size < 0) {
160             perror(srcName);
161             return (FALSE);
162         }
163         link_val[link_size] = '\0';
164         link_size = symlink(link_val, destName);
165         if (link_size != 0) {
166             perror(destName);
167             return (FALSE);
168         }
169     } else if (S_ISFIFO(srcStatBuf.st_mode)) {
170         //fprintf(stderr, "copying fifo %s to %s\n", srcName, destName);
171         if (mkfifo(destName, 644)) {
172             perror(destName);
173             return (FALSE);
174         }
175     } else if (S_ISBLK(srcStatBuf.st_mode) || S_ISCHR(srcStatBuf.st_mode) 
176             || S_ISSOCK (srcStatBuf.st_mode)) {
177         //fprintf(stderr, "copying soc, blk, or chr %s to %s\n", srcName, destName);
178         if (mknod(destName, srcStatBuf.st_mode, srcStatBuf.st_rdev)) {
179             perror(destName);
180             return (FALSE);
181         }
182     } else if (S_ISREG(srcStatBuf.st_mode)) {
183         //fprintf(stderr, "copying regular file %s to %s\n", srcName, destName);
184         rfd = open(srcName, O_RDONLY);
185         if (rfd < 0) {
186             perror(srcName);
187             return FALSE;
188         }
189
190         wfd = creat(destName, srcStatBuf.st_mode);
191         if (wfd < 0) {
192             perror(destName);
193             close(rfd);
194             return FALSE;
195         }
196
197         while ((rcc = read(rfd, buf, sizeof(buf))) > 0) {
198             if (fullWrite(wfd, buf, rcc) < 0)
199                 goto error_exit;
200         }
201         if (rcc < 0) {
202             goto error_exit;
203         }
204
205         close(rfd);
206         if (close(wfd) < 0) {
207             return FALSE;
208         }
209     }
210
211     if (setModes == TRUE) {
212         //fprintf(stderr, "Setting permissions for %s\n", destName);
213         chmod(destName, srcStatBuf.st_mode);
214         if (followLinks == TRUE)
215             chown(destName, srcStatBuf.st_uid, srcStatBuf.st_gid);
216         else
217             lchown(destName, srcStatBuf.st_uid, srcStatBuf.st_gid);
218
219         times.actime = srcStatBuf.st_atime;
220         times.modtime = srcStatBuf.st_mtime;
221
222         utime(destName, &times);
223     }
224
225     return TRUE;
226
227
228   error_exit:
229     perror(destName);
230     close(rfd);
231     close(wfd);
232
233     return FALSE;
234 }
235 #endif
236
237
238
239 #ifdef BB_TAR
240 /*
241  * Return the standard ls-like mode string from a file mode.
242  * This is static and so is overwritten on each call.
243  */
244 const char *modeString(int mode)
245 {
246     static char buf[12];
247
248     strcpy(buf, "----------");
249
250     /*
251      * Fill in the file type.
252      */
253     if (S_ISDIR(mode))
254         buf[0] = 'd';
255     if (S_ISCHR(mode))
256         buf[0] = 'c';
257     if (S_ISBLK(mode))
258         buf[0] = 'b';
259     if (S_ISFIFO(mode))
260         buf[0] = 'p';
261     if (S_ISLNK(mode))
262         buf[0] = 'l';
263     if (S_ISSOCK(mode))
264         buf[0] = 's';
265     /*
266      * Now fill in the normal file permissions.
267      */
268     if (mode & S_IRUSR)
269         buf[1] = 'r';
270     if (mode & S_IWUSR)
271         buf[2] = 'w';
272     if (mode & S_IXUSR)
273         buf[3] = 'x';
274     if (mode & S_IRGRP)
275         buf[4] = 'r';
276     if (mode & S_IWGRP)
277         buf[5] = 'w';
278     if (mode & S_IXGRP)
279         buf[6] = 'x';
280     if (mode & S_IROTH)
281         buf[7] = 'r';
282     if (mode & S_IWOTH)
283         buf[8] = 'w';
284     if (mode & S_IXOTH)
285         buf[9] = 'x';
286
287     /*
288      * Finally fill in magic stuff like suid and sticky text.
289      */
290     if (mode & S_ISUID)
291         buf[3] = ((mode & S_IXUSR) ? 's' : 'S');
292     if (mode & S_ISGID)
293         buf[6] = ((mode & S_IXGRP) ? 's' : 'S');
294     if (mode & S_ISVTX)
295         buf[9] = ((mode & S_IXOTH) ? 't' : 'T');
296
297     return buf;
298 }
299
300
301 /*
302  * Get the time string to be used for a file.
303  * This is down to the minute for new files, but only the date for old files.
304  * The string is returned from a static buffer, and so is overwritten for
305  * each call.
306  */
307 const char *timeString(time_t timeVal)
308 {
309     time_t now;
310     char *str;
311     static char buf[26];
312
313     time(&now);
314
315     str = ctime(&timeVal);
316
317     strcpy(buf, &str[4]);
318     buf[12] = '\0';
319
320     if ((timeVal > now) || (timeVal < now - 365 * 24 * 60 * 60L)) {
321         strcpy(&buf[7], &str[20]);
322         buf[11] = '\0';
323     }
324
325     return buf;
326 }
327
328
329 /*
330  * Write all of the supplied buffer out to a file.
331  * This does multiple writes as necessary.
332  * Returns the amount written, or -1 on an error.
333  */
334 int fullWrite(int fd, const char *buf, int len)
335 {
336     int cc;
337     int total;
338
339     total = 0;
340
341     while (len > 0) {
342         cc = write(fd, buf, len);
343
344         if (cc < 0)
345             return -1;
346
347         buf += cc;
348         total += cc;
349         len -= cc;
350     }
351
352     return total;
353 }
354
355
356 /*
357  * Read all of the supplied buffer from a file.
358  * This does multiple reads as necessary.
359  * Returns the amount read, or -1 on an error.
360  * A short read is returned on an end of file.
361  */
362 int fullRead(int fd, char *buf, int len)
363 {
364     int cc;
365     int total;
366
367     total = 0;
368
369     while (len > 0) {
370         cc = read(fd, buf, len);
371
372         if (cc < 0)
373             return -1;
374
375         if (cc == 0)
376             break;
377
378         buf += cc;
379         total += cc;
380         len -= cc;
381     }
382
383     return total;
384 }
385 #endif
386
387
388 #if defined (BB_CHOWN) || defined (BB_CP) || defined (BB_FIND) || defined (BB_LS)
389 /*
390  * Walk down all the directories under the specified 
391  * location, and do something (something specified
392  * by the fileAction and dirAction function pointers).
393  *
394  * Unfortunatly, while nftw(3) could replace this and reduce 
395  * code size a bit, nftw() wasn't supported before GNU libc 2.1, 
396  * and so isn't sufficiently portable to take over since glibc2.1
397  * is so stinking huge.
398  */
399 int
400 recursiveAction(const char *fileName, int recurse, int followLinks, int depthFirst,
401                 int (*fileAction) (const char *fileName, struct stat* statbuf),
402                 int (*dirAction) (const char *fileName, struct stat* statbuf))
403 {
404     int status;
405     struct stat statbuf;
406     struct dirent *next;
407
408     if (followLinks == TRUE)
409         status = stat(fileName, &statbuf);
410     else
411         status = lstat(fileName, &statbuf);
412
413     if (status < 0) {
414         perror(fileName);
415         return (FALSE);
416     }
417
418     if ( (followLinks == FALSE) && (S_ISLNK(statbuf.st_mode)) )
419         return (TRUE);
420
421     if (recurse == FALSE) {
422         if (S_ISDIR(statbuf.st_mode)) {
423             if (dirAction != NULL)
424                 return (dirAction(fileName, &statbuf));
425             else
426                 return (TRUE);
427         } 
428     }
429
430     if (S_ISDIR(statbuf.st_mode)) {
431         DIR *dir;
432         dir = opendir(fileName);
433         if (!dir) {
434             perror(fileName);
435             return (FALSE);
436         }
437         if (dirAction != NULL && depthFirst == FALSE) {
438             status = dirAction(fileName, &statbuf);
439             if (status == FALSE) {
440                 perror(fileName);
441                 return (FALSE);
442             }
443         }
444         while ((next = readdir(dir)) != NULL) {
445             char nextFile[NAME_MAX];
446             if ((strcmp(next->d_name, "..") == 0)
447                 || (strcmp(next->d_name, ".") == 0)) {
448                 continue;
449             }
450             sprintf(nextFile, "%s/%s", fileName, next->d_name);
451             status =
452                 recursiveAction(nextFile, TRUE, followLinks, depthFirst, 
453                         fileAction, dirAction);
454             if (status < 0) {
455                 closedir(dir);
456                 return (FALSE);
457             }
458         }
459         status = closedir(dir);
460         if (status < 0) {
461             perror(fileName);
462             return (FALSE);
463         }
464         if (dirAction != NULL && depthFirst == TRUE) {
465             status = dirAction(fileName, &statbuf);
466             if (status == FALSE) {
467                 perror(fileName);
468                 return (FALSE);
469             }
470         }
471     } else {
472         if (fileAction == NULL)
473             return (TRUE);
474         else
475             return (fileAction(fileName, &statbuf));
476     }
477     return (TRUE);
478 }
479
480 #endif
481
482
483
484 #if defined (BB_TAR) || defined (BB_MKDIR)
485 /*
486  * Attempt to create the directories along the specified path, except for
487  * the final component.  The mode is given for the final directory only,
488  * while all previous ones get default protections.  Errors are not reported
489  * here, as failures to restore files can be reported later.
490  */
491 extern void createPath (const char *name, int mode)
492 {
493     char *cp;
494     char *cpOld;
495     char buf[NAME_MAX];
496
497     strcpy (buf, name);
498
499     cp = strchr (buf, '/');
500
501     while (cp) {
502         cpOld = cp;
503         cp = strchr (cp + 1, '/');
504
505         *cpOld = '\0';
506
507         if (mkdir (buf, cp ? 0777 : mode) == 0)
508             printf ("Directory \"%s\" created\n", buf);
509
510         *cpOld = '/';
511     }
512 }
513 #endif
514
515
516
517 #if defined (BB_CHMOD_CHOWN_CHGRP) || defined (BB_MKDIR)
518 /* [ugoa]{+|-|=}[rwxst] */
519
520
521
522 extern int 
523 parse_mode( const char* s, mode_t* theMode)
524 {
525         mode_t andMode = S_ISVTX|S_ISUID|S_ISGID|S_IRWXU|S_IRWXG|S_IRWXO;
526         mode_t orMode = 0;
527         mode_t  mode = 0;
528         mode_t  groups = 0;
529         char    type;
530         char    c;
531
532         do {
533                 for ( ; ; ) {
534                         switch ( c = *s++ ) {
535                         case '\0':
536                                 return -1;
537                         case 'u':
538                                 groups |= S_ISUID|S_IRWXU;
539                                 continue;
540                         case 'g':
541                                 groups |= S_ISGID|S_IRWXG;
542                                 continue;
543                         case 'o':
544                                 groups |= S_IRWXO;
545                                 continue;
546                         case 'a':
547                                 groups |= S_ISUID|S_ISGID|S_IRWXU|S_IRWXG|S_IRWXO;
548                                 continue;
549                         case '+':
550                         case '=':
551                         case '-':
552                                 type = c;
553                                 if ( groups == 0 ) /* The default is "all" */
554                                         groups |= S_ISUID|S_ISGID|S_IRWXU|S_IRWXG|S_IRWXO;
555                                 break;
556                         default:
557                                 if ( isdigit(c) && c >= '0' && c <= '7' && 
558                                                 mode == 0 && groups == 0 ) {
559                                         *theMode = strtol(--s, NULL, 8);
560                                         return (TRUE);
561                                 }
562                                 else
563                                         return (FALSE);
564                         }
565                         break;
566                 }
567
568                 while ( (c = *s++) != '\0' ) {
569                         switch ( c ) {
570                         case ',':
571                                 break;
572                         case 'r':
573                                 mode |= S_IRUSR|S_IRGRP|S_IROTH;
574                                 continue;
575                         case 'w':
576                                 mode |= S_IWUSR|S_IWGRP|S_IWOTH;
577                                 continue;
578                         case 'x':
579                                 mode |= S_IXUSR|S_IXGRP|S_IXOTH;
580                                 continue;
581                         case 's':
582                                 mode |= S_IXGRP|S_ISUID|S_ISGID;
583                                 continue;
584                         case 't':
585                                 mode |= 0;
586                                 continue;
587                         default:
588                                 *theMode &= andMode;
589                                 *theMode |= orMode;
590                                 return( TRUE);
591                         }
592                         break;
593                 }
594                 switch ( type ) {
595                 case '=':
596                         andMode &= ~(groups);
597                         /* fall through */
598                 case '+':
599                         orMode |= mode & groups;
600                         break;
601                 case '-':
602                         andMode &= ~(mode & groups);
603                         orMode &= andMode;
604                         break;
605                 }
606         } while ( c == ',' );
607         *theMode &= andMode;
608         *theMode |= orMode;
609         return (TRUE);
610 }
611
612
613 #endif
614
615
616
617
618
619
620
621 #if defined (BB_CHMOD_CHOWN_CHGRP) || defined (BB_PS)
622
623 /* Use this to avoid needing the glibc NSS stuff 
624  * This uses storage buf to hold things.
625  * */
626 uid_t 
627 my_getid(const char *filename, char *name, uid_t id) 
628 {
629         FILE *file;
630         char *rname, *start, *end, buf[128];
631         uid_t rid;
632
633         file=fopen(filename,"r");
634         if (file == NULL) {
635             perror(filename);
636             return (-1);
637         }
638
639         while (fgets (buf, 128, file) != NULL) {
640                 if (buf[0] == '#')
641                         continue;
642
643                 start = buf;
644                 end = strchr (start, ':');
645                 if (end == NULL)
646                         continue;
647                 *end = '\0';
648                 rname = start;
649
650                 start = end + 1;
651                 end = strchr (start, ':');
652                 if (end == NULL)
653                         continue;
654
655                 start = end + 1;
656                 rid = (uid_t) strtol (start, &end, 10);
657                 if (end == start)
658                         continue;
659
660                 if (name) {
661                     if (0 == strcmp(rname, name))
662                         return( rid);
663                 }
664                 if ( id != -1 && id == rid ) {
665                     strncpy(name, rname, 8);
666                     return( TRUE);
667                 }
668         }
669         fclose(file);
670         return (-1);
671 }
672
673 uid_t 
674 my_getpwnam(char *name) 
675 {
676     return my_getid("/etc/passwd", name, -1);
677 }
678
679 gid_t 
680 my_getgrnam(char *name) 
681 {
682     return my_getid("/etc/group", name, -1);
683 }
684
685 void
686 my_getpwuid(char* name, uid_t uid) 
687 {
688     my_getid("/etc/passwd", name, uid);
689 }
690
691 void
692 my_getgrgid(char* group, gid_t gid) 
693 {
694     my_getid("/etc/group", group, gid);
695 }
696
697
698 #endif
699
700
701
702
703 #if (defined BB_CHVT) || (defined BB_DEALLOCVT)
704
705
706 #include <linux/kd.h>
707 #include <sys/ioctl.h>
708
709 int is_a_console(int fd) 
710 {
711   char arg;
712   
713   arg = 0;
714   return (ioctl(fd, KDGKBTYPE, &arg) == 0
715           && ((arg == KB_101) || (arg == KB_84)));
716 }
717
718 static int open_a_console(char *fnam) 
719 {
720   int fd;
721   
722   /* try read-only */
723   fd = open(fnam, O_RDWR);
724   
725   /* if failed, try read-only */
726   if (fd < 0 && errno == EACCES)
727       fd = open(fnam, O_RDONLY);
728   
729   /* if failed, try write-only */
730   if (fd < 0 && errno == EACCES)
731       fd = open(fnam, O_WRONLY);
732   
733   /* if failed, fail */
734   if (fd < 0)
735       return -1;
736   
737   /* if not a console, fail */
738   if (! is_a_console(fd))
739     {
740       close(fd);
741       return -1;
742     }
743   
744   /* success */
745   return fd;
746 }
747
748 /*
749  * Get an fd for use with kbd/console ioctls.
750  * We try several things because opening /dev/console will fail
751  * if someone else used X (which does a chown on /dev/console).
752  *
753  * if tty_name is non-NULL, try this one instead.
754  */
755
756 int get_console_fd(char* tty_name) 
757 {
758   int fd;
759
760   if (tty_name)
761     {
762       if (-1 == (fd = open_a_console(tty_name)))
763         return -1;
764       else
765         return fd;
766     }
767   
768   fd = open_a_console("/dev/tty");
769   if (fd >= 0)
770     return fd;
771   
772   fd = open_a_console("/dev/tty0");
773   if (fd >= 0)
774     return fd;
775   
776   fd = open_a_console("/dev/console");
777   if (fd >= 0)
778     return fd;
779   
780   for (fd = 0; fd < 3; fd++)
781     if (is_a_console(fd))
782       return fd;
783   
784   fprintf(stderr,
785           "Couldnt get a file descriptor referring to the console\n");
786   return -1;            /* total failure */
787 }
788
789
790 #endif
791
792
793 #if !defined BB_REGEXP && (defined BB_GREP || defined BB_FIND || defined BB_SED)  
794
795 /* Do a case insensitive strstr() */
796 char* stristr(char *haystack, const char *needle)
797 {
798     int len = strlen( needle );
799     while( *haystack ) {
800         if( !strncasecmp( haystack, needle, len ) )
801             break;
802         haystack++;
803     }
804
805     if( !(*haystack) )
806             haystack = NULL;
807
808     return haystack;
809 }
810
811 /* This tries to find a needle in a haystack, but does so by
812  * only trying to match literal strings (look 'ma, no regexps!)
813  * This is short, sweet, and carries _very_ little baggage,
814  * unlike its beefier cousin in regexp.c
815  *  -Erik Andersen
816  */
817 extern int find_match(char *haystack, char *needle, int ignoreCase)
818 {
819
820     if (ignoreCase == FALSE)
821         haystack = strstr (haystack, needle);
822     else
823         haystack = stristr (haystack, needle);
824     if (haystack == NULL)
825         return FALSE;
826     return TRUE;
827 }
828
829
830 /* This performs substitutions after a string match has been found.  */
831 extern int replace_match(char *haystack, char *needle, char *newNeedle, int ignoreCase)
832 {
833     int foundOne=0;
834     char *where, *slider, *slider1, *oldhayStack;
835
836     if (ignoreCase == FALSE)
837         where = strstr (haystack, needle);
838     else
839         where = stristr (haystack, needle);
840
841     if (strcmp(needle, newNeedle)==0)
842         return FALSE;
843
844     oldhayStack = (char*)malloc((unsigned)(strlen(haystack)));
845     while(where!=NULL) {
846         foundOne++;
847         strcpy(oldhayStack, haystack);
848 #if 0
849         if ( strlen(newNeedle) > strlen(needle)) {
850             haystack = (char *)realloc(haystack, (unsigned)(strlen(haystack) - 
851                 strlen(needle) + strlen(newNeedle)));
852         }
853 #endif
854         for(slider=haystack,slider1=oldhayStack;slider!=where;slider++,slider1++);
855         *slider=0;
856         haystack=strcat(haystack, newNeedle);
857         slider1+=strlen(needle);
858         haystack = strcat(haystack, slider1);
859         where = strstr (slider, needle);
860     }
861     free( oldhayStack);
862
863     if (foundOne > 0)
864         return TRUE;
865     else
866         return FALSE;
867 }
868
869
870 #endif
871 /* END CODE */
872