Пример #1
0
void AccessFlags::print_on(outputStream* st) const {
  if (is_public      ()) st->print("public "      );
  if (is_private     ()) st->print("private "     );
  if (is_protected   ()) st->print("protected "   );
  if (is_static      ()) st->print("static "      );
  if (is_final       ()) st->print("final "       );
  if (is_synchronized()) st->print("synchronized ");
  if (is_volatile    ()) st->print("volatile "    );
  if (is_transient   ()) st->print("transient "   );
  if (is_native      ()) st->print("native "      );
  if (is_interface   ()) st->print("interface "   );
  if (is_abstract    ()) st->print("abstract "    );
  if (is_strict      ()) st->print("strict "      );
  if (is_synthetic   ()) st->print("synthetic "   );
  if (is_old         ()) st->print("{old} "       );
  if (is_obsolete    ()) st->print("{obsolete} "  );
}
Пример #2
0
// ------------------------------------------------------------------
// ciFlags::print_member_flags
void ciFlags::print_member_flags(outputStream* st) {
  if (is_public()) {
    st->print("public");
  } else if (is_private()) {
    st->print("private");
  } else if (is_protected()) {
    st->print("protected");
  } else {
    st->print("DEFAULT_ACCESS");
  }

  if (is_static()) {
    st->print(",static");
  }
  if (is_final()) {
    st->print(",final");
  }
  if (is_synchronized()) {
    st->print(",synchronized");
  }
  if (is_volatile()) {
    st->print(",volatile");
  }
  if (is_transient()) {
    st->print(",transient");
  }
  if (is_native()) {
    st->print(",native");
  }
  if (is_abstract()) {
    st->print(",abstract");
  }
  if (is_strict()) {
    st->print(",strict");
  }

}
Пример #3
0
int
write_file_to_disk(int fd, struct cf_t *file, time_t time_date)
/* write the data on the disk */
{
    cl_t *line = NULL;
    env_t *env = NULL;
    char write_buf[WRITE_BUF_LEN];
    int write_buf_used = 0;

    /* put program's version : it permits to daemon not to load
     * a file which he won't understand the syntax, for exemple
     * a file using a depreciated format generated by an old fcrontab,
     * if the syntax has changed */
    /* an binary fcrontab *must* start by such a header */
    Save_lint(fd, S_HEADER_T, S_FILEVERSION, write_buf, &write_buf_used);

    /* put the user's name : needed to check if his uid has not changed */
    /* S_USER_T *must* be the 2nd field of a binary fcrontab */
    Save_str(fd, S_USER_T, file->cf_user, write_buf, &write_buf_used);

    /* put the time & date of saving : this is use for calcutating 
     * the system down time. As it is a new file, we set it to 0 */
    /* S_USER_T *must* be the 3rd field of a binary fcrontab */
    Save_lint(fd, S_TIMEDATE_T, time_date, write_buf, &write_buf_used);

    /* Save the time diff between local (real) and system hour (if any) */
    if ( file->cf_tzdiff != 0 )
	Save_lint(fd, S_TZDIFF_T, file->cf_tzdiff, write_buf, &write_buf_used);

    /*   env variables, */
    for (env = file->cf_env_base; env; env = env->e_next)
	Save_str(fd, S_ENVVAR_T, env->e_val, write_buf, &write_buf_used);
	
    /*   then, lines. */
    for (line = file->cf_line_base; line; line = line->cl_next) {

	/* this ones are saved for every lines */
	Save_str(fd, S_SHELL_T, line->cl_shell, write_buf, &write_buf_used);
	Save_str(fd, S_RUNAS_T, line->cl_runas, write_buf, &write_buf_used);
	Save_str(fd, S_MAILTO_T, line->cl_mailto, write_buf, &write_buf_used);
	Save_strn(fd, S_OPTION_T, (char *)line->cl_option, OPTION_SIZE,
		  (char *)write_buf, &write_buf_used);

	/* the following are saved only if needed */
	if ( is_volatile(line->cl_option) && is_freq(line->cl_option) ) {
	    Save_lint(fd, S_FIRST_T, line->cl_first, write_buf, &write_buf_used);
	}
	else
	    Save_lint(fd, S_NEXTEXE_T, line->cl_nextexe, write_buf, &write_buf_used);
	if ( line->cl_numexe )
	    Save_strn(fd, S_NUMEXE_T, (char *)&line->cl_numexe, 1, (char *)write_buf, &write_buf_used);
	if ( is_lavg(line->cl_option) )
	    Save_strn(fd, S_LAVG_T, (char *)line->cl_lavg, LAVG_SIZE,
		      (char *)write_buf, &write_buf_used);
	if ( line->cl_until > 0 )
	    Save_lint(fd, S_UNTIL_T, line->cl_until, write_buf, &write_buf_used);
	if ( line->cl_nice != 0 )
	    Save_strn(fd, S_NICE_T, &line->cl_nice, 1, write_buf, &write_buf_used);
	if ( line->cl_runfreq > 0 ) {
	    Save_lint(fd, S_RUNFREQ_T, line->cl_runfreq, write_buf, &write_buf_used);
	    Save_lint(fd, S_REMAIN_T, line->cl_remain, write_buf, &write_buf_used);
	}
		     
	if ( is_freq(line->cl_option) ) {
	    /* save the frequency to run the line */
	    Save_lint(fd, S_TIMEFREQ_T, line->cl_timefreq, write_buf, &write_buf_used);
	}
	else {
	    /* save the time and date bit fields */
	    Save_strn(fd, S_MINS_T, (char *)line->cl_mins, bitstr_size(60),
		      (char *)write_buf, &write_buf_used);
	    Save_strn(fd, S_HRS_T, (char *)line->cl_hrs, bitstr_size(24),
		      (char *)write_buf, &write_buf_used);
	    Save_strn(fd, S_DAYS_T, (char *)line->cl_days, bitstr_size(32),
		      (char *)write_buf, &write_buf_used);
	    Save_strn(fd, S_MONS_T, (char *)line->cl_mons, bitstr_size(12),
		      (char *)write_buf, &write_buf_used);
	    Save_strn(fd, S_DOW_T, (char *)line->cl_dow, bitstr_size(8),
		      (char *)write_buf, &write_buf_used);
	}

	/* This field *must* be the last of each line */
	Save_type(fd, S_ENDLINE_T, write_buf, &write_buf_used);
    }

    if ( write_buf_to_disk(fd, write_buf, &write_buf_used) == ERR )
	return ERR;

    return OK;
}