Example #1
0
/**
 * Handle TIME messages
 *
 * @param source is the nick of the person whom requested
 * @param ac is the parameter count
 * @param av is the array
 *
 * @return always returns MOD_CONT
 */
int m_time(char *source, int ac, char **av)
{
    time_t t;
    struct tm tm;
    char buf[64];

    USE_VAR(ac);
    USE_VAR(av);

    *buf = '\0';

    if (!source) {
        return MOD_CONT;
    }

    time(&t);
#ifdef MSVS2005
    localtime_s(&tm, &t);
#else
    tm = *localtime(&t);
#endif
    strftime(buf, 63, "%a %b %d %H:%M:%S %Y %Z", &tm);
    denora_cmd_391(source, buf);

    return MOD_CONT;
}
Example #2
0
File: strings.c Project: mej/libast
spif_charptr_t *
spiftool_split_regexp(const spif_charptr_t regexp, const spif_charptr_t str)
{
    USE_VAR(regexp);
    USE_VAR(str);
    return (NULL);
}
Example #3
0
void timeout(OPM_T *scanner, OPM_REMOTE_T *remote, int notused, void *data)
{
   USE_VAR(scanner);
   USE_VAR(notused);
   USE_VAR(data);

   printf("Negotiation timed out on %s:%d\n", remote->ip, remote->port);
}
Example #4
0
void end(OPM_T *scanner, OPM_REMOTE_T *remote, int notused, void *data)
{
   USE_VAR(scanner);
   USE_VAR(notused);
   USE_VAR(data);

   printf("Scan on %s has ended\n", remote->ip);
   opm_remote_free(remote);
   complete = 1;
}
Example #5
0
void negotiation_failed(OPM_T *scanner, OPM_REMOTE_T *remote, int notused,
      void *data)
{
   USE_VAR(scanner);
   USE_VAR(notused);
   USE_VAR(data);

   printf("Negotiation on %s:%d failed [%d bytes read]\n", remote->ip,
         remote->port, remote->bytes_read);
}
Example #6
0
void open_proxy(OPM_T *scanner, OPM_REMOTE_T *remote, int notused,
      void *data)
{
   USE_VAR(notused);
   USE_VAR(data);

   printf("Open proxy on %s:%d [%d bytes read]\n", remote->ip,
         remote->port, remote->bytes_read);
   opm_end(scanner, remote);
}
Example #7
0
/**
 * Handle VERSION commands
 *
 * @param source is the nick of the person whom sent the version command
 * @param ac is the parameter count
 * @param av is the parameter array
 *
 * @return always returns MOD_CONT
 */
int m_version(char *source, int ac, char **av)
{

    USE_VAR(ac);
    USE_VAR(av);

    if (source) {
        denora_cmd_351(source);
    }
    return MOD_CONT;
}
Example #8
0
/*
 * This routine returns the highest address of the segments in the program (NOT
 * the shared libraries).  It is intended to be used as a stop gap for programs
 * that make UNIX style assumptions about how memory is allocated.  Typicly the
 * asumptions under which this is used is that memory is contiguously allocated
 * by the program's text and data from address 0 with no gaps.  The value of
 * this differs from the value of &_end in a UNIX program in that this routine
 * returns the address of the end of the segment not the end of the last section
 * in that segment as would be the value of the symbol &_end.
 */
