Exemplo n.º 1
0
/* 
** DISP -- display integrity, permit, or define query on a relation
**
**	Finds a relation owned by the user or the DBA and passes
**	the name and owner to the appropritae routine depending on
**	mode.
**
**	Parameters:
**		relation -- relation on which query is to be printed
**		mode -- the print mode:
**			4 -- view
**			5 -- permit
**			6 -- integrity
**
**	Returns:
**		0 -- success
**		1 -- no such relation, or none seeable by the user.
**		3 -- VIEW mode and relation not a view
**		4 -- PERMIT and no permissions on relation
**		5 -- INTEGRITY mode and no integrity constraints
**
**	Trace Flags:
**		33, 8
*/
int
disp(char *relation, int mode)
{
	desc_t		d;
	register int	i;
	extern char	*Resrel;

#ifdef xZTR1
	if (tTf(50, 8))
		printf("disp: relation %s\n", relation);
#endif

	Resrel = relation;
	i = openr(&d, OR_RELTID, relation);
	if (i > 0)
		return (1);
	else if (i < 0)
		syserr("disp: openr(%s) ret %d", relation, i);
	switch (mode) {
	  case 4:		/* View query */
		if (d.d_r.r_status & S_VIEW)
			pr_def(relation, d.d_r.r_owner);
		else 
			return (3);
		break;

	  case 5:
		if (pr_prot(relation, (relation_t *) &d))
			return (4);
		break;

	  case 6:
		if (d.d_r.r_status & S_INTEG)
			pr_integrity(relation, d.d_r.r_owner);
		else
			return (5);
		break;

	  default:
		syserr("disp: mode == %d", mode);
	}
	return (0);
}
Exemplo n.º 2
0
Arquivo: prfn.c Projeto: Ruyk/gromacs
void pr_texdefs(FILE *fp)
{
  int i;

  fprintf(fp,"\\begin{table}\n");
  fprintf(fp,"\\begin{tabularx}{\\linewidth}{|r@{\\tt.}lccX|}\n");
  fprintf(fp,"\\dline\n");
  fprintf(fp,"\\mc{2}{|c}{%s} & %4s & %7s & %s \\\\[-0.1ex]\n",
	  "Default","","Default","");
  fprintf(fp,"\\mc{1}{|c}{%s} & \\mc{1}{c}{%s} & %4s & %7s & %s "
	  "\\\\[-0.1ex]\n",
	  "Name","Ext.","Type","Option","Description");
  fprintf(fp,"\\hline\n");
  for(i=0; (i<efNR); i++)
    if ( (i!=efGCT) && (i!=efHAT) )
      pr_def(fp,i);
  fprintf(fp,"\\dline\n");
  fprintf(fp,"\\end{tabularx}\n");
  fprintf(fp,"\\caption{The {\\gromacs} file types.}\n");
  fprintf(fp,"\\label{tab:form}\n");
  fprintf(fp,"\\end{table}\n");
}