gsub(/\r$/, "");
# trim spaces
- gsub(/^[\t ]*|[\t ]*$/, "", $1);
- gsub(/^[\t ]*|[\t ]*$/, "", $2);
+ gsub(/^[\t ]+|[\t ]+$/, "", $1);
+ gsub(/^[\t ]+|[\t ]+$/, "", $2);
}
# skip comments and empty lines
}
section == "mysqld" {
- if ($1 ~ /^datadir[ \t]*$/) {
+ if ($1 == "datadir") {
printf("MYSQL_DATA_DIR=%s;", $2);
- } else if ($1 ~ /^user[ \t]*$/) {
+ } else if ($1 == "user") {
printf("MYSQL_USER=%s;", $2);
- } else if ($1 ~ /^pid-file[ \t]*$/) {
+ } else if ($1 == "pid-file") {
printf("MYSQL_PIDFILE=%s;", $2);
- } else if ($1 ~ /^socket[ \t]*$/) {
+ } else if ($1 == "socket") {
printf("MYSQL_SOCKET=%s;", $2);
- } else if ($1 ~ /^port[ \t]*$/) {
+ } else if ($1 == "port") {
printf("MYSQL_PORT=%s;", $2);
- } else if ($1 ~ /^bind-address[ \t]*$/) {
+ } else if ($1 == "bind-address") {
printf("MYSQL_BIND_ADDRESS=%s;", $2);
- } else if ($1 ~ /^skip-networking[ \t]*$/) {
+ } else if ($1 == "skip-networking") {
printf("MYSQL_SKIP_NETWORKING=1;");
- } else if ($1 ~ /^log-error[ \t]*$/) {
+ } else if ($1 == "log-error") {
printf("MYSQL_LOG_ERROR=%s;", $2);
}
}