removes use of printf
authorJosé Bollo <jose.bollo@iot.bzh>
Thu, 14 Apr 2016 11:27:41 +0000 (13:27 +0200)
committerJosé Bollo <jose.bollo@iot.bzh>
Thu, 14 Apr 2016 11:27:41 +0000 (13:27 +0200)
Change-Id: I635e236e102837256c77fd4379ef9b11d850a4de
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
src/afb-hreq.c
src/afb-hsrv.c
src/main.c

index 9984cbc..045a0d6 100644 (file)
@@ -219,7 +219,7 @@ static magic_t lazy_libmagic()
                /* MAGIC_MIME tells magic to return a mime of the file,
                         but you can specify different things */
                if (verbosity)
-                       printf("Loading mimetype default magic database\n");
+                       fprintf(stderr, "Loading mimetype default magic database\n");
 
                result = magic_open(MAGIC_MIME_TYPE);
                if (result == NULL) {
index 2c303d3..73ad6a6 100644 (file)
@@ -336,7 +336,7 @@ int afb_hsrv_start(struct afb_hsrv *hsrv, uint16_t port, unsigned int connection
                MHD_OPTION_END);        /* options-end */
 
        if (httpd == NULL) {
-               printf("Error: httpStart invalid httpd port: %d", (int)port);
+               fprintf(stderr, "Error: httpStart invalid httpd port: %d", (int)port);
                return 0;
        }
 
index d58a897..1a728dd 100644 (file)
@@ -470,7 +470,7 @@ static void daemonize(AFB_session *session)
       if (pid != 0) _exit (0);
 
       // son process get all data in standalone mode
-     printf ("\nAFB: background mode [pid:%d console:%s]\n", getpid(),session->config->console);
+     fprintf (stderr, "\nAFB: background mode [pid:%d console:%s]\n", getpid(),session->config->console);
 
       // redirect default I/O on console
       close (2); dup(consoleFD);  // redirect stderr
@@ -542,7 +542,7 @@ int main(int argc, char *argv[])  {
   // --------- run -----------
   if (session->background) {
       // --------- in background mode -----------
-      if (verbosity) printf ("AFB: Entering background mode\n");
+      if (verbosity) fprintf (stderr, "AFB: Entering background mode\n");
       daemonize(session);
   } else {
       // ---- in foreground mode --------------------
@@ -606,19 +606,19 @@ static struct afb_hsrv *start(AFB_config * config)
 
        if (!afb_hsrv_set_cache_timeout(hsrv, config->cacheTimeout)
        || !init(hsrv, config)) {
-               printf("Error: initialisation of httpd failed");
+               fprintf (stderr, "Error: initialisation of httpd failed");
                afb_hsrv_put(hsrv);
                return NULL;
        }
 
        if (verbosity) {
-               printf("AFB:notice Waiting port=%d rootdir=%s\n", config->httpdPort, config->rootdir);
-               printf("AFB:notice Browser URL= http:/*localhost:%d\n", config->httpdPort);
+               fprintf (stderr, "AFB:notice Waiting port=%d rootdir=%s\n", config->httpdPort, config->rootdir);
+               fprintf (stderr, "AFB:notice Browser URL= http:/*localhost:%d\n", config->httpdPort);
        }
 
        rc = afb_hsrv_start(hsrv, (uint16_t) config->httpdPort, 15);
        if (!rc) {
-               printf("Error: starting of httpd failed");
+               fprintf (stderr, "Error: starting of httpd failed");
                afb_hsrv_put(hsrv);
                return NULL;
        }