~ubuntu-branches/ubuntu/raring/virtualbox-ose/raring

« back to all changes in this revision

Viewing changes to src/VBox/Frontends/VBoxManage/VBoxManageDHCPServer.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Felix Geyer
  • Date: 2011-01-30 23:27:25 UTC
  • mfrom: (0.3.12 upstream)
  • Revision ID: james.westby@ubuntu.com-20110130232725-2ouajjd2ggdet0zd
Tags: 4.0.2-dfsg-1ubuntu1
* Merge from Debian unstable, remaining changes:
  - Add Apport hook.
    - debian/virtualbox-ose.files/source_virtualbox-ose.py
    - debian/virtualbox-ose.install
  - Drop *-source packages.
* Drop ubuntu-01-fix-build-gcc45.patch, fixed upstream.
* Drop ubuntu-02-as-needed.patch, added to the Debian package.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* $Id: VBoxManageDHCPServer.cpp $ */
 
1
/* $Id: VBoxManageDHCPServer.cpp 33489 2010-10-27 10:31:41Z vboxsync $ */
2
2
/** @file
3
3
 * VBoxManage - Implementation of dhcpserver command.
4
4
 */
5
5
 
6
6
/*
7
 
 * Copyright (C) 2006-2009 Oracle Corporation
 
7
 * Copyright (C) 2006-2010 Oracle Corporation
8
8
 *
9
9
 * This file is part of VirtualBox Open Source Edition (OSE), as
10
10
 * available from http://www.virtualbox.org. This file is free software;
26
26
#include <VBox/com/EventQueue.h>
27
27
 
28
28
#include <VBox/com/VirtualBox.h>
29
 
 
30
 
#include <vector>
31
 
#include <list>
32
29
#endif /* !VBOX_ONLY_DOCS */
33
30
 
34
31
#include <iprt/cidr.h>
281
278
 
282
279
int handleDHCPServer(HandlerArg *a)
283
280
{
284
 
    int result = 0;
285
281
    if (a->argc < 1)
286
282
        return errorSyntax(USAGE_DHCPSERVER, "Not enough parameters");
287
283
 
288
 
    for (int i = 0; i < a->argc; i++)
289
 
    {
290
 
        if (strcmp(a->argv[i], "modify") == 0)
291
 
        {
292
 
            int cProcessed;
293
 
            result = handleOp(a, OP_MODIFY, i+1, &cProcessed);
294
 
            break;
295
 
        }
296
 
        else if (strcmp(a->argv[i], "add") == 0)
297
 
        {
298
 
            int cProcessed;
299
 
            result = handleOp(a, OP_ADD, i+1, &cProcessed);
300
 
            break;
301
 
        }
302
 
        else if (strcmp(a->argv[i], "remove") == 0)
303
 
        {
304
 
            int cProcessed;
305
 
            result = handleOp(a, OP_REMOVE, i+1, &cProcessed);
306
 
            break;
307
 
        }
308
 
        else
309
 
        {
310
 
            result = errorSyntax(USAGE_DHCPSERVER, "Invalid parameter '%s'", Utf8Str(a->argv[i]).raw());
311
 
            break;
312
 
        }
313
 
    }
 
284
    int result;
 
285
    int cProcessed;
 
286
    if (strcmp(a->argv[0], "modify") == 0)
 
287
        result = handleOp(a, OP_MODIFY, 1, &cProcessed);
 
288
    else if (strcmp(a->argv[0], "add") == 0)
 
289
        result = handleOp(a, OP_ADD, 1, &cProcessed);
 
290
    else if (strcmp(a->argv[0], "remove") == 0)
 
291
        result = handleOp(a, OP_REMOVE, 1, &cProcessed);
 
292
    else
 
293
        result = errorSyntax(USAGE_DHCPSERVER, "Invalid parameter '%s'", Utf8Str(a->argv[0]).c_str());
314
294
 
315
295
    return result;
316
296
}