mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2026-01-28 01:47:19 +01:00
Merged with BB-stefan
This commit is contained in:
parent
ff98718ec8
commit
e11df03d1b
13 changed files with 175 additions and 65 deletions
|
|
@ -79,6 +79,9 @@ angular.module("luci")
|
|||
"asterisk.call_log.list",
|
||||
"asterisk.status",
|
||||
"luci2.system.password_set",
|
||||
"luci2.system.backup_restore",
|
||||
"luci2.system.reset_test",
|
||||
"luci2.system.reset_start",
|
||||
// local stuff for the node server.
|
||||
"local.features",
|
||||
"local.set_rpc_host"
|
||||
|
|
|
|||
|
|
@ -5,18 +5,56 @@
|
|||
<luci-config-info>{{ 'settings.config.info' | translate }}</luci-config-info>
|
||||
<luci-config-lines>
|
||||
<luci-config-line title="{{'Save settings to computer with password protection'|translate}}">
|
||||
<button class="btn btn-lg btn-default">{{'Save'|translate}}</button>
|
||||
<button class="btn btn-lg btn-default" ng-click="onSaveConfig()">{{'Save'|translate}}</button>
|
||||
</luci-config-line>
|
||||
<luci-config-line title="{{'Restore settings from a configuration saved on a computer'|translate}}">
|
||||
<button class="btn btn-lg btn-default">{{'Load'|translate}}</button>
|
||||
</luci-config-line>
|
||||
</luci-config-lines>
|
||||
<h3>{{'Factory Settings'|translate}}</h3>
|
||||
<luci-config-lines>
|
||||
<luci-config-line title="{{'Reset restores the factory default settings of your gateway'|translate}}">
|
||||
<button class="btn btn-lg btn-default">{{'Reset'|translate}}</button>
|
||||
<button class="btn btn-lg btn-default" ng-click="onRestoreConfig()">{{'Load'|translate}}</button>
|
||||
</luci-config-line>
|
||||
</luci-config-lines>
|
||||
<div ng-show="resetPossible" >
|
||||
<h3>{{'Factory Settings'|translate}}</h3>
|
||||
<luci-config-lines >
|
||||
<luci-config-line title="{{'Reset restores the factory default settings of your gateway'|translate}}">
|
||||
<button class="btn btn-lg btn-default" ng-click="onReset()">{{'Reset'|translate}}</button>
|
||||
</luci-config-line>
|
||||
</luci-config-lines>
|
||||
</div>
|
||||
</luci-config-section>
|
||||
<modal title="{{'Save Configuration to Computer'|translate}}" ng-show="showModal" on-accept="onAcceptModal()" on-dismiss="onDismissModal()" dismiss-label="Cancel" accept-label="Continue">
|
||||
<form name="backupForm" action="/cgi-bin/luci-backup" method="post" >
|
||||
<input type="hidden" name="sessionid" value="{{sessionID}}"/>
|
||||
<!--<input type="hidden" name="password" />-->
|
||||
<div class="form-group">
|
||||
<label translate>Please add a comment describing this configuration</label>
|
||||
<textarea class="form-control" placeholder="{{'Comments'|translate}}..." name="comment"/>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label translate>Backup file password</label>
|
||||
<input type="password" class="form-control" placeholder="{{'New Password'|translate}}" name="password"/>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label translate>Re-type password</label>
|
||||
<input type="password" class="form-control" placeholder="{{'Re-type password'|translate}}" name="password_repeat"/>
|
||||
</div>
|
||||
</form>
|
||||
</modal>
|
||||
<modal title="Load New Configuration" ng-show="showUploadModal" on-accept="onUploadConfig()" on-dismiss="onCancelRestore()" dismiss-label="Cancel" accept-label="Continue">
|
||||
<iframe name="postiframe" id="postiframe" style="display: none;" ></iframe>
|
||||
<form target="postiframe" name="restoreForm" id="restoreForm" action="/cgi-bin/luci-upload" method="post" enctype="multipart/form-data">
|
||||
<input type="hidden" name="sessionid" value="{{sessionID}}" />
|
||||
<input type="hidden" name="filename" value="/tmp/backup.tar.gz" />
|
||||
<luci-config-lines>
|
||||
<luci-config-line title="{{'Pick configuration backup to upload'|translate}}">
|
||||
<input type="file" class="btn btn-default btn-file" name="filedata" />
|
||||
</luci-config-line>
|
||||
<luci-config-line title="{{'Backup file password (if encrypted)'|translate}}">
|
||||
<input type="password" class="form-control" name="password" ng-model="restore.password" />
|
||||
</luci-config-line>
|
||||
<!--<luci-config-line title="{{'Start upgrade'|translate}}">
|
||||
<input type="submit" class="btn btn-lg btn-default" value="{{'Upgrade'|translate}}"/>
|
||||
</luci-config-line>-->
|
||||
</luci-config-lines>
|
||||
</form>
|
||||
</modal>
|
||||
</div>
|
||||
</luci-layout-with-sidebar>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,67 @@
|
|||
$juci.module("settings")
|
||||
.controller("SettingsConfigurationCtrl", function($scope){
|
||||
|
||||
.controller("SettingsConfigurationCtrl", function($scope, $rpc, $session){
|
||||
$scope.sessionID = $session.sid;
|
||||
$scope.resetPossible = 0;
|
||||
$rpc.luci2.system.reset_test().done(function(result){
|
||||
if(result && result.supported) {
|
||||
$scope.resetPossible = 1;
|
||||
$scope.$apply();
|
||||
}
|
||||
});
|
||||
$scope.onReset = function(){
|
||||
$rpc.luci2.system.reset_start().done(function(result){
|
||||
console.log("Performing reset: "+JSON.stringify(result));
|
||||
});
|
||||
}
|
||||
$scope.onSaveConfig = function(){
|
||||
$scope.showModal = 1;
|
||||
|
||||
}
|
||||
$scope.onRestoreConfig = function(){
|
||||
$scope.showUploadModal = 1;
|
||||
}
|
||||
$scope.onCancelRestore = function(){
|
||||
$scope.showUploadModal = 0;
|
||||
}
|
||||
$scope.restore = {};
|
||||
/*setInterval(function checkUpload(){
|
||||
var iframe = $("#postiframe").load(function(){;
|
||||
var json = iframe.contents().text();
|
||||
try {
|
||||
if(json.length && JSON.parse(json)) {
|
||||
$scope.onUploadComplete(JSON.parse(json));
|
||||
}
|
||||
} catch(e){}
|
||||
iframe.each(function(e){$(e).contents().html("<html>");}); ;
|
||||
}, 500); */
|
||||
$scope.onUploadConfig = function(){
|
||||
$("#postiframe").bind("load", function(){
|
||||
var json = $(this).contents().text();
|
||||
try {
|
||||
var obj = JSON.parse(json);
|
||||
$scope.onUploadComplete(JSON.parse(json));
|
||||
} catch(e){}
|
||||
$(this).unbind("load");
|
||||
});
|
||||
$("form[name='restoreForm']").submit();
|
||||
}
|
||||
$scope.onUploadComplete = function(result){
|
||||
console.log("Result: "+JSON.stringify(result)+": "+$scope.restore.password);
|
||||
$rpc.luci2.system.backup_restore({
|
||||
password: $scope.restore.password
|
||||
}).done(function(result){
|
||||
if(result.code){
|
||||
alert(result.stderr);
|
||||
} else {
|
||||
$scope.showUploadModal = 0;
|
||||
}
|
||||
});
|
||||
}
|
||||
$scope.onAcceptModal = function(){
|
||||
$("form[name='backupForm']").submit();
|
||||
$scope.showModal = 0;
|
||||
}
|
||||
$scope.onDismissModal = function(){
|
||||
$scope.showModal = 0;
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -13,10 +13,10 @@
|
|||
<iframe name="postiframe" id="postiframe" style="display: none;" ></iframe>
|
||||
<form target="postiframe" action="/cgi-bin/luci-upload" method="post" enctype="multipart/form-data">
|
||||
<input type="hidden" name="sessionid" value="{{sessionID}}" />
|
||||
<input type="hidden" name="filename" value="/tmp/firmware.bin" />
|
||||
<input type="hidden" name="filename" value="{{uploadFilename}}" />
|
||||
<luci-config-lines>
|
||||
<luci-config-line title="{{'Pick firmware file to upload'|translate}}">
|
||||
<input type="file" class="" name="filedata" />
|
||||
<input type="file" class="btn btn-default btn-file" name="filedata" />
|
||||
</luci-config-line>
|
||||
<luci-config-line title="{{'Start upgrade'|translate}}">
|
||||
<input type="submit" class="btn btn-lg btn-default" value="{{'Upgrade'|translate}}"/>
|
||||
|
|
|
|||
|
|
@ -109,11 +109,19 @@
|
|||
})( jQuery);
|
||||
|
||||
$juci.module("settings")
|
||||
.controller("SettingsUpgradeCtrl", function($scope, $session){
|
||||
.controller("SettingsUpgradeCtrl", function($scope, $uci, $session){
|
||||
$scope.sessionID = $session.sid;
|
||||
$scope.uploadFilename = "/tmp/firmware.bin";
|
||||
$scope.usbFileName = "()";
|
||||
console.log("SID: "+$scope.sessionID);
|
||||
|
||||
$uci.sync("system").done(function(){
|
||||
if($uci.system.upgrade && $uci.system.upgrade.fw_upload_path.value){
|
||||
$scope.uploadFilename = $uci.system.upgrade.fw_upload_path.value;
|
||||
console.log("Using upload path from config: "+$scope.uploadFilename);
|
||||
}
|
||||
});
|
||||
|
||||
$scope.onUploadComplete = function(result){
|
||||
console.log("Upload completed: "+JSON.stringify(result));
|
||||
}
|
||||
|
|
@ -122,9 +130,9 @@ $juci.module("settings")
|
|||
var json = iframe.contents().text();
|
||||
if(json.length) {
|
||||
$scope.onUploadComplete(JSON.parse(json));
|
||||
iframe.contents().html("<html>");
|
||||
iframe.contents().html("");
|
||||
}
|
||||
}, 100);
|
||||
}, 500);
|
||||
$scope.onUploadUpgrade = function(){
|
||||
var formData = new FormData($('uploadForm')[0]);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
CC = gcc
|
||||
CFLAGS = -g -Wall
|
||||
CFLAGS = -g -Wall
|
||||
LOCLIBS =
|
||||
LIBS = -luci -lubus -lubox -lpthread
|
||||
OBJS = questd.o dumper.o port.o arping.o usb.o ndisc.o dslstats.o tools.o igmp.o
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@
|
|||
#include <net/ethernet.h>
|
||||
#include <net/if_arp.h>
|
||||
#include <netinet/ether.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "questd.h"
|
||||
|
||||
|
|
@ -35,6 +36,8 @@ struct sockaddr_ll me;
|
|||
struct sockaddr_ll he;
|
||||
int sock_fd;
|
||||
|
||||
//void *mempcpy(void *dst, const void *src, size_t n);
|
||||
|
||||
static int
|
||||
send_pack(struct in_addr *src_addr, struct in_addr *dst_addr, struct sockaddr_ll *ME, struct sockaddr_ll *HE)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -41,7 +41,6 @@ void dslstats_load(struct dsl_stats *self){
|
|||
char sep[64];
|
||||
char arg1[64];
|
||||
char arg2[64];
|
||||
int i = 0;
|
||||
|
||||
// start with default bearer 0 (we can support more later)
|
||||
DSLBearer *bearer = &self->bearers[0];
|
||||
|
|
@ -59,7 +58,7 @@ void dslstats_load(struct dsl_stats *self){
|
|||
case 0: { // sections
|
||||
if(strstr(line, "Bearer")){
|
||||
int id = 0;
|
||||
if(sscanf(strstr(line, "Bearer"), "Bearer %d", sep, &id) > 0){
|
||||
if(sscanf(strstr(line, "Bearer"), "Bearer %d", &id) > 0){
|
||||
if(id < DSLSTATS_BEARER_COUNT){
|
||||
bearer = &self->bearers[id];
|
||||
DSLDEBUG("Switching bearer: %d\n", id);
|
||||
|
|
@ -98,7 +97,7 @@ void dslstats_load(struct dsl_stats *self){
|
|||
else if(strstr(name, "Line Status") == name) self->line_status = strdup(arg1);
|
||||
else if(strstr(name, "Bearer") == name){
|
||||
unsigned long id, up, down, ret;
|
||||
if((ret = sscanf(arg1, "%d, Upstream rate = %lu Kbps, Downstream rate = %lu Kbps", &id, &up, &down)) == 3){
|
||||
if((ret = sscanf(arg1, "%lu, Upstream rate = %lu Kbps, Downstream rate = %lu Kbps", &id, &up, &down)) == 3){
|
||||
if(id < DSLSTATS_BEARER_COUNT){
|
||||
bearer = &self->bearers[id];
|
||||
bearer->rate.up = up;
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ enum {
|
|||
DSLSTATS_COUNTER_COUNT
|
||||
};
|
||||
|
||||
typedef struct { double up; double down } UpDown;
|
||||
typedef struct { double up; double down; } UpDown;
|
||||
typedef struct dsl_bearer {
|
||||
|
||||
UpDown max_rate;
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
#include "questd.h"
|
||||
#include "igmp.h"
|
||||
|
||||
|
||||
static void tokenize_line(char *str, const char **tokens, size_t tokens_size) {
|
||||
char *ptr = str;
|
||||
const char **token = tokens; // = line;
|
||||
|
|
@ -26,7 +27,7 @@ static void tokenize_line(char *str, const char **tokens, size_t tokens_size) {
|
|||
continue;
|
||||
}
|
||||
ptr++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int igmp_rpc(struct ubus_context *ctx, struct ubus_object *obj,
|
||||
|
|
@ -38,7 +39,7 @@ int igmp_rpc(struct ubus_context *ctx, struct ubus_object *obj,
|
|||
char line[256];
|
||||
IGMPtable table[128];
|
||||
const char *tokens[32] = { 0 };
|
||||
void *object, *array,*t;
|
||||
void *object, *array;
|
||||
|
||||
blob_buf_init(&bb, 0);
|
||||
if (!(in = fopen("/tmp/igmp_snooping", "r")))
|
||||
|
|
@ -59,91 +60,80 @@ int igmp_rpc(struct ubus_context *ctx, struct ubus_object *obj,
|
|||
tokenize_line(line, tokens, sizeof(tokens) / sizeof(char*));
|
||||
int tok_pos = 0;
|
||||
const char **token = tokens;
|
||||
const char *names[] = { "bridge", "dev", "srcdev", "tags", "lantci",
|
||||
"wantci", "group", "mode", "rxgroup", "source", "reporter",
|
||||
"timeout", "index", "excludept" };
|
||||
//const char *names[] = { "bridge", "dev", "srcdev", "tags", "lantci",
|
||||
// "wantci", "group", "mode", "rxgroup", "source", "reporter",
|
||||
// "timeout", "index", "excludept" };
|
||||
|
||||
while (*token) {
|
||||
printf("<%d>\n",tok_pos);
|
||||
switch (tok_pos) {
|
||||
case 0:
|
||||
|
||||
snprintf(table[row-2].bridge,"%s",token);
|
||||
printf("%s\n%s\n",table[row-2].bridge,token);
|
||||
sprintf(table[row-2].bridge,"%s",*token);
|
||||
printf("%s\n%s\n",table[row-2].bridge,*token);
|
||||
break;
|
||||
case 1:
|
||||
snprintf(table[row-2].device,"%s",token);
|
||||
sprintf(table[row-2].device,"%s",*token);
|
||||
break;
|
||||
case 2:
|
||||
snprintf(table[row - 2].tags ,"%s",token);
|
||||
sprintf(table[row - 2].tags ,"%s",*token);
|
||||
break;
|
||||
case 3: {
|
||||
uint32_t ip;
|
||||
char str[17];
|
||||
|
||||
sscanf(token, "%8x", &ip);
|
||||
sscanf(*token, "%8x", &ip);
|
||||
sprintf(table[row - 2].lantci, "%d.%d.%d.%d", (ip >> 16),
|
||||
(ip >> 8) & 0xff, ip & 0xff, (ip >> 24) & 0xff);
|
||||
}
|
||||
break;
|
||||
case 4: {
|
||||
uint32_t ip;
|
||||
char str[17];
|
||||
|
||||
sscanf(token, "%8x", &ip);
|
||||
sscanf(*token, "%8x", &ip);
|
||||
sprintf(table[row - 2].wantci, "%d.%d.%d.%d", (ip >> 16),
|
||||
(ip >> 8) & 0xff, ip & 0xff, (ip >> 24) & 0xff);
|
||||
}
|
||||
break;
|
||||
case 5: {
|
||||
uint32_t ip;
|
||||
char str[17];
|
||||
|
||||
sscanf(token, "%8x", &ip);
|
||||
sscanf(*token, "%8x", &ip);
|
||||
sprintf(table[row - 2].group, "%d.%d.%d.%d", (ip >> 16),
|
||||
(ip >> 8) & 0xff, ip & 0xff, (ip >> 24) & 0xff);
|
||||
}
|
||||
break;
|
||||
case 6:
|
||||
snprintf(table[row - 2].mode,"%s",token);
|
||||
sprintf(table[row - 2].mode,"%s",*token);
|
||||
break;
|
||||
case 7: {
|
||||
uint32_t ip;
|
||||
char str[17];
|
||||
|
||||
sscanf(token, "%8x", &ip);
|
||||
sscanf(*token, "%8x", &ip);
|
||||
sprintf(table[row - 2].RxGroup, "%d.%d.%d.%d", (ip >> 16),
|
||||
(ip >> 8) & 0xff, ip & 0xff, (ip >> 24) & 0xff);
|
||||
}
|
||||
break;
|
||||
case 8: {
|
||||
uint32_t ip;
|
||||
char str[17];
|
||||
|
||||
sscanf(token, "%8x", &ip);
|
||||
sscanf(*token, "%8x", &ip);
|
||||
sprintf(table[row - 2].source, "%d.%d.%d.%d", (ip >> 16),
|
||||
(ip >> 8) & 0xff, ip & 0xff, (ip >> 24) & 0xff);
|
||||
}
|
||||
break;
|
||||
case 9: {
|
||||
uint32_t ip;
|
||||
char str[17];
|
||||
|
||||
sscanf(token, "%8x", &ip);
|
||||
sscanf(*token, "%8x", &ip);
|
||||
sprintf(table[row - 2].reporter, "%d.%d.%d.%d", (ip >> 16),
|
||||
(ip >> 8) & 0xff, ip & 0xff, (ip >> 24) & 0xff);
|
||||
}
|
||||
break;
|
||||
case 10:
|
||||
snprintf(table[row - 2].timeout,"%s",token);
|
||||
sprintf(table[row - 2].timeout,"%s",*token);
|
||||
|
||||
break;
|
||||
case 11:
|
||||
snprintf(table[row - 2].Index,"%s",token);
|
||||
sprintf(table[row - 2].Index,"%s",*token);
|
||||
|
||||
break;
|
||||
case 12:
|
||||
snprintf(table[row - 2].ExcludPt,"%s",token);
|
||||
sprintf(table[row - 2].ExcludPt,"%s",*token);
|
||||
|
||||
break;
|
||||
default:
|
||||
|
|
@ -182,3 +172,4 @@ int igmp_rpc(struct ubus_context *ctx, struct ubus_object *obj,
|
|||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -329,11 +329,11 @@ match_client_to_network(Network *lan, char *hostaddr, bool *local, char **net, c
|
|||
|
||||
if((snet.s_addr ^ rslt.s_addr) == 0) {
|
||||
*local = true;
|
||||
snprintf(net, 32, lan->name);
|
||||
snprintf(*net, 32, lan->name);
|
||||
if (lan->type && !strcmp(lan->type, "bridge"))
|
||||
snprintf(dev, 32, "br-%s", lan->name);
|
||||
snprintf(*dev, 32, "br-%s", lan->name);
|
||||
else
|
||||
snprintf(dev, 32, lan->ifname);
|
||||
snprintf(*dev, 32, lan->ifname);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -364,7 +364,7 @@ wireless_sta(Client *clnt, Detail *dtl)
|
|||
int i = 0;
|
||||
bool there = false;
|
||||
char tab[16];
|
||||
int ret, tmp;
|
||||
int tmp;
|
||||
int noise;
|
||||
|
||||
for (i = 0; wireless[i].device; i++) {
|
||||
|
|
@ -377,12 +377,12 @@ wireless_sta(Client *clnt, Detail *dtl)
|
|||
there = true;
|
||||
strncpy(clnt->wdev, wireless[i].vif, sizeof(clnt->wdev));
|
||||
}
|
||||
ret = sscanf(line, "\t idle %d seconds", &(dtl->idle));
|
||||
ret = sscanf(line, "\t in network %d seconds", &(dtl->in_network));
|
||||
ret = sscanf(line, "\t tx total bytes: %ld\n", &(dtl->tx_bytes));
|
||||
ret = sscanf(line, "\t rx data bytes: %ld", &(dtl->rx_bytes));
|
||||
ret = sscanf(line, "\t rate of last tx pkt: %d kbps - %d kbps", &tmp, &(dtl->tx_rate));
|
||||
ret = sscanf(line, "\t rate of last rx pkt: %d kbps", &(dtl->rx_rate));
|
||||
sscanf(line, "\t idle %d seconds", &(dtl->idle));
|
||||
sscanf(line, "\t in network %d seconds", &(dtl->in_network));
|
||||
sscanf(line, "\t tx total bytes: %ld\n", &(dtl->tx_bytes));
|
||||
sscanf(line, "\t rx data bytes: %ld", &(dtl->rx_bytes));
|
||||
sscanf(line, "\t rate of last tx pkt: %d kbps - %d kbps", &tmp, &(dtl->tx_rate));
|
||||
sscanf(line, "\t rate of last rx pkt: %d kbps", &(dtl->rx_rate));
|
||||
}
|
||||
pclose(stainfo);
|
||||
}
|
||||
|
|
@ -1296,7 +1296,7 @@ quest_router_connected_clients6(struct ubus_context *ctx, struct ubus_object *ob
|
|||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
static int
|
||||
quest_router_igmp_table(struct ubus_context *ctx, struct ubus_object *obj,
|
||||
struct ubus_request_data *req, const char *method,
|
||||
|
|
@ -1307,11 +1307,12 @@ quest_router_igmp_table(struct ubus_context *ctx, struct ubus_object *obj,
|
|||
blobmsg_parse(quest_policy, __QUEST_MAX, tb, blob_data(msg), blob_len(msg));
|
||||
|
||||
blob_buf_init(&bb, 0);
|
||||
router_dump_connected_clients6(&bb);
|
||||
igpm_rpc(&bb);
|
||||
ubus_send_reply(ctx, req, bb.head);
|
||||
|
||||
return 0;
|
||||
}
|
||||
}*/
|
||||
|
||||
static int
|
||||
quest_router_clients6(struct ubus_context *ctx, struct ubus_object *obj,
|
||||
struct ubus_request_data *req, const char *method,
|
||||
|
|
@ -1579,7 +1580,7 @@ wps_checkpin(struct ubus_context *ctx, struct ubus_object *obj,
|
|||
char pin[9] = { '\0' };
|
||||
bool valid = false;
|
||||
|
||||
snprintf(cmnd, 32, "wps_cmd checkpin %s", blobmsg_data(tb[PIN]));
|
||||
snprintf(cmnd, 32, "wps_cmd checkpin %s", (char*)blobmsg_data(tb[PIN]));
|
||||
if ((checkpin = popen(cmnd, "r"))) {
|
||||
fgets(pin, sizeof(pin), checkpin);
|
||||
remove_newline(pin);
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
//#define _GNU_SOURCE
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
|
|
|||
|
|
@ -21,11 +21,12 @@
|
|||
*/
|
||||
|
||||
#include "questd.h"
|
||||
#include <string.h>
|
||||
|
||||
static void
|
||||
remove_space(char *buf)
|
||||
{
|
||||
char *newbuf;
|
||||
char *newbuf = malloc(strlen(buf)+1);
|
||||
int i = 0;
|
||||
int j = 0;
|
||||
|
||||
|
|
@ -37,6 +38,7 @@ remove_space(char *buf)
|
|||
}
|
||||
newbuf[j] = '\0';
|
||||
strcpy(buf, newbuf);
|
||||
free(newbuf);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue