00001 #if defined(macintosh)
00002 #include <types.h>
00003 #include <time.h>
00004 #else
00005 #include <sys/types.h>
00006 #include <sys/time.h>
00007 #endif
00008 #include <stdio.h>
00009 #include "merc.h"
00010
00011
00012
00013
00014 FILE * popen args( ( const char *command, const char *type ) );
00015 int pclose args( ( FILE *stream ) );
00016 char * fgetf args( ( char *s, int n, register FILE *iop ) );
00017
00018 void do_pipe( CHAR_DATA *ch, char *argument )
00019 {
00020
00021
00022
00023
00024
00025 char buf[5000];
00026 FILE *fp;
00027
00028 fp = popen( argument, "r" );
00029
00030 fgetf( buf, 5000, fp );
00031
00032 page_to_char( buf, ch );
00033
00034 pclose( fp );
00035
00036 return;
00037 }
00038
00039 char *fgetf( char *s, int n, register FILE *iop )
00040 {
00041 register int c;
00042 register char *cs;
00043
00044 c = '\0';
00045 cs = s;
00046 while( --n > 0 && (c = getc(iop)) != EOF)
00047 if ((*cs++ = c) == '\0')
00048 break;
00049 *cs = '\0';
00050 return((c == EOF && cs == s) ? NULL : s);
00051 }
00052