]> Zhao Yanbai Git Server - minix.git/commitdiff
Device variables get copies of their contents in *_n variables for scripts
authorBen Gras <ben@minix3.org>
Tue, 3 May 2005 15:38:41 +0000 (15:38 +0000)
committerBen Gras <ben@minix3.org>
Tue, 3 May 2005 15:38:41 +0000 (15:38 +0000)
that want the device name (as opposed to the number for the kernel).

boot/boot.c

index c948f29265d8a327622fc77dfe498f01eff53bfb..3fbef84f526c422e5345af4d01d5deff5e7c7d00 100755 (executable)
@@ -741,13 +741,28 @@ int b_setenv(int flags, char *name, char *arg, char *value)
        }
        e->arg= copystr(arg);
        e->value= copystr(value);
+
+       if(e->flags & E_DEV) {
+               char newname[30];
+               strncpy(newname, name, sizeof(newname)-3);
+               newname[sizeof(newname)-4] = '\0';
+               strcat(newname, "_n");
+               b_setenv(E_VAR, newname, arg, value);
+       }
+
        return 0;
 }
 
 int b_setvar(int flags, char *name, char *value)
 /* Set variable or simple function. */
 {
-       return b_setenv(flags, name, null, value);
+       int r;
+
+       if((r=b_setenv(flags, name, null, value))) {
+               return r;
+       }
+
+       return r;
 }
 
 void b_unset(char *name)