/* cuserid.c (emx+gcc) -- Copyright (c) 1994-1995 by Eberhard Mattes */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

char *_cuserid (char *buffer)
{
  static char tmp_name[L_cuserid];
  const char *name;

  name = getenv ("LOGNAME");
  if (name == NULL)
    name = getenv ("USER");
  if (name == NULL)
    name = "root";
  if (buffer == NULL)
    buffer = tmp_name;
  _strncpy (buffer, name, L_cuserid);
  return buffer;
}
