hush: HUSH_READONLY depends on HUSH
[oweals/busybox.git] / shell / shell_common.c
index 549b17ca11252b86c9aed8c17482a2e085a937ea..bf56f3d78b9e4c121d3c7b8d48c879ed4b5bd18f 100644 (file)
@@ -204,15 +204,17 @@ shell_builtin_read(void FAST_FUNC (*setvar)(const char *name, const char *val),
                c = buffer[bufpos];
                if (c == '\0')
                        continue;
-               if (backslash) {
-                       backslash = 0;
-                       if (c != '\n')
-                               goto put;
-                       continue;
-               }
-               if (!(read_flags & BUILTIN_READ_RAW) && c == '\\') {
-                       backslash = 1;
-                       continue;
+               if (!(read_flags & BUILTIN_READ_RAW)) {
+                       if (backslash) {
+                               backslash = 0;
+                               if (c != '\n')
+                                       goto put;
+                               continue;
+                       }
+                       if (c == '\\') {
+                               backslash = 1;
+                               continue;
+                       }
                }
                if (c == '\n')
                        break;
@@ -401,17 +403,9 @@ shell_builtin_ulimit(char **argv)
        /* In case getopt was already called:
         * reset the libc getopt() function, which keeps internal state.
         */
-#ifdef __GLIBC__
-       optind = 0;
-#else /* BSD style */
-       optind = 1;
-       /* optreset = 1; */
-#endif
-       /* optarg = NULL; opterr = 0; optopt = 0; - do we need this?? */
+       GETOPT_RESET();
 
-       argc = 1;
-       while (argv[argc])
-               argc++;
+       argc = string_array_len(argv);
 
        opts = 0;
        while (1) {