Listing3
/* ------------------- updatePrnQT.c ----------------------------                

                  Update User Print Quota

   This program reads user's new print quota information from the
 environment variable, PRNQINFO and writes to user's print quota
 file according to enviornment variable, PRNQFILE.

   The UID of lp is 71 on Solaris system.

  ---------------------------------------------------------------- */
 
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
main()
{
  char *tfile,*ufile;
  const char *EnvStr1="PRNQINFO";
  const char *EnvStr2="PRNQFILE";
  FILE *topen;
  setuid(71);
  ufile = getenv( EnvStr1 );
  tfile = getenv( EnvStr2 );
  topen = fopen( tfile,"w+");
  fprintf(topen,"%s\n",ufile);
  chmod(tfile,0644);
  fclose(topen);
}

