On Sat, 2011-01-08 at 11:16 +0100, Raphaël Pinson wrote: > On Fri, Jan 7, 2011 at 11:50 PM, David Lutterkort <[email protected]> wrote: > > > > On Wed, 2011-01-05 at 12:52 +0100, [email protected] wrote: > >> From: Raphaël Pinson <[email protected]> > >> > >> } else if (isatty(fileno(stdin))) { > >> - line = readline("augtool> "); > >> + line = readline(AUGTOOL_PROMPT); > >> } else { > >> if (getline(&line, &len, stdin) == -1) > >> - return ret; > >> - if (echo) > >> - printf("augtool> %s", line); > >> + line = NULL; > >> + if (echo && line != NULL) > >> + printf("%s%s", AUGTOOL_PROMPT, line); > >> } > >> > >> - cleanstr(line, '\n'); > >> if (line == NULL) { > >> - printf("\n"); > >> + if (auto_save) { > >> + line = "save"; > > > > This causes compilation to fail for me [1], since we're assigning a > > const char * to a char *. > > Funny, I didn't get a compilation error, although I do see why it > would^Wshould fail.
Whether you get a compilation error or a warning depends on how you ran configure, in particular whether you pass --enable-compile-warnings=error > > > > One way to fix this is to write instead > > strncpy(inputline, "save", sizeof(inputline)); > > line = inputline; > > Isn't it possible to do > > strncpy(line, "save", sizeof(line)); > > directly? IIRC, at that point line == NULL; inputline is a statically allocated buffer, so we know we can copy into it. David _______________________________________________ augeas-devel mailing list [email protected] https://www.redhat.com/mailman/listinfo/augeas-devel
