Files
libgphoto2/frontends/command-line/interface.c
Lutz Mueller e3095951b3 2001-10-29 Lutz M�ller <urc8@rz.uni-karlsruhe.de>
* frontends/command-line/interface.c: Suppress empty status
          messages. Those indicate that we should _clear_ the status and
          not print _anything_.
        * frontends/command-line/main.c: No need for gp_camera_init
          anymore
        * libgphoto2/gphoto2-camera.c: Make sure the camera is
          initialized.


git-svn-id: https://svn.code.sf.net/p/gphoto/code/trunk/libgphoto2@2846 67ed7778-7388-44ab-90cf-0a291f65f57c
2001-10-29 17:57:15 +00:00

54 lines
1001 B
C

#include <stdio.h>
#include <stdlib.h>
#include <gphoto2.h>
#include "interface.h"
extern int glob_stdout;
extern int glob_quiet;
void
status_func (Camera *camera, const char *status, void *data)
{
if (glob_quiet)
return;
if (status && *status) {
fprintf (stderr, "Status: %s\n", status);
fflush(stdout);
} else {
/*
* gphoto2 tells us to clear the status. But it seems
* people really want '\n' above (not '\r'), therefore
* we can't clear the status. Hence, we don't do anything
* here.
*
* If we would use '\r' above, we could overwrite an existing
* status message by writing an empty line. But we don't.
*/
}
}
void
message_func (Camera *camera, const char *message, void *data)
{
if (glob_quiet)
return;
printf ("Message: %s\n", message);
}
void
progress_func (Camera *camera, float percentage, void *data)
{
if (glob_quiet)
return;
if (percentage > 0.) {
printf ("Percent completed: %02.01f\r", percentage * 100.);
fflush(stdout);
}
}