diff options
author | erik <erik@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2000-02-07 05:29:42 +0000 |
---|---|---|
committer | erik <erik@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2000-02-07 05:29:42 +0000 |
commit | 74bc01e03e96d5a6a318688d2ee8c620f32ce928 (patch) | |
tree | dccf8f905fc5807239883da9fca6597037d487fc /mtab.c | |
parent | cac2faf4271a09ae2e37e87cbd7d6ea363667d51 (diff) | |
download | busybox-w32-74bc01e03e96d5a6a318688d2ee8c620f32ce928.tar.gz busybox-w32-74bc01e03e96d5a6a318688d2ee8c620f32ce928.tar.bz2 busybox-w32-74bc01e03e96d5a6a318688d2ee8c620f32ce928.zip |
A few minor updates. ;-)
Seriously though, read the Changelog for busybox 0.42,
which this is about to become...
-Erik
git-svn-id: svn://busybox.net/trunk/busybox@351 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'mtab.c')
-rw-r--r-- | mtab.c | 24 |
1 files changed, 7 insertions, 17 deletions
@@ -5,21 +5,13 @@ | |||
5 | #include <string.h> | 5 | #include <string.h> |
6 | #include <stdio.h> | 6 | #include <stdio.h> |
7 | #include <mntent.h> | 7 | #include <mntent.h> |
8 | #include <fstab.h> | ||
8 | #include <sys/mount.h> | 9 | #include <sys/mount.h> |
9 | 10 | ||
10 | extern const char mtab_file[]; /* Defined in utility.c */ | 11 | extern const char mtab_file[]; /* Defined in utility.c */ |
11 | 12 | ||
12 | static char * | ||
13 | stralloc(const char * string) | ||
14 | { | ||
15 | int length = strlen(string) + 1; | ||
16 | char * n = malloc(length); | ||
17 | memcpy(n, string, length); | ||
18 | return n; | ||
19 | } | ||
20 | 13 | ||
21 | extern void | 14 | void erase_mtab(const char * name) |
22 | erase_mtab(const char * name) | ||
23 | { | 15 | { |
24 | struct mntent entries[20]; | 16 | struct mntent entries[20]; |
25 | int count = 0; | 17 | int count = 0; |
@@ -39,10 +31,10 @@ erase_mtab(const char * name) | |||
39 | } | 31 | } |
40 | 32 | ||
41 | while ( (m = getmntent(mountTable)) != 0 ) { | 33 | while ( (m = getmntent(mountTable)) != 0 ) { |
42 | entries[count].mnt_fsname = stralloc(m->mnt_fsname); | 34 | entries[count].mnt_fsname = strdup(m->mnt_fsname); |
43 | entries[count].mnt_dir = stralloc(m->mnt_dir); | 35 | entries[count].mnt_dir = strdup(m->mnt_dir); |
44 | entries[count].mnt_type = stralloc(m->mnt_type); | 36 | entries[count].mnt_type = strdup(m->mnt_type); |
45 | entries[count].mnt_opts = stralloc(m->mnt_opts); | 37 | entries[count].mnt_opts = strdup(m->mnt_opts); |
46 | entries[count].mnt_freq = m->mnt_freq; | 38 | entries[count].mnt_freq = m->mnt_freq; |
47 | entries[count].mnt_passno = m->mnt_passno; | 39 | entries[count].mnt_passno = m->mnt_passno; |
48 | count++; | 40 | count++; |
@@ -65,8 +57,7 @@ erase_mtab(const char * name) | |||
65 | perror(mtab_file); | 57 | perror(mtab_file); |
66 | } | 58 | } |
67 | 59 | ||
68 | extern void | 60 | void write_mtab(char* blockDevice, char* directory, |
69 | write_mtab(char* blockDevice, char* directory, | ||
70 | char* filesystemType, long flags, char* string_flags) | 61 | char* filesystemType, long flags, char* string_flags) |
71 | { | 62 | { |
72 | FILE *mountTable = setmntent(mtab_file, "a+"); | 63 | FILE *mountTable = setmntent(mtab_file, "a+"); |
@@ -110,4 +101,3 @@ write_mtab(char* blockDevice, char* directory, | |||
110 | } | 101 | } |
111 | } | 102 | } |
112 | 103 | ||
113 | |||