Deleted Added
sdiff udiff text old ( 143151 ) new ( 143319 )
full compact
1/*-
2 * Copyright (c) 1998 Michael Smith
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 21 unchanged lines hidden (view full) ---

30 * dynamic array of strings later when the VM subsystem is up.
31 *
32 * We make these available through the kenv(2) syscall for userland
33 * and through getenv()/freeenv() setenv() unsetenv() testenv() for
34 * the kernel.
35 */
36
37#include <sys/cdefs.h>
38__FBSDID("$FreeBSD: head/sys/kern/kern_environment.c 143319 2005-03-09 12:16:45Z des $");
39
40#include "opt_mac.h"
41
42#include <sys/types.h>
43#include <sys/param.h>
44#include <sys/proc.h>
45#include <sys/queue.h>
46#include <sys/lock.h>

--- 406 unchanged lines hidden (view full) ---

453 char *value;
454 char *vtp;
455 quad_t iv;
456
457 value = getenv(name);
458 if (value == NULL)
459 return (0);
460 iv = strtoq(value, &vtp, 0);
461 if (vtp == value || (vtp[0] != '\0' && vtp[1] != '\0')) {
462 freeenv(value);
463 return (0);
464 }
465 switch (vtp[0]) {
466 case 't': case 'T':
467 iv *= 1024;
468 case 'g': case 'G':
469 iv *= 1024;
470 case 'm': case 'M':
471 iv *= 1024;
472 case 'k': case 'K':
473 iv *= 1024;
474 case '\0':
475 break;
476 default:
477 freeenv(value);
478 return (0);
479 }
480 *data = iv;
481 freeenv(value);
482 return (1);
483}
484
485/*
486 * Find the next entry after the one which (cp) falls within, return a
487 * pointer to its start or NULL if there are no more.
488 */
489static char *

--- 44 unchanged lines hidden ---