Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 4972 → Rev 4973

/programs/develop/libraries/menuetlibc/src/libc/compat/v1/Makefile
0,0 → 1,3
THIS_SRCS = _bcopy.s fpurge.c setenv.c
 
include $(MENUET_LIBC_TOPDIR)/Make.rules
/programs/develop/libraries/menuetlibc/src/libc/compat/v1/_bcopy.s
0,0 → 1,4
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
#include<libc/asm.h>
MK_C_SYM(_bcopy)
jmp C_SYM(bcopy)
/programs/develop/libraries/menuetlibc/src/libc/compat/v1/fpurge.c
0,0 → 1,18
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
#include <stdio.h>
#include <libc/file.h>
 
int
fpurge(FILE *f)
{
char *base;
 
if ((f->_flag&(_IONBF|_IOWRT))==_IOWRT
&& (base = f->_base) != NULL
&& (f->_ptr - base) > 0)
{
f->_ptr = base;
f->_cnt = (f->_flag&(_IOLBF|_IONBF)) ? 0 : f->_bufsiz;
}
return 0;
}
/programs/develop/libraries/menuetlibc/src/libc/compat/v1/setenv.c
0,0 → 1,33
/* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */
#include <libc/stubs.h>
#include <stdlib.h>
#include <string.h>
 
int
setenv (const char *var, const char *val, int replace)
{
char *prev;
 
if (var == (char *)0 || val == (char *)0)
return -1;
 
if ((prev = getenv (var)) && !replace)
return 0;
else
{
size_t l_var = strlen (var);
char *envstr = (char *)alloca (l_var + strlen (val) + 2);
char *peq = strchr (var, '=');
 
if (*val == '=')
++val;
if (peq)
l_var = peq - var;
 
strncpy (envstr, var, l_var);
envstr[l_var++] = '=';
strcpy (envstr + l_var, val);
 
return putenv (envstr);
}
}