who.c

wsh/src/util/who.c · 510 B

From the archive wsh-147.tar.gz

Download the archive   « Back to the archive contents

#include "../uwtmp.c"
/* This is just a standalone replacement to the built-in shell command
 * I might have use for this later if I ever allow args to who or whatever
 */

/* to fool add_uwtmp() which who.c doesn't use (but it needs envir) */
envir_t envir;

int get_field(fp,str)
  FILE *fp;
  char *str;
{
  int i=0;
  char c;

  while((c=fgetc(fp))!=EOF && c!='\n' && c!=':')
    str[i++]=c;
  str[i]='\0';
  if(i==0 && c!=':') return 0;
  return 1;
}

main() {
  free_who(print_utmp(read_utmp(),"\0"));
}

Site Stats

Snippets: 1791
Codebases: 571