diff options
author | Eric Andersen <andersen@codepoet.org> | 2000-05-31 20:04:38 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2000-05-31 20:04:38 +0000 |
commit | b5966368d78dfe3354371ad6f467671e4626e685 (patch) | |
tree | fd824b05197f0b0fd154712febd429f404222684 | |
parent | deb0331eb64d6bf9c92c0e5633eb84c49bf2b411 (diff) | |
download | busybox-w32-b5966368d78dfe3354371ad6f467671e4626e685.tar.gz busybox-w32-b5966368d78dfe3354371ad6f467671e4626e685.tar.bz2 busybox-w32-b5966368d78dfe3354371ad6f467671e4626e685.zip |
Minor doc fix. Added several bugs to the todo list. Fixed the way init
scans /etc/inittab entries so that commands can contain ":"s.
-Erik
-rw-r--r-- | Changelog | 3 | ||||
-rw-r--r-- | TODO | 12 | ||||
-rw-r--r-- | docs/busybox.net/index.html | 2 | ||||
-rw-r--r-- | init.c | 59 | ||||
-rw-r--r-- | init/init.c | 59 |
5 files changed, 80 insertions, 55 deletions
@@ -34,6 +34,9 @@ | |||
34 | * zcat now works (wasn't working since option parsing was broken) | 34 | * zcat now works (wasn't working since option parsing was broken) |
35 | * Renamed "mnc" to the more correct "nc" (for netcat). | 35 | * Renamed "mnc" to the more correct "nc" (for netcat). |
36 | * Makefile intelligence updates | 36 | * Makefile intelligence updates |
37 | * Changed the way init parses /etc/inittab entries to avoid problems | ||
38 | with commands that contain colons in them. Fix thanks to | ||
39 | Pavel Roskin <pavel_roskin@geocities.com> | ||
37 | * More doc updates | 40 | * More doc updates |
38 | 41 | ||
39 | 42 | ||
@@ -21,6 +21,18 @@ Bugs that need fixing: | |||
21 | - 'grep foo$ file' doesn't work | 21 | - 'grep foo$ file' doesn't work |
22 | - 'grep *foo file' segfaults | 22 | - 'grep *foo file' segfaults |
23 | - ps dirent race bug (need to stat the file before attempting chdir) | 23 | - ps dirent race bug (need to stat the file before attempting chdir) |
24 | - The following commands segfault: | ||
25 | chmod -R | ||
26 | chown -R | ||
27 | chgrp -R | ||
28 | cp -a -a | ||
29 | ln -s -s | ||
30 | rm -f | ||
31 | touch -c | ||
32 | - I believe that swaponoff may also be also broken (check it). | ||
33 | - It used to be that BusyBox tar would happily overwrite existing files on | ||
34 | an extraction. However, as of 0.42, BusyBox tar simply dies as soon as an | ||
35 | existing file is found. | ||
24 | 36 | ||
25 | 37 | ||
26 | ----------- | 38 | ----------- |
diff --git a/docs/busybox.net/index.html b/docs/busybox.net/index.html index ea46709a8..81fb4baa3 100644 --- a/docs/busybox.net/index.html +++ b/docs/busybox.net/index.html | |||
@@ -248,7 +248,7 @@ BusyBox is licensed under the | |||
248 | <TR><TD BGCOLOR="#eeeee0"> | 248 | <TR><TD BGCOLOR="#eeeee0"> |
249 | Current documentation for BusyBox includes: | 249 | Current documentation for BusyBox includes: |
250 | <ul> | 250 | <ul> |
251 | <li> <a href="BusyBox.html">BusyBox.html</a> | 251 | <li> <a href="ftp://ftp.lineo.com/pub/busybox/BusyBox.html">BusyBox.html</a> |
252 | This is a list of the all the available commands in BusyBox with complete | 252 | This is a list of the all the available commands in BusyBox with complete |
253 | usage information and examples of how to use each app. I spent | 253 | usage information and examples of how to use each app. I spent |
254 | a <em>lot</em> of time updating these docs and trying to make them | 254 | a <em>lot</em> of time updating these docs and trying to make them |
@@ -745,7 +745,7 @@ void parse_inittab(void) | |||
745 | #ifdef BB_FEATURE_USE_INITTAB | 745 | #ifdef BB_FEATURE_USE_INITTAB |
746 | FILE *file; | 746 | FILE *file; |
747 | char buf[256], lineAsRead[256], tmpConsole[256]; | 747 | char buf[256], lineAsRead[256], tmpConsole[256]; |
748 | char *p, *q, *r, *s; | 748 | char *id, *runlev, *action, *process, *eol; |
749 | const struct initActionType *a = actions; | 749 | const struct initActionType *a = actions; |
750 | int foundIt; | 750 | int foundIt; |
751 | 751 | ||
@@ -772,64 +772,69 @@ void parse_inittab(void) | |||
772 | 772 | ||
773 | while (fgets(buf, 255, file) != NULL) { | 773 | while (fgets(buf, 255, file) != NULL) { |
774 | foundIt = FALSE; | 774 | foundIt = FALSE; |
775 | for (p = buf; *p == ' ' || *p == '\t'; p++); | 775 | /* Skip leading spaces */ |
776 | if (*p == '#' || *p == '\n') | 776 | for (id = buf; *id == ' ' || *id == '\t'; id++); |
777 | |||
778 | /* Skip the line if it's a comment */ | ||
779 | if (*id == '#' || *id == '\n') | ||
777 | continue; | 780 | continue; |
778 | 781 | ||
779 | /* Trim the trailing \n */ | 782 | /* Trim the trailing \n */ |
780 | q = strrchr(p, '\n'); | 783 | eol = strrchr(id, '\n'); |
781 | if (q != NULL) | 784 | if (eol != NULL) |
782 | *q = '\0'; | 785 | *eol = '\0'; |
783 | 786 | ||
784 | /* Keep a copy around for posterity's sake (and error msgs) */ | 787 | /* Keep a copy around for posterity's sake (and error msgs) */ |
785 | strcpy(lineAsRead, buf); | 788 | strcpy(lineAsRead, buf); |
786 | 789 | ||
787 | /* Grab the ID field */ | 790 | /* Separate the ID field from the runlevels */ |
788 | s = p; | 791 | runlev = strchr(id, ':'); |
789 | p = strchr(p, ':'); | 792 | if (runlev == NULL || *(runlev + 1) == '\0') { |
790 | if (p != NULL || *(p + 1) != '\0') { | 793 | message(LOG | CONSOLE, "Bad inittab entry: %s\n", lineAsRead); |
791 | *p = '\0'; | 794 | continue; |
792 | ++p; | 795 | } else { |
796 | *runlev = '\0'; | ||
797 | ++runlev; | ||
793 | } | 798 | } |
794 | 799 | ||
795 | /* Now peel off the process field from the end | 800 | /* Separate the runlevels from the action */ |
796 | * of the string */ | 801 | action = strchr(runlev, ':'); |
797 | q = strrchr(p, ':'); | 802 | if (action == NULL || *(action + 1) == '\0') { |
798 | if (q == NULL || *(q + 1) == '\0') { | ||
799 | message(LOG | CONSOLE, "Bad inittab entry: %s\n", lineAsRead); | 803 | message(LOG | CONSOLE, "Bad inittab entry: %s\n", lineAsRead); |
800 | continue; | 804 | continue; |
801 | } else { | 805 | } else { |
802 | *q = '\0'; | 806 | *action = '\0'; |
803 | ++q; | 807 | ++action; |
804 | } | 808 | } |
805 | 809 | ||
806 | /* Now peel off the action field */ | 810 | /* Separate the action from the process */ |
807 | r = strrchr(p, ':'); | 811 | process = strchr(action, ':'); |
808 | if (r == NULL || *(r + 1) == '\0') { | 812 | if (process == NULL || *(process + 1) == '\0') { |
809 | message(LOG | CONSOLE, "Bad inittab entry: %s\n", lineAsRead); | 813 | message(LOG | CONSOLE, "Bad inittab entry: %s\n", lineAsRead); |
810 | continue; | 814 | continue; |
811 | } else { | 815 | } else { |
812 | ++r; | 816 | *process = '\0'; |
817 | ++process; | ||
813 | } | 818 | } |
814 | 819 | ||
815 | /* Ok, now process it */ | 820 | /* Ok, now process it */ |
816 | a = actions; | 821 | a = actions; |
817 | while (a->name != 0) { | 822 | while (a->name != 0) { |
818 | if (strcmp(a->name, r) == 0) { | 823 | if (strcmp(a->name, action) == 0) { |
819 | if (*s != '\0') { | 824 | if (*id != '\0') { |
820 | struct stat statBuf; | 825 | struct stat statBuf; |
821 | 826 | ||
822 | strcpy(tmpConsole, "/dev/"); | 827 | strcpy(tmpConsole, "/dev/"); |
823 | strncat(tmpConsole, s, 200); | 828 | strncat(tmpConsole, id, 200); |
824 | if (stat(tmpConsole, &statBuf) != 0) { | 829 | if (stat(tmpConsole, &statBuf) != 0) { |
825 | message(LOG | CONSOLE, | 830 | message(LOG | CONSOLE, |
826 | "device '%s' does not exist. Did you read the directions?\n", | 831 | "device '%s' does not exist. Did you read the directions?\n", |
827 | tmpConsole); | 832 | tmpConsole); |
828 | break; | 833 | break; |
829 | } | 834 | } |
830 | s = tmpConsole; | 835 | id = tmpConsole; |
831 | } | 836 | } |
832 | new_initAction(a->action, q, s); | 837 | new_initAction(a->action, process, id); |
833 | foundIt = TRUE; | 838 | foundIt = TRUE; |
834 | } | 839 | } |
835 | a++; | 840 | a++; |
diff --git a/init/init.c b/init/init.c index 38e913121..0e126104b 100644 --- a/init/init.c +++ b/init/init.c | |||
@@ -745,7 +745,7 @@ void parse_inittab(void) | |||
745 | #ifdef BB_FEATURE_USE_INITTAB | 745 | #ifdef BB_FEATURE_USE_INITTAB |
746 | FILE *file; | 746 | FILE *file; |
747 | char buf[256], lineAsRead[256], tmpConsole[256]; | 747 | char buf[256], lineAsRead[256], tmpConsole[256]; |
748 | char *p, *q, *r, *s; | 748 | char *id, *runlev, *action, *process, *eol; |
749 | const struct initActionType *a = actions; | 749 | const struct initActionType *a = actions; |
750 | int foundIt; | 750 | int foundIt; |
751 | 751 | ||
@@ -772,64 +772,69 @@ void parse_inittab(void) | |||
772 | 772 | ||
773 | while (fgets(buf, 255, file) != NULL) { | 773 | while (fgets(buf, 255, file) != NULL) { |
774 | foundIt = FALSE; | 774 | foundIt = FALSE; |
775 | for (p = buf; *p == ' ' || *p == '\t'; p++); | 775 | /* Skip leading spaces */ |
776 | if (*p == '#' || *p == '\n') | 776 | for (id = buf; *id == ' ' || *id == '\t'; id++); |
777 | |||
778 | /* Skip the line if it's a comment */ | ||
779 | if (*id == '#' || *id == '\n') | ||
777 | continue; | 780 | continue; |
778 | 781 | ||
779 | /* Trim the trailing \n */ | 782 | /* Trim the trailing \n */ |
780 | q = strrchr(p, '\n'); | 783 | eol = strrchr(id, '\n'); |
781 | if (q != NULL) | 784 | if (eol != NULL) |
782 | *q = '\0'; | 785 | *eol = '\0'; |
783 | 786 | ||
784 | /* Keep a copy around for posterity's sake (and error msgs) */ | 787 | /* Keep a copy around for posterity's sake (and error msgs) */ |
785 | strcpy(lineAsRead, buf); | 788 | strcpy(lineAsRead, buf); |
786 | 789 | ||
787 | /* Grab the ID field */ | 790 | /* Separate the ID field from the runlevels */ |
788 | s = p; | 791 | runlev = strchr(id, ':'); |
789 | p = strchr(p, ':'); | 792 | if (runlev == NULL || *(runlev + 1) == '\0') { |
790 | if (p != NULL || *(p + 1) != '\0') { | 793 | message(LOG | CONSOLE, "Bad inittab entry: %s\n", lineAsRead); |
791 | *p = '\0'; | 794 | continue; |
792 | ++p; | 795 | } else { |
796 | *runlev = '\0'; | ||
797 | ++runlev; | ||
793 | } | 798 | } |
794 | 799 | ||
795 | /* Now peel off the process field from the end | 800 | /* Separate the runlevels from the action */ |
796 | * of the string */ | 801 | action = strchr(runlev, ':'); |
797 | q = strrchr(p, ':'); | 802 | if (action == NULL || *(action + 1) == '\0') { |
798 | if (q == NULL || *(q + 1) == '\0') { | ||
799 | message(LOG | CONSOLE, "Bad inittab entry: %s\n", lineAsRead); | 803 | message(LOG | CONSOLE, "Bad inittab entry: %s\n", lineAsRead); |
800 | continue; | 804 | continue; |
801 | } else { | 805 | } else { |
802 | *q = '\0'; | 806 | *action = '\0'; |
803 | ++q; | 807 | ++action; |
804 | } | 808 | } |
805 | 809 | ||
806 | /* Now peel off the action field */ | 810 | /* Separate the action from the process */ |
807 | r = strrchr(p, ':'); | 811 | process = strchr(action, ':'); |
808 | if (r == NULL || *(r + 1) == '\0') { | 812 | if (process == NULL || *(process + 1) == '\0') { |
809 | message(LOG | CONSOLE, "Bad inittab entry: %s\n", lineAsRead); | 813 | message(LOG | CONSOLE, "Bad inittab entry: %s\n", lineAsRead); |
810 | continue; | 814 | continue; |
811 | } else { | 815 | } else { |
812 | ++r; | 816 | *process = '\0'; |
817 | ++process; | ||
813 | } | 818 | } |
814 | 819 | ||
815 | /* Ok, now process it */ | 820 | /* Ok, now process it */ |
816 | a = actions; | 821 | a = actions; |
817 | while (a->name != 0) { | 822 | while (a->name != 0) { |
818 | if (strcmp(a->name, r) == 0) { | 823 | if (strcmp(a->name, action) == 0) { |
819 | if (*s != '\0') { | 824 | if (*id != '\0') { |
820 | struct stat statBuf; | 825 | struct stat statBuf; |
821 | 826 | ||
822 | strcpy(tmpConsole, "/dev/"); | 827 | strcpy(tmpConsole, "/dev/"); |
823 | strncat(tmpConsole, s, 200); | 828 | strncat(tmpConsole, id, 200); |
824 | if (stat(tmpConsole, &statBuf) != 0) { | 829 | if (stat(tmpConsole, &statBuf) != 0) { |
825 | message(LOG | CONSOLE, | 830 | message(LOG | CONSOLE, |
826 | "device '%s' does not exist. Did you read the directions?\n", | 831 | "device '%s' does not exist. Did you read the directions?\n", |
827 | tmpConsole); | 832 | tmpConsole); |
828 | break; | 833 | break; |
829 | } | 834 | } |
830 | s = tmpConsole; | 835 | id = tmpConsole; |
831 | } | 836 | } |
832 | new_initAction(a->action, q, s); | 837 | new_initAction(a->action, process, id); |
833 | foundIt = TRUE; | 838 | foundIt = TRUE; |
834 | } | 839 | } |
835 | a++; | 840 | a++; |