!C99Shell v. 1.0 pre-release build #16!

Software: Apache/2.0.54 (Fedora). PHP/5.0.4 

uname -a: Linux mina-info.me 2.6.17-1.2142_FC4smp #1 SMP Tue Jul 11 22:57:02 EDT 2006 i686 

uid=48(apache) gid=48(apache) groups=48(apache)
context=system_u:system_r:httpd_sys_script_t
 

Safe-mode: OFF (not secure)

/usr/share/doc/db4-devel-4.3.27/examples_cxx/   drwxr-xr-x
Free 3.8 GB of 27.03 GB (14.07%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     SequenceExample.cpp (2.62 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
/*-
* See the file LICENSE for redistribution information.
*
* Copyright (c) 1997-2004
*    Sleepycat Software.  All rights reserved.
*
* $Id: SequenceExample.cpp,v 1.1 2004/09/22 22:20:32 mjc Exp $
*/

#include <sys/types.h>

#include <iostream>
#include <errno.h>
#include <stdlib.h>
#include <string.h>

#ifdef _WIN32
extern "C" {
  extern int getopt(int, char * const *, const char *);
  extern int optind;
}
#else
#include <unistd.h>
#endif

#include <db_cxx.h>

#define    DATABASE    "sequence.db"
#define    SEQUENCE    "my_sequence"

using std::cout;
using std::cerr;

class SequenceExample
{
public:
    SequenceExample();
    void run(bool removeExistingDatabase, const char *fileName);

private:
    // no need for copy and assignment
    SequenceExample(const SequenceExample &);
    void operator = (const SequenceExample &);
};

int
usage()
{
    (void)fprintf(stderr, "usage: SequenceExample [-r] [database]\n");
    return (EXIT_FAILURE);
}

int
main(int argc, char *argv[])
{
    int ch, rflag;
    const char *database;

    rflag = 0;
    while ((ch = getopt(argc, argv, "r")) != EOF)
        switch (ch) {
        case 'r':
            rflag = 1;
            break;
        case '?':
        default:
            return (usage());
        }
    argc -= optind;
    argv += optind;

    /* Accept optional database name. */
    database = *argv == NULL ? DATABASE : argv[0];

    // Use a try block just to report any errors.
    // An alternate approach to using exceptions is to
    // use error models (see DbEnv::set_error_model()) so
    // that error codes are returned for all Berkeley DB methods.
    //
    try {
        SequenceExample app;
        app.run((bool)(rflag == 1 ? true : false), database);
        return (EXIT_SUCCESS);
    }
    catch (DbException &dbe) {
        cerr << "SequenceExample: " << dbe.what() << "\n";
        return (EXIT_FAILURE);
    }
}

SequenceExample::SequenceExample()
{
}

void SequenceExample::run(bool removeExistingDatabase, const char *fileName)
{
    // Remove the previous database.
    if (removeExistingDatabase)
        (void)remove(fileName);

    // Create the database object.
    // There is no environment for this simple example.
    Db db(0, 0);

    db.set_error_stream(&cerr);
    db.set_errpfx("SequenceExample");
    db.open(NULL, fileName, NULL, DB_BTREE, DB_CREATE, 0664);

    // We put a try block around this section of code
    // to ensure that our database is properly closed
    // in the event of an error.
    //
    try {
        Dbt key((void *)SEQUENCE, (u_int32_t)strlen(SEQUENCE));
        DbSequence seq(&db, 0);
        seq.open(0, &key, DB_CREATE);

        for (int i = 0; i < 10; i++) {
            db_seq_t seqnum;
            seq.get(0, 1, &seqnum, 0);
            cout << "Got sequence number: " << seqnum << "\n";
        }

        seq.close(0);
    } catch (DbException &dbe) {
        cerr << "SequenceExample: " << dbe.what() << "\n";
    }

    db.close(0);
}

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

:: Make Dir ::
 
[ Read-Only ]
:: Make File ::
 
[ Read-Only ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 1.0 pre-release build #16 powered by Captain Crunch Security Team | http://ccteam.ru | Generation time: 0.0034 ]--