summaryrefslogtreecommitdiff
path: root/utility.c
diff options
context:
space:
mode:
authorPavel Roskin <proski@gnu.org>2000-07-17 20:18:42 +0000
committerPavel Roskin <proski@gnu.org>2000-07-17 20:18:42 +0000
commitcc8a66b113dbdf04082b6f7c9b0b58984d433028 (patch)
tree98490b8eadc4e44b46c073fa2d21de403a2b61d4 /utility.c
parent97562bd9d7fe18bdc4f63e6e80bdce980416a915 (diff)
downloadbusybox-w32-cc8a66b113dbdf04082b6f7c9b0b58984d433028.tar.gz
busybox-w32-cc8a66b113dbdf04082b6f7c9b0b58984d433028.tar.bz2
busybox-w32-cc8a66b113dbdf04082b6f7c9b0b58984d433028.zip
Moved functions used by "lsmod" from cat.c to utility.c
Adjusted to make lsmod and sh compilable as standalone apps. Comment fixes
Diffstat (limited to 'utility.c')
-rw-r--r--utility.c31
1 files changed, 27 insertions, 4 deletions
diff --git a/utility.c b/utility.c
index c682bf05d..5f890c0ea 100644
--- a/utility.c
+++ b/utility.c
@@ -483,7 +483,7 @@ const char *timeString(time_t timeVal)
483 483
484 return buf; 484 return buf;
485} 485}
486#endif /* BB_TAR */ 486#endif /* BB_TAR || BB_AR */
487 487
488#if defined BB_TAR || defined BB_CP_MV || defined BB_AR 488#if defined BB_TAR || defined BB_CP_MV || defined BB_AR
489/* 489/*
@@ -511,10 +511,10 @@ int fullWrite(int fd, const char *buf, int len)
511 511
512 return total; 512 return total;
513} 513}
514#endif /* BB_TAR || BB_CP_MV */ 514#endif /* BB_TAR || BB_CP_MV || BB_AR */
515 515
516 516
517#if defined BB_TAR || defined BB_TAIL || defined BB_AR 517#if defined BB_TAR || defined BB_TAIL || defined BB_AR || defined BB_SH
518/* 518/*
519 * Read all of the supplied buffer from a file. 519 * Read all of the supplied buffer from a file.
520 * This does multiple reads as necessary. 520 * This does multiple reads as necessary.
@@ -544,7 +544,7 @@ int fullRead(int fd, char *buf, int len)
544 544
545 return total; 545 return total;
546} 546}
547#endif /* BB_TAR || BB_TAIL */ 547#endif /* BB_TAR || BB_TAIL || BB_AR || BB_SH */
548 548
549 549
550#if defined (BB_CHMOD_CHOWN_CHGRP) \ 550#if defined (BB_CHMOD_CHOWN_CHGRP) \
@@ -1667,6 +1667,29 @@ extern char *get_line_from_file(FILE *file)
1667 return linebuf; 1667 return linebuf;
1668} 1668}
1669 1669
1670#if defined BB_CAT || defined BB_LSMOD
1671extern void print_file(FILE *file)
1672{
1673 int c;
1674
1675 while ((c = getc(file)) != EOF)
1676 putc(c, stdout);
1677 fclose(file);
1678 fflush(stdout);
1679}
1680
1681extern int print_file_by_name(char *filename)
1682{
1683 FILE *file;
1684 file = fopen(filename, "r");
1685 if (file == NULL) {
1686 return FALSE;
1687 }
1688 print_file(file);
1689 return TRUE;
1690}
1691#endif /* BB_CAT || BB_LSMOD */
1692
1670#if defined BB_ECHO || defined BB_TR 1693#if defined BB_ECHO || defined BB_TR
1671char process_escape_sequence(char **ptr) 1694char process_escape_sequence(char **ptr)
1672{ 1695{