2012-05-09 09:35:15 +00:00
|
|
|
/**
|
|
|
|
* Copyright (C) 2011 The Serval Project
|
|
|
|
*
|
|
|
|
* This file is part of Serval Software (http://www.servalproject.org)
|
|
|
|
*
|
|
|
|
* Serval Software is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This source code is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this source code; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
*/
|
|
|
|
|
2012-04-24 07:36:48 +00:00
|
|
|
package org.servalproject.servald;
|
|
|
|
|
2012-04-30 08:15:24 +00:00
|
|
|
import java.util.List;
|
|
|
|
import java.util.LinkedList;
|
2012-04-24 07:36:48 +00:00
|
|
|
|
|
|
|
class ServalD
|
|
|
|
{
|
2012-04-30 08:15:24 +00:00
|
|
|
int status;
|
2012-11-07 06:42:04 +00:00
|
|
|
List<byte[]> outv;
|
2012-04-30 08:15:24 +00:00
|
|
|
|
2012-04-24 07:36:48 +00:00
|
|
|
public ServalD()
|
|
|
|
{
|
|
|
|
System.loadLibrary("servald");
|
|
|
|
}
|
|
|
|
|
2012-11-07 06:42:04 +00:00
|
|
|
public native int rawCommand(List<byte[]> outv, String... args);
|
2012-04-30 08:15:24 +00:00
|
|
|
|
|
|
|
public void command(String... args)
|
|
|
|
{
|
2012-11-07 06:42:04 +00:00
|
|
|
this.outv = new LinkedList<byte[]>();
|
2012-04-30 08:15:24 +00:00
|
|
|
this.status = this.rawCommand(this.outv, args);
|
|
|
|
}
|
2012-04-24 07:36:48 +00:00
|
|
|
|
|
|
|
public static void main(String[] args)
|
|
|
|
{
|
2012-04-30 08:15:24 +00:00
|
|
|
ServalD servald = new ServalD();
|
|
|
|
servald.command(args);
|
2012-11-07 06:42:04 +00:00
|
|
|
for (byte[] a: servald.outv) {
|
|
|
|
System.out.println(new String(a));
|
2012-04-24 07:36:48 +00:00
|
|
|
}
|
2012-04-30 08:15:24 +00:00
|
|
|
System.exit(servald.status);
|
2012-04-24 07:36:48 +00:00
|
|
|
}
|
|
|
|
}
|