1 /* sysenv 1.0 - request system boot parameter Author: Kees J. Bot
5 #include <minix/type.h>
7 #include <sys/svrctl.h>
14 #define NIL ((char*)0)
16 static void tell(int fd
, ...)
22 while ((s
= va_arg(ap
, char *)) != NIL
) {
23 (void) write(fd
, s
, strlen(s
));
28 int main(int argc
, char **argv
)
30 struct sysgetenv sysgetenv
;
37 while (i
< argc
&& argv
[i
][0] == '-') {
38 char *opt
= argv
[i
++]+1;
40 if (opt
[0] == '-' && opt
[1] == 0) break; /* -- */
43 tell(2, "Usage: sysenv [name ...]\n", NIL
);
50 sysgetenv
.key
= argv
[i
];
51 sysgetenv
.keylen
= strlen(sysgetenv
.key
) + 1;
57 sysgetenv
.vallen
= sizeof(val
);
59 if (svrctl(PMGETPARAM
, &sysgetenv
) == -1) {
64 tell(2, "sysenv: ", strerror(errno
), "\n", NIL
);
73 } while (i
== argc
&& *e
!= 0);
75 if (write(1, sysgetenv
.val
, e
- sysgetenv
.val
) < 0) {
77 tell(2, "sysenv: ", strerror(errno
), "\n", NIL
);