ftp.nice.ch/pub/next/connectivity/mail/apps/MailEnclosure.0.15.NIHS.bs.tar.gz#/MailEnclosure/Source.v0.15/NXGets.c

This is NXGets.c in view mode; [Download] [Up]

#import "NXGets.h"
#import <stdio.h>

/*
 * Copyright 1992, Ronin Consulting Inc.
 * $Id: NXGets.c,v 1.2 94/04/10 13:12:59 nwc Exp $
 */

char *NXGets(char *buf, int n, NXStream *s)
{
   char c = (char)0;
   int x;
   
   n--;					     /* we only read n - 1 */
   for(x = 0; x < n; x++)
     {
	c = NXGetc(s);
	if(c == EOF || c == '\n')	     /* new line of EOF boots us */
	  break;
	
	buf[x] = c;
     }

   buf[x] = (char)0;			     /* null terminate */

   if(c == EOF)
     return (char *)0;
   else
     return buf;
}

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.