CCL Home Page
Up Directory CCL cmd_head
#include "utility.h"

char *cmd_head(command,line,line_size)
/*============================================================================*/
/* PURPOSE: GET THE FIRST LINE OF OUTPUT FROM THE SPECIFIED COMMAND.
/* WRITTEN: M.V.GRIESHABER
/* LAST MODIFICATION: 11 JUNE 1991 MVG
*/
   char command[];	/* UNIX COMMAND. */
   char line[];		/* FIRST LINE OF OUTPUT. */
   int line_size;	/* SIZE OF LINE. */
   {
   FILE *pipe_ptr;	/* OPEN PIPE TO UNIX COMMAND. */

   /* OPEN A PIPE TO THE SPECIFIED COMMAND, GET THE FIRST LINE AND CLOSE IT. */
   pipe_ptr=popen(command,"r");

   fgets(line,line_size,pipe_ptr);
   line[strlen(line)-1]='\0';		/* ZAP TRAILING NEWLINE. */

   pclose(pipe_ptr);

   return(line);
   }
Modified: Fri Feb 11 17:00:00 1994 GMT
Page accessed 5156 times since Sat Apr 17 21:58:52 1999 GMT