unsigned long
get_end(void)
{
    static struct mach_header *mhp = (struct mach_header *)0;
    struct segment_command *sgp;
    unsigned long i, _end;
#ifndef __OPENSTEP__
	if (mhp  == (struct mach_header *)0) {
	    mhp = _NSGetMachExecuteHeader();
	}
#else /* defined(__OPENSTEP__) */
    DECLARE_VAR(_mh_execute_header, struct mach_header);
    SETUP_VAR(_mh_execute_header);

	mhp = (struct mach_header *)(& USE_VAR(_mh_execute_header));
#endif /* __OPENSTEP__ */
	_end = 0;
	sgp = (struct segment_command *)
	      ((char *)mhp + sizeof(struct mach_header));
	for(i = 0; i < mhp->ncmds; i++){
	    if(sgp->cmd == LC_SEGMENT)
		if(sgp->vmaddr + sgp->vmsize > _end)
		    _end = sgp->vmaddr + sgp->vmsize;
	    sgp = (struct segment_command *)((char *)sgp + sgp->cmdsize);
	}
	return(_end);
}
Example #9
0
const struct segment_command *
getsegbyname(
char *segname)
{
    struct segment_command *sgp;
    uint32_t i;
#ifndef RLD
#ifndef __OPENSTEP__
    struct mach_header *mhp = _NSGetMachExecuteHeader();
#else /* defined(__OPENSTEP__) */
    static struct mach_header *mhp = NULL;
        DECLARE_VAR(_mh_execute_header, struct mach_header);
        SETUP_VAR(_mh_execute_header);
	mhp = (struct mach_header *)(& USE_VAR(_mh_execute_header));
#endif /* __OPENSTEP__ */
#else /* defined(RLD) */
	mhp = (struct mach_header *)(&_mh_execute_header);
#endif /* defined(RLD) */
        
	sgp = (struct segment_command *)
	      ((char *)mhp + sizeof(struct mach_header));
	for(i = 0; i < mhp->ncmds; i++){
	    if(sgp->cmd == LC_SEGMENT)
		if(strncmp(sgp->segname, segname, sizeof(sgp->segname)) == 0)
		    return(sgp);
	    sgp = (struct segment_command *)((char *)sgp + sgp->cmdsize);
	}
	return(NULL);
}
Example #10
0
void handle_error(OPM_T *scanner, OPM_REMOTE_T *remote, int err, void *data)
{
   USE_VAR(scanner);
   USE_VAR(data);

   switch(err)
   {
      case OPM_ERR_MAX_READ:
         printf("Reached MAX READ on %s:%d\n", remote->ip, remote->port);
         break;
      case OPM_ERR_BIND:
         printf("Unable to bind for %s:%d\n", remote->ip, remote->port);
         break;
      case OPM_ERR_NOFD:
         printf("Unable to allocate file descriptor for %s:%d\n",
               remote->ip, remote->port);
         break;
      default:
         printf("Unknown error on %s:%d, err = %d\n", remote->ip,
               remote->port, err);
   }
}
Example #11
0
const struct section *
getsectbyname(
    const char *segname,
    const char *sectname)
{
#ifndef __OPENSTEP__
    struct mach_header *mhp = _NSGetMachExecuteHeader();
#else /* defined(__OPENSTEP__) */
    static struct mach_header *mhp = NULL;
    DECLARE_VAR(_mh_execute_header, struct mach_header);
    SETUP_VAR(_mh_execute_header);
    mhp = (struct mach_header *)(& USE_VAR(_mh_execute_header));
#endif /* __OPENSTEP__ */
    return(getsectbynamefromheader(mhp, segname, sectname));
}
Example #12
0
struct mach_header *_NSGetMachExecuteHeader(void) {
    return(USE_VAR(_mh_execute_header));
}
Example #13
0
int *_NSGetArgc(void) {
    return(USE_VAR(NXArgc));
}
Example #14
0
File: eval.c Project: xyzy/bash-4.3
/* Read and execute commands until EOF is reached.  This assumes that
   the input source has already been initialized. */
   int
   reader_loop ()
   {
    //printf("reader_loop  ------>  Start\n");
    int our_indirection_level;
    COMMAND * volatile current_command;

    USE_VAR(current_command);

    current_command = (COMMAND *)NULL;

    our_indirection_level = ++indirection_level;

    while (EOF_Reached == 0)
    {
      //printf("EOF_Reached == 0   =======>   Start\n");
      int code;

      code = setjmp_nosigs (top_level);

#if defined (PROCESS_SUBSTITUTION)
      unlink_fifo_list ();
#endif /* PROCESS_SUBSTITUTION */

      /* XXX - why do we set this every time through the loop? */
      if (interactive_shell && signal_is_ignored (SIGINT) == 0)
      {
        //printf("if (interactive_shell && signal_is_ignored (SIGINT) == 0)\n");
       set_signal_handler (SIGINT, sigint_sighandler);
      }

     if (code != NOT_JUMPED)
     {
      //printf("if (code != NOT_JUMPED)\n");
       indirection_level = our_indirection_level;

       switch (code)
       {
	      /* Some kind of throw to top_level has occurred. */
         case FORCE_EOF:
         case ERREXIT:
         case EXITPROG:
         //printf("case EXITPROG:\n");
         current_command = (COMMAND *)NULL;
         if (exit_immediately_on_error)
          {
            //printf("if (exit_immediately_on_error)\n");
            variable_context = 0; /* not in a function */
          }

           EOF_Reached = EOF;
         goto exec_done;

         case DISCARD:
         //printf("case DISCARD:\n");
	      /* Make sure the exit status is reset to a non-zero value, but
		 leave existing non-zero values (e.g., > 128 on signal)
		 alone. */
    if (last_command_exit_value == 0)
    {
      //printf("if (last_command_exit_value == 0)\n");
      last_command_exit_value = EXECUTION_FAILURE;
    }

    if (subshell_environment)
    {
      //printf("if (subshell_environment)\n");
      current_command = (COMMAND *)NULL;
      EOF_Reached = EOF;
      goto exec_done;
    }
	      /* Obstack free command elements, etc. */
    if (current_command)
    {
      //printf("if (current_command)\n");
      dispose_command (current_command);
      current_command = (COMMAND *)NULL;
    }
#if defined (HAVE_POSIX_SIGNALS)
    sigprocmask (SIG_SETMASK, &top_level_mask, (sigset_t *)NULL);
#endif
    break;

    default:
    command_error ("reader_loop", CMDERR_BADJUMP, code, 0);
  }
}

executing = 0;
if (temporary_env)
{
  //printf("if (temporary_env)\n");
	dispose_used_env_vars ();
}

#if (defined (ultrix) && defined (mips)) || defined (C_ALLOCA)
      /* Attempt to reclaim memory allocated with alloca (). */
(void) alloca (0);
#endif

if (read_command () == 0)
{
  //printf("read_command () == 0\n");
  if (interactive_shell == 0 && read_but_dont_execute)
  {
    //printf("if (interactive_shell == 0 && read_but_dont_execute)");
    last_command_exit_value = EXECUTION_SUCCESS;
    dispose_command (global_command);
    global_command = (COMMAND *)NULL;
  }
  else if (current_command = global_command)
  {
    //printf("else if (current_command:%d = global_command:%d)\n",current_command, global_command);
    global_command = (COMMAND *)NULL;
    current_command_number++;

    executing = 1;
    stdin_redir = 0;
    execute_command (current_command);

    exec_done:
    QUIT;

    if (current_command)
    {
      //printf("if (current_command)\n");
      dispose_command (current_command);
      current_command = (COMMAND *)NULL;
    }
  }
}
else
{
	       /* Parse error, maybe discard rest of stream if not interactive. */
  if (interactive == 0)
  {
    //printf("if (interactive == 0)\n");
    EOF_Reached = EOF;
  }
}

if (just_one_command)
{
 //printf("just_one_command\n");
 EOF_Reached = EOF;
}
//printf("EOF_Reached == 0   =======>   Exit\n");
}
indirection_level--;
  //printf("reader_loop  ------>  Exit\n");

return (last_command_exit_value);
}