示例#1
0
文件: cmdarg.c 项目: JamesLinus/core
/* Check for command line internal arguments */
void hb_cmdargProcess( void )
{
   int iHandles;

   if( hb_cmdargCheck( "INFO" ) )
   {
      {
         char * pszVersion = hb_verHarbour();
         hb_conOutErr( pszVersion, 0 );
         hb_conOutErr( hb_conNewLine(), 0 );
         hb_xfree( pszVersion );
      }

      {
         char * pszVersion = hb_verPlatform();
         hb_conOutErr( pszVersion, 0 );
         hb_conOutErr( hb_conNewLine(), 0 );
         hb_xfree( pszVersion );
      }

      {
         char buffer[ 128 ];
#if defined( HB_CLP_STRICT )
         hb_snprintf( buffer, sizeof( buffer ), "DS avail=%" HB_PFS "uKB  OS avail=%" HB_PFS "uKB  EMM avail=%" HB_PFS "uKB", hb_xquery( HB_MEM_BLOCK ), hb_xquery( HB_MEM_VM ), hb_xquery( HB_MEM_EMS ) );
#else
         hb_snprintf( buffer, sizeof( buffer ), "DS avail=%" HB_PFS "uKB  OS avail=%" HB_PFS "uKB  EMM avail=%" HB_PFS "uKB  MemStat:%s  MT:%s", hb_xquery( HB_MEM_BLOCK ), hb_xquery( HB_MEM_VM ), hb_xquery( HB_MEM_EMS ), hb_xquery( HB_MEM_USEDMAX ) ? "On" : "Off", hb_vmIsMt() ? "On" : "Off" );
#endif
         hb_conOutErr( buffer, 0 );
         hb_conOutErr( hb_conNewLine(), 0 );
      }
   }

   if( hb_cmdargCheck( "BUILD" ) )
      hb_verBuildInfo();

   iHandles = hb_cmdargNum( "F" );
   if( iHandles > 20 )
   {
      #if defined( __WATCOMC__ )
         #if defined( HB_OS_OS2 )
            DosSetMaxFH( iHandles );
         #elif defined( HB_OS_DOS )
            _grow_handles( iHandles );
         #endif
      #endif
   }
   else if( iHandles < 0 )
   {
      #if defined( __WATCOMC__ )
         #if defined( HB_OS_OS2 )
            DosSetMaxFH( 256 );
         #endif
      #endif
   }
}
示例#2
0
int main( int argc, char * argv[] )
#endif
/***************************************/
{
    bool    noerror;

#ifndef DLL_COMPILE
    RcMemInit();
    Layer0InitStatics();
#if !defined(__UNIX__) && !defined(__OSI__) /* _grow_handles doesn't work yet */
    _grow_handles(100);
#endif
#endif
    if( !InitRcMsgs( argv[0] ) ) return( 1 );

    noerror = ScanParams( argc, argv );
    if (!CmdLineParms.Quiet) {
        RcIoPrintBanner();
    }
    if (CmdLineParms.PrintHelp) {
        RcIoPrintHelp( argv[0] );
    }

    if (noerror && !CmdLineParms.Pass2Only) {
        noerror = Pass1();
    }
    if (noerror && !CmdLineParms.Pass1Only && !CmdLineParms.PreprocessOnly ) {
        noerror = Pass2();
    }

    FiniTable();
#ifndef DLL_COMPILE
    ScanParamShutdown();
    FiniRcMsgs();
    RcMemShutdown();
#endif

    if (noerror) {
        return( 0 );
    } else {
        return( 1 );
    }
} /* main */
示例#3
0
文件: client.c 项目: askovpen/binkd
void rel_grow_handles(int nh)
{ LONG addfh=0;
  static ULONG curmaxfh=0;

  LockSem(&fhsem);
  if (curmaxfh == 0)
  { if (DosSetRelMaxFH(&addfh, &curmaxfh))
    { Log(1, "Cannot DosSetRelMaxFH");
      return;
    }
  }
#ifdef __WATCOMC__
  if ((addfh=_grow_handles((int)(curmaxfh += nh))) < curmaxfh)
#else
  addfh=nh;
  if (DosSetRelMaxFH(&addfh, &curmaxfh))
#endif
    Log(1, "Cannot grow handles to %ld (now %ld): %s", curmaxfh, addfh, strerror(errno));
  else
    Log(6, "Set MaxFH to %ld (res %ld)", curmaxfh, addfh);
  ReleaseSem(&fhsem);
}
示例#4
0
void main()
{
    int    i, j, maxh, maxo;
    FILE  *temp_files[50];

    for( i = 25; i < 40; i++ ) {
        /*
            count 5 for stdin, stdout, stderr,
            stdaux, and stdprn
        */
        printf( "Trying for %2.2d handles...", 5 + i );
        maxh = _grow_handles( 5 + i );
        maxo = 0;
        for( j = 0; j < maxh; j++ ) {
            temp_files[j] = tmpfile();
            if( temp_files[j] == NULL )break;
            maxo++;
        }
        printf( " %d/%d temp files opened\n", maxo, maxh );
        for( j = 0; j < maxo; j++ ) {
            fclose( temp_files[j] );
        }
    }
}
示例#5
0
intstar4        __fortran GROWHANDLES( intstar4 *handles ) {
//========================================================

    return( _grow_handles( *handles ) );
}
示例#6
0
文件: lfile.cpp 项目: kenjreno/lora3
int main (int argc, char *argv[])
{
   int i;
   USHORT Purge, Pack, Import, Export, DaysOld, List, Update;
   USHORT KeepDate;
   CHAR *Config = NULL;

#if !defined(__LINUX__)
   _grow_handles (64);
#endif

   Update = Purge = Pack = List = Import = Export = FALSE;
   KeepDate = FALSE;
   DaysOld = 65535U;

   cprintf ("\r\nLFILE; %s v%s - File maintenance utility\r\n", NAME, VERSION);
   cprintf ("       Copyright (c) 1991-96 by Marco Maccaferri. All Rights Reserved.\r\n\r\n");

/*
   if (ValidateKey ("bbs", NULL, NULL) == KEY_UNREGISTERED) {
      cprintf ("* * *     WARNING: No license key found    * * *\r\n");
      if ((i = CheckExpiration ()) == 0) {
         cprintf ("* * *   This evaluation copy has expired   * * *\r\n\a\r\n");
         exit (0);
      }
      else
         cprintf ("* * * You have %2d days left for evaluation * * * \r\n\a\r\n", i);
   }
*/

   if (argc <= 1) {
      cprintf (" * Command-line parameters:\r\n\r\n");

      cprintf ("        -U[K]     Update FILEBASE\r\n");
      cprintf ("                  K=Keep file date\r\n");
      cprintf ("        -I        Import from FILES.BBS\r\n");
      cprintf ("        -E        Export to FILES.BBS\r\n");
      cprintf ("        -P[K]     Pack (compress) file base\r\n");
      cprintf ("                  K=Purge\r\n");
      cprintf ("        -K<d>     Purge files that are <d> days old\r\n");
      cprintf ("        -L        Create a list of available files\r\n");
      cprintf ("        -C<n>     Multiline descriptions begin at column <n>\r\n");
      cprintf ("        -S<c>     Use <c> as the identifier of a multiline description\r\n");

      cprintf ("\r\n * Please refer to the documentation for a more complete command summary\r\n\r\n");
   }
   else {
      for (i = 1; i < argc; i++) {
         if (argv[i][0] == '-' || argv[i][0] == '/') {
            switch (toupper (argv[i][1])) {
               case 'C':
                  Column = (USHORT)(atoi (&argv[i][2]));
                  break;
               case 'I':
                  Import = TRUE;
                  break;
               case 'E':
                  Export = TRUE;
                  break;
               case 'K':
                  Purge = TRUE;
                  DaysOld = (USHORT)atoi (&argv[i][1]);
                  break;
               case 'L':
                  List = TRUE;
                  break;
               case 'P':
                  Pack = TRUE;
                  if (toupper (argv[i][2]) == 'K')
                     Purge = TRUE;
                  break;
               case 'S':
                  Symbol = argv[i][2];
                  break;
               case 'U':
                  Update = TRUE;
                  if (toupper (argv[i][2]) == 'K')
                     KeepDate = TRUE;
                  break;
            }
         }
         else if (Config == NULL)
            Config = argv[i];
      }

      if ((Cfg = new TConfig) != NULL) {
         if (Cfg->Load (Config, NULL) == FALSE)
            Cfg->Default ();
      }

      if (Update == TRUE)
         UpdateFilebase (KeepDate);
      if (Import == TRUE)
         ImportFilesBBS ();
      if (Purge == TRUE)
         PurgeFiles (DaysOld);
      if (Pack == TRUE)
         PackFilebase ();
      if (Export == TRUE)
         ExportFilesBBS ();
      if (List == TRUE)
         CreateFilesList ();

      if (Import == TRUE || Export == TRUE || Purge == TRUE || Pack == TRUE || List == TRUE || Update == TRUE)
         cprintf (" * Done\r\n\r\n");
      else
         cprintf (" * Nothing to do\r\n\r\n");

      if (Cfg != NULL)
         delete Cfg;
   }

   return 0;
}