ES-2024 reverter
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
972 B

  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <unistd.h>
  4. #include <string.h>
  5. #include "configdata.h"
  6. #include "filedata.h"
  7. /*
  8. * $ cfgpatch <config-in>
  9. */
  10. int main(int argc, char *argv[])
  11. {
  12. struct filedata *config = get_filedata(argv[1]);
  13. config_patch(config->data, CFG_LOCATION, "location");
  14. config_patch(config->data, CFG_SYSNAME, "sysname");
  15. config_patch(config->data, CFG_CONTACT, "contact");
  16. config_patch(config->data, CFG_IPADDRESS, "10.10.200.10");
  17. config_patch(config->data, CFG_NETMASK, "16");
  18. config_patch(config->data, CFG_DEFAULTGW, "10.10.250.250");
  19. config_patch(config->data, CFG_NAMESERVER, "10.10.0.1");
  20. config_patch(config->data, CFG_MACAGEING, "301");
  21. config_patch(config->data, CFG_PORTNAME_MASK + 1, "PORT-001");
  22. config_patch(config->data, CFG_PORTNAME_MASK + 2, "PORT-002");
  23. char outname[64];
  24. strncpy(outname, argv[1], sizeof(outname));
  25. strcat(outname, ".patched");
  26. put_filedata(outname, config);
  27. free(config);
  28. return 0;
  29. }