X-Git-Url: http://git.eversberg.eu/gitweb.cgi?p=lcr.git;a=blobdiff_plain;f=genext.c;h=e9de687886f29d9e7a4100b72950c33e4fa8e0d3;hp=979a7c1d21df606d69028ca249a01605a075a684;hb=f851ca0d9e22673b7cc0a7c2f539c9d51b9b77f8;hpb=26c7e0d22ead805ce333ea4248c7311c1eda5de0 diff --git a/genext.c b/genext.c index 979a7c1..e9de687 100644 --- a/genext.c +++ b/genext.c @@ -30,11 +30,11 @@ int fhuse = 0; struct isdn_cause isdn_cause[128]; struct isdn_location isdn_location[16]; -void _printdebug(const char *function, int line, unsigned int mask, const char *fmt, ...) +void _printdebug(const char *file, const char *function, int line, unsigned int mask, const char *fmt, ...) { } -void _printerror(const char *function, int line, const char *fmt, ...) +void _printerror(const char *file, const char *function, int line, const char *fmt, ...) { char buffer[4096]; va_list args; @@ -52,15 +52,14 @@ int main(int argc, char *argv[]) struct extension ext; char pathname[256]; FILE *fp; + char options_error[256]; - if (!read_options()) - { + if (!read_options(options_error)) { PERROR("%s", options_error); return(-1); } - if (argc != 4) - { + if (argc != 4) { printf("Usage: %s \n\n", argv[0]); printf("extension: any number for the extension (e.g 200)\n"); printf("interfaces: internal interface(s) to reach extension, NOT port numbers\n"); @@ -70,8 +69,7 @@ int main(int argc, char *argv[]) } SPRINT(pathname, "%s/%s", EXTENSION_DATA, argv[1]); - if (mkdir(pathname, 0755) < 0) - { + if (mkdir(pathname, 0755) < 0) { if (errno == EEXIST) PERROR("Extension's directory already exists. Nothing done!\n"); else PERROR("Cannot open extension's directory '%s'.\n", pathname); @@ -91,12 +89,10 @@ int main(int argc, char *argv[]) write_extension(&ext, argv[1]); SPRINT(pathname, "%s/%s/phonebook", EXTENSION_DATA, argv[1]); - if (!(fp = fopen(pathname, "w"))) - { + if (!(fp = fopen(pathname, "w"))) { PERROR("Failed to write phonebook example '%s'.\n", pathname); return(-1); - } else - { + } else { fprintf(fp, "# fromat: []\n"); fprintf(fp, "# The shotcut may have any number of digits. \n"); fprintf(fp, "# The phone number must include the dialing code for external, internal or\n"); @@ -113,12 +109,10 @@ int main(int argc, char *argv[]) } SPRINT(pathname, "%s/%s/secrets", EXTENSION_DATA, argv[1]); - if (!(fp = fopen(pathname, "w"))) - { + if (!(fp = fopen(pathname, "w"))) { PERROR("Failed to write secrets example '%s'.\n", pathname); return(-1); - } else - { + } else { fprintf(fp, "# Format: []\n"); fprintf(fp, "# The remote number must match the dialed number for outgoing calls.\n"); fprintf(fp, "# The remote number must match the caller id for incoming calls.\n");