diff -Naur slocate-3.1/src/cmds.c slocate-3.1-null/src/cmds.c --- slocate-3.1/src/cmds.c 2006-03-07 23:40:11.000000000 -0500 +++ slocate-3.1-null/src/cmds.c 2008-04-08 05:21:08.000000000 -0400 @@ -129,6 +129,7 @@ " --output= - Specifies the database to create.\n" " -d \n" " --database= - Specfies the path of databases to search in.\n" + " -0 - Delimit results with \\0 rather than \\n\n" " -h\n" " --help - Display this help.\n" " -v\n" @@ -707,7 +708,7 @@ if (strcmp(g_data->progname, "updatedb") == 0) cmd_data->updatedb = TRUE; - while ((ch = getopt(argc,argv,"VvuhqU:r:o:e:l:d:-:n:f:c:i")) != EOF) { + while ((ch = getopt(argc,argv,"VvuhqU:r:o:e:l:d:-:n:f:c:i0")) != EOF) { switch(ch) { /* Help */ case 'h': @@ -823,6 +824,9 @@ goto EXIT; } break; + case '0': + g_data->delim = '\0'; + break; default: break; } @@ -871,4 +875,3 @@ return NULL; } - diff -Naur slocate-3.1/src/slocate.c slocate-3.1-null/src/slocate.c --- slocate-3.1/src/slocate.c 2006-03-07 23:40:11.000000000 -0500 +++ slocate-3.1-null/src/slocate.c 2008-04-08 05:15:44.000000000 -0400 @@ -164,6 +164,7 @@ g_data->regexp_data = NULL; g_data->queries = -1; g_data->SLOCATE_GID = get_gid(g_data, DB_GROUP, &ret); + g_data->delim = '\n'; if (!ret) goto EXIT; @@ -191,7 +192,7 @@ goto EXIT; } if (g_data->VERBOSE) - fprintf(stdout, "%s\n", path); + fprintf(stdout, "%s%c", path, g_data->delim); /* Match number string */ ptr1 = path; code_len = 0; @@ -471,7 +472,7 @@ if (match_ret == 1) { if (g_data->queries > 0) g_data->queries -= 1; - fprintf(stdout, "%s\n", full_path); + fprintf(stdout, "%s%c", full_path, g_data->delim); } ret = 1; EXIT: @@ -736,7 +737,6 @@ ret = 0; goto EXIT; } - #if 0 printf("Q: %d\n", g_data->QUIET); printf("V: %d\n", g_data->VERBOSE); diff -Naur slocate-3.1/src/slocate.h slocate-3.1-null/src/slocate.h --- slocate-3.1/src/slocate.h 2006-03-07 23:40:11.000000000 -0500 +++ slocate-3.1-null/src/slocate.h 2008-04-08 05:13:50.000000000 -0400 @@ -81,6 +81,7 @@ char **input_db; int queries; struct regexp_data_s *regexp_data; + char delim; }; /* Encoding data */