diff options
| author | hybrid <hybrid@hybridlabs.pro> | 2026-06-02 12:41:44 +0300 |
|---|---|---|
| committer | hybrid <hybrid@hybridlabs.pro> | 2026-06-02 12:41:44 +0300 |
| commit | 0070c5bac9a19235160fef52acafe66879dc2730 (patch) | |
| tree | 255ee412936a7b9500934a8e9143ca8ce196877f /src/main.c | |
| parent | bf12e23d26107b1c8139ca7f3e55cd7edd29b7ba (diff) | |
| download | cgit_auth-0070c5bac9a19235160fef52acafe66879dc2730.tar.gz cgit_auth-0070c5bac9a19235160fef52acafe66879dc2730.tar.bz2 cgit_auth-0070c5bac9a19235160fef52acafe66879dc2730.zip | |
upd: try add arg's positions into log string
Diffstat (limited to '')
| -rw-r--r-- | src/main.c | 16 |
1 files changed, 14 insertions, 2 deletions
@@ -19,9 +19,21 @@ int main(int argc, char **argv) { exit(EXIT_FAILURE); } + str = "[0] "; strcpy(str, argv[0]); - for (int i = 1; i < argc; i++) - strcat(str, argv[i]); + for (int i = 1; i < argc; i++) { + char *tmp = NULL; + + if ((tmp = malloc(strlen(argv[i]) + 4)) == NULL) { + perror("main: malloc failed"); + exit(EXIT_FAILURE); + } + + sprintf(tmp, "[%d] %s", i, argv[i]); + strcat(str, tmp); + + free(tmp); + } syslog(LOG_DEBUG, "args: %s\n", str); |
