Differences

This shows you the differences between two versions of the page.

Link to this comparison view

sdk:scripts:write-config [2015/05/05 17:04] (current)
Line 1: Line 1:
 +====== SDK Script write-config.are ======
 +<code c write-config.are>​
 +/* DESC: This script can be used to set a configuration parameter.
 + * Copyright (C) 2012 NetModule AG, Switzerland
 + */
 +
 +void usage() ​
 +{
 +    printf("​usage:​ write-config.are <​config-key>​ <​config-value>​\n"​);​
 +    exit(1);
 +}
 +
 +if (argc < 3) {
 +    usage();
 +}
 +
 +msg = sprintf("​%s=%s",​ argv[1], argv[2]);
 +ret = nb_config_set(msg);​
 +
 +if(ret > 0) {
 +    printf("​Successfully set %s=%s\n",​ argv[1], argv[2]);
 +} else {
 +    printf("​Unable to write config\n"​);​
 +}
 +
 +
 +exit(0);
 +
 +</​code>​