1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
//
// GENERATED FILE
//
use super::*;
use f2rust_std::*;
pub const ENVLEN: i32 = 32;
pub const VALLEN: i32 = 255;
//$Procedure ZZGETENV ( Get environment variable value. )
pub fn ZZGETENV(ENVVAR: &[u8], VALUE: &mut [u8], ctx: &mut Context) -> f2rust_std::Result<()> {
let mut MYVALU = [b' '; VALLEN as usize];
//
// SPICELIB functions
//
//
// Local variables
//
//
// Standard SPICE error handling.
//
if spicelib::RETURN(ctx) {
return Ok(());
} else {
spicelib::CHKIN(b"ZZGETENV", ctx)?;
}
//
// We do three things:
//
// 1) Check to see if the input is blank.
// 2) Attempt to get the value.
// 3) If we got a nonblank value, see if it will fit in the
// space provided.
//
if fstr::eq(ENVVAR, b" ") {
fstr::assign(&mut MYVALU, b" ");
} else {
ctx.getenv(ENVVAR, &mut MYVALU);
if fstr::ne(&MYVALU, b" ") {
if (spicelib::RTRIM(&MYVALU) > intrinsics::LEN(VALUE)) {
fstr::assign(&mut MYVALU, b" ");
}
}
}
fstr::assign(VALUE, &MYVALU);
spicelib::CHKOUT(b"ZZGETENV", ctx)?;
Ok(())
}