rt-thread/examples/libc/env.c

23 lines
452 B
C
Raw Normal View History

2013-01-08 21:05:02 +08:00
/*
* Copyright (c) 2006-2021, RT-Thread Development Team
2013-01-08 21:05:02 +08:00
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2010-11-17 Bernard first version
2013-01-08 21:05:02 +08:00
*/
2013-01-08 21:05:02 +08:00
#include <stdio.h>
#include <stdlib.h>
#include <finsh.h>
int libc_env()
{
2021-03-07 08:34:04 +08:00
printf("PATH=%s\n", getenv("PATH"));
putenv("foo=bar");
printf("foo=%s\n", getenv("foo"));
return 0;
2013-01-08 21:05:02 +08:00
}
FINSH_FUNCTION_EXPORT(libc_env, get/set_env test);