Пример #1
0
gn_error deleteringtone(int argc, char *argv[], gn_data *data, struct gn_statemachine *state)
{
	gn_ringtone ringtone;
	gn_error error;
	int i, start, end;

	memset(&ringtone, 0, sizeof(ringtone));
	gn_data_clear(data);
	data->ringtone = &ringtone;

	start = gnokii_atoi(optarg);
	if (errno || start < 0)
		return deleteringtone_usage(stderr, -1);
	end = parse_end_value_option(argc, argv, optind, start);
	if (errno || end < 0)
		return deleteringtone_usage(stderr, -1);

	for (i = start; i <= end; i++) {
		ringtone.location = i;
		if ((error = gn_sm_functions(GN_OP_DeleteRingtone, data, state)) == GN_ERR_NONE)
			fprintf(stderr, _("Ringtone %d deleted\n"), i);
		else
			fprintf(stderr, _("Failed to delete ringtone %d: %s\n"), i, gn_error_print(error));
	}

	return GN_ERR_NONE;
}
Пример #2
0
/* Select the specified profile */
gn_error setactiveprofile(int argc, char *argv[], gn_data *data, struct gn_statemachine *state)
{
	gn_profile p;
	gn_error error;

	gn_data_clear(data);
	data->profile = &p;
	p.number = gnokii_atoi(optarg);
	if (errno || p.number < 0)
		return setactiveprofile_usage(stderr, -1);

	error = gn_sm_functions(GN_OP_SetActiveProfile, data, state);
	if (error != GN_ERR_NONE)
		fprintf(stderr, _("Cannot set active profile to %d: %s\n"), p.number, gn_error_print(error));
	return error;
}
Пример #3
0
/* Calculates end value from the command line of the form:
 * gnokii --something [...] start [end]
 * where end can be either number or 'end' string.
 * If end is less than start, it is set to start value.
 */
int parse_end_value_option(int argc, char *argv[], int pos, int start_value)
{
	int retval = start_value;

	if (argc > pos && (argv[pos][0] != '-')) {
		if (!strcasecmp(argv[pos], "end"))
			retval = INT_MAX;
		else
			retval = gnokii_atoi(argv[pos]);
	}
	if (retval < start_value) {
		fprintf(stderr, _("Warning: end value (%d) is less than start value (%d). Setting it to the start value (%d)\n"),
			retval, start_value, start_value);
		retval = start_value;
	}

	return retval;
}
Пример #4
0
/* Delete MMS messages. */
gn_error deletemms(int argc, char *argv[], gn_data *data, struct gn_statemachine *state)
{
	gn_mms message;
	char *memory_type_string;
	int start_message, end_message, count;
	gn_error error = GN_ERR_NONE;

	/* Handle command line args that set type, start and end locations. */
	memory_type_string = optarg;
	message.memory_type = gn_str2memory_type(memory_type_string);
	if (message.memory_type == GN_MT_XX) {
		fprintf(stderr, _("Unknown memory type %s (use ME, SM, IN, OU, ...)!\n"), optarg);
		fprintf(stderr, _("Run gnokii --showsmsfolderstatus for a list of supported memory types.\n"));
		return GN_ERR_INVALIDMEMORYTYPE;
	}

	start_message = gnokii_atoi(argv[optind]);
	if (errno || start_message < 0)
		return deletemms_usage(stderr, -1);
	end_message = parse_end_value_option(argc, argv, optind + 1, start_message);
	if (errno || end_message < 0)
		return deletemms_usage(stderr, -1);

	/* Now delete the requested entries. */
	for (count = start_message; count <= end_message; count++) {
		message.number = count;
		data->mms = &message;
		error = gn_mms_delete(data, state);

		if (error == GN_ERR_NONE)
			fprintf(stderr, _("Deleted MMS (location %d from memory %s)\n"), count, memory_type_string);
		else {
			if ((error == GN_ERR_INVALIDLOCATION) && (end_message == INT_MAX) && (count > start_message))
				return GN_ERR_NONE;
			fprintf(stderr, _("Deleting MMS failed (location %d from memory %s)! (%s)\n"), count, memory_type_string, gn_error_print(error));
		}
	}

	/* FIXME: We return the value of the last read.
	 * What should we return?
	 */
	return error;
}
Пример #5
0
gn_error playringtone(int argc, char *argv[], gn_data *data, struct gn_statemachine *state)
{
	gn_ringtone ringtone;
	gn_tone tone;
	gn_error error;
	char *filename = optarg;
	int i, ulen;
	struct timeval dt;
#if (defined HAVE_TIMEOPS) && (defined HAVE_GETTIMEOFDAY)
	struct timeval t1, t2;
#endif

	int volume = 5;
	struct option options[] = {
		{ "volume", required_argument, NULL, 'v'},
		{ NULL,     0,                 NULL, 0}
	};

	while ((i = getopt_long(argc, argv, "v:", options, NULL)) != -1) {
		switch (i) {
		case 'v':
			volume = gnokii_atoi(optarg);
			if (errno || volume < 0)
				return playringtone_usage(stderr, -1);
			break;
		default:
			return playringtone_usage(stderr, -1);
		}
	}
	if (argc > optind) {
		/* There are too many arguments that don't start with '-' */
		return playringtone_usage(stderr, -1);
	}

	memset(&ringtone, 0, sizeof(ringtone));
	memset(&tone, 0, sizeof(tone));
	gn_data_clear(data);
	data->ringtone = &ringtone;
	data->tone = &tone;

	if (!filename) {
		fprintf(stderr, _("Internal gnokii error: null filename\n"));
		return GN_ERR_FAILED;
	}

	if ((error = gn_file_ringtone_read(filename, &ringtone))) {
		fprintf(stderr, _("Failed to load ringtone: %s\n"), gn_error_print(error));
		return error;
	}

#if (defined HAVE_TIMEOPS) && (defined HAVE_GETTIMEOFDAY)
	gettimeofday(&t1, NULL);
	tone.frequency = 0;
	tone.volume = 0;
	gn_sm_functions(GN_OP_PlayTone, data, state);
	gettimeofday(&t2, NULL);
	timersub(&t2, &t1, &dt);
#else
	dt.tv_sec = 0;
	dt.tv_usec = 20000;
#endif

	signal(SIGINT, interrupted);
	for (i = 0; !bshutdown && i < ringtone.notes_count; i++) {
		tone.volume = volume;
		gn_ringtone_get_tone(&ringtone, i, &tone.frequency, &ulen);
		if ((error = gn_sm_functions(GN_OP_PlayTone, data, state)) != GN_ERR_NONE) break;
		if (ulen > 2 * dt.tv_usec + 20000)
			usleep(ulen - 2 * dt.tv_usec - 20000);
		tone.volume = 0;
		if ((error = gn_sm_functions(GN_OP_PlayTone, data, state)) != GN_ERR_NONE) break;
		usleep(20000);
	}
	tone.frequency = 0;
	tone.volume = 0;
	gn_sm_functions(GN_OP_PlayTone, data, state);

	if (error == GN_ERR_NONE)
		fprintf(stderr, _("Play succeeded!\n"));
	else
		fprintf(stderr, _("Play failed: %s\n"), gn_error_print(error));

	return error;
}
Пример #6
0
gn_error setringtone(int argc, char *argv[], gn_data *data, struct gn_statemachine *state)
{
	gn_ringtone ringtone;
	gn_raw_data rawdata;
	gn_error error;
	unsigned char buff[512];
	char *filename = optarg;
	int i, location;

	bool raw = false;
	char name[16] = "";
	struct option options[] = {
		{ "raw",    no_argument,       NULL, 'r'},
		{ "name",   required_argument, NULL, 'n'},
		{ NULL,     0,                 NULL, 0}
	};

	while ((i = getopt_long(argc, argv, "rn:", options, NULL)) != -1) {
		switch (i) {
		case 'r':
			raw = true;
			break;
		case 'n':
			snprintf(name, sizeof(name), "%s", optarg);
			break;
		default:
			return setringtone_usage(stderr, -1);
		}
	}
	if (argc - optind > 2) {
		/* There are too many arguments that don't start with '-' */
		return setringtone_usage(stderr, -1);
	}

	memset(&ringtone, 0, sizeof(ringtone));
	rawdata.data = buff;
	rawdata.length = sizeof(buff);
	gn_data_clear(data);
	data->ringtone = &ringtone;
	data->raw_data = &rawdata;

	errno = 0;
	location = (argc > optind + 1) ? gnokii_atoi(argv[optind + 1]) : -1;
	if (errno)
		return setringtone_usage(stderr, -1);

	if (!filename) {
		fprintf(stderr, _("Internal gnokii error: null filename\n"));
		return GN_ERR_FAILED;
	}

	if (raw) {
		FILE *f;

		if ((f = fopen(filename, "rb")) == NULL) {
			fprintf(stderr, _("Failed to load ringtone.\n"));
			return GN_ERR_FAILED;
		}
		rawdata.length = fread(rawdata.data, 1, rawdata.length, f);
		fclose(f);
		ringtone.location = location;
		if (*name)
			snprintf(ringtone.name, sizeof(ringtone.name), "%s", name);
		else
			snprintf(ringtone.name, sizeof(ringtone.name), "GNOKII");
		error = gn_sm_functions(GN_OP_SetRawRingtone, data, state);
	} else {
		if ((error = gn_file_ringtone_read(filename, &ringtone))) {
			fprintf(stderr, _("Failed to load ringtone.\n"));
			return error;
		}
		ringtone.location = location;
		if (*name) snprintf(ringtone.name, sizeof(ringtone.name), "%s", name);
		error = gn_sm_functions(GN_OP_SetRingtone, data, state);
	}

	if (error == GN_ERR_NONE)
		fprintf(stderr, _("Send succeeded!\n"));
	else
		fprintf(stderr, _("Send failed: %s\n"), gn_error_print(error));

	return error;
}
Пример #7
0
gn_error getringtone(int argc, char *argv[], gn_data *data, struct gn_statemachine *state)
{
	gn_ringtone ringtone;
	gn_raw_data rawdata;
	gn_error error;
	unsigned char buff[512];
	char *filename = optarg;
	int i;

	bool raw = false;
	struct option options[] = {
		{ "raw",    no_argument, NULL, 'r'},
		{ NULL,     0,           NULL, 0}
	};

	memset(&ringtone, 0, sizeof(ringtone));
	rawdata.data = buff;
	rawdata.length = sizeof(buff);
	gn_data_clear(data);
	data->ringtone = &ringtone;
	data->raw_data = &rawdata;

	while ((i = getopt_long(argc, argv, "r", options, NULL)) != -1) {
		switch (i) {
		case 'r':
			raw = true;
			break;
		default:
			return getringtone_usage(stderr, -1);
		}
	}
	if (argc == optind) {
		/* There are 0 arguments that don't start with '-' */
		init_ringtone_list(data, state);
		ringtone.location = ringtone_list.userdef_location;
	} else if (argc - optind == 1) {
		/* There is 1 argument that doesn't start with '-' */
		ringtone.location = gnokii_atoi(argv[optind]);
		if (errno || ringtone.location < 0)
			return getringtone_usage(stderr, -1);
	} else {
		/* There are too many arguments that don't start with '-' */
		return getringtone_usage(stderr, -1);
	}

	if (raw)
		error = gn_sm_functions(GN_OP_GetRawRingtone, data, state);
	else
		error = gn_sm_functions(GN_OP_GetRingtone, data, state);
	if (error != GN_ERR_NONE) {
		fprintf(stderr, _("Getting ringtone %d failed: %s\n"), ringtone.location, gn_error_print(error));
		goto out;
	}
	fprintf(stderr, _("Getting ringtone %d (\"%s\") succeeded!\n"), ringtone.location, ringtone.name);

	if (!filename) {
		fprintf(stderr, _("Internal gnokii error: null filename\n"));
		error = GN_ERR_FAILED;
		goto out;
	}

	if (raw) {
		FILE *f;

		if ((f = fopen(filename, "wb")) == NULL) {
			fprintf(stderr, _("Failed to save ringtone.\n"));
			error = -1;
			goto out;
		}
		if (fwrite(rawdata.data, rawdata.length, 1, f) < 1) {
			fprintf(stderr, _("Failed to write ringtone.\n"));
			error = -1;
		}
		fclose(f);
	} else {
		if ((error = gn_file_ringtone_save(filename, &ringtone)) != GN_ERR_NONE) {
			fprintf(stderr, _("Failed to save ringtone: %s\n"), gn_error_print(error));
			/* return */
		}
	}
out:
	return error;
}
Пример #8
0
/* ToDo notes receiving. */
gn_error gettodo(int argc, char *argv[], gn_data *data, struct gn_statemachine *state)
{
	gn_todo_list	todolist;
	gn_todo		todo;
	gn_error	error = GN_ERR_NONE;
	bool		vcal = false;
	int		i, first_location, last_location;

	struct option options[] = {
		{ "vCal",    optional_argument, NULL, 'v'},
		{ NULL,      0,                 NULL, 0}
	};

	first_location = gnokii_atoi(optarg);
	if (errno || first_location < 0)
		return gettodo_usage(stderr, -1);
	last_location = parse_end_value_option(argc, argv, optind, first_location);
	if (errno || last_location < 0)
		return gettodo_usage(stderr, -1);

	while ((i = getopt_long(argc, argv, "v", options, NULL)) != -1) {
		switch (i) {
		case 'v':
			vcal = true;
			break;
		default:
			return gettodo_usage(stderr, -1);
		}
	}

	for (i = first_location; i <= last_location; i++) {
		todo.location = i;

		gn_data_clear(data);
		data->todo = &todo;
		data->todo_list = &todolist;

		error = gn_sm_functions(GN_OP_GetToDo, data, state);
		switch (error) {
		case GN_ERR_NONE:
			if (vcal) {
				gn_todo2ical(stdout, &todo);
			} else {
				fprintf(stdout, _("%s: %s\n"), _("Todo"), todo.text);
				fprintf(stdout, _("%s: %s\n"), _("Priority"), gn_todo_priority2str(todo.priority));
			}
			break;
		default:
			/* stop processing if the last note was specified as "end" */
			if (last_location == INT_MAX) {
				/* it's not an error if we read at least a note and the rest is empty */
				if ((i > first_location) && ((error == GN_ERR_EMPTYLOCATION) || (error == GN_ERR_INVALIDLOCATION))) {
					error = GN_ERR_NONE;
				}
				last_location = 0;
			}
			if (error != GN_ERR_NONE) {
				fprintf(stderr, _("The ToDo note could not be read: %s\n"), gn_error_print(error));
			}
		}
	}
	return error;
}
Пример #9
0
/* ToDo notes writing */
gn_error writetodo(int argc, char *argv[], gn_data *data, struct gn_statemachine *state)
{
	gn_todo todo;
	gn_error error = GN_ERR_NONE;
	int first_location, last_location, i;
	FILE *f;

	f = fopen(optarg, "r");
	if (f == NULL) {
		fprintf(stderr, _("Can't open file %s for reading!\n"), optarg);
		return GN_ERR_FAILED;
	}

	first_location = gnokii_atoi(argv[optind]);
	if (errno || first_location < 0) {
		fclose(f);
		return writetodo_usage(stderr, -1);
	}
	last_location = parse_end_value_option(argc, argv, optind + 1, first_location);
	if (errno || last_location < 0) {
		fclose(f);
		return writetodo_usage(stderr, -1);
	}

	for (i = first_location; i <= last_location; i++) {

		memset(&todo, 0, sizeof(todo));
		gn_data_clear(data);
		data->todo = &todo;

		/* TODO: gn_ical2todo expects the pointer to begin file to
		 * iterate. Fix it to not rewind the file each time
		 */
		rewind(f);
		error = gn_ical2todo(f, &todo, i);

#ifndef WIN32
		if (error == GN_ERR_NOTIMPLEMENTED) {
			switch (gn_vcal_file_todo_read(optarg, &todo, i)) {
			case 0:
				error = GN_ERR_NONE;
				break;
			default:
				error = GN_ERR_FAILED;
				break;
			}
		}
#endif
		if (error != GN_ERR_NONE) {
			/* when reading until 'end' it's not an error if it tried to read a non existant note */
			if ((last_location == INT_MAX) && (error == GN_ERR_EMPTYLOCATION)) {
				error = GN_ERR_NONE;
			} else {
				fprintf(stderr, _("Failed to load vCalendar file: %s\n"), gn_error_print(error));
			}
			fclose(f);
			return error;
		}

		error = gn_sm_functions(GN_OP_WriteToDo, data, state);
	
		if (error == GN_ERR_NONE) {
			fprintf(stderr, _("Successfully written!\n"));
			fprintf(stderr, _("Priority %d. %s\n"), data->todo->priority, data->todo->text);
		} else
			fprintf(stderr, _("Failed to write ToDo note: %s\n"), gn_error_print(error));
	}
	fclose(f);

	return error;
}
Пример #10
0
/* Get MMS messages. */
gn_error getmms(int argc, char *argv[], gn_data *data, struct gn_statemachine *state)
{
	int i, del = 0;
	gn_sms_folder folder;
	gn_sms_folder_list folderlist;
	gn_mms *message;
	char *memory_type_string;
	int start_message, end_message, count;
	gnokii_app_mode mode = GNOKII_APP_MODE_Ask;
	char filename[64];
	gn_error error = GN_ERR_NONE;
	gn_mms_format output_format_type = GN_MMS_FORMAT_TEXT;

	struct option options[] = {
		{ "mime",       required_argument, NULL, GN_MMS_FORMAT_MIME},
		{ "pdu",        required_argument, NULL, GN_MMS_FORMAT_PDU},
		{ "raw",        required_argument, NULL, GN_MMS_FORMAT_RAW},
		{ "delete",     no_argument,       NULL, 'd' },
		{ "overwrite",  no_argument,       NULL, 'o' },
		{ NULL,         0,                 NULL, 0 }
	};

	/* Handle command line args that set type, start and end locations. */
	memory_type_string = optarg;
	if (gn_str2memory_type(memory_type_string) == GN_MT_XX) {
		fprintf(stderr, _("Unknown memory type %s (use ME, SM, IN, OU, ...)!\n"), optarg);
		fprintf(stderr, _("Run gnokii --showsmsfolderstatus for a list of supported memory types.\n"));
		return GN_ERR_INVALIDMEMORYTYPE;
	}

	start_message = gnokii_atoi(argv[optind]);
	if (errno || start_message < 0)
		return getmms_usage(stderr, -1);
	end_message = parse_end_value_option(argc, argv, optind + 1, start_message);
	if (errno || end_message < 0)
		return getmms_usage(stderr, -1);

	*filename = '\0';
	/* parse all options (beginning with '-') */
	while ((i = getopt_long(argc, argv, "1:2:3:do", options, NULL)) != -1) {
		switch (i) {
		case 'd':
			del = 1;
			break;
		/* force mode -- don't ask to overwrite */
		case 'o':
			mode = GNOKII_APP_MODE_Overwrite;
			break;
		case GN_MMS_FORMAT_MIME:
			/* FALL THROUGH */
		case GN_MMS_FORMAT_PDU:
			/* FALL THROUGH  */
		case GN_MMS_FORMAT_RAW:
			/* output formats are mutually exclusive */
			if (output_format_type != GN_MMS_FORMAT_TEXT) {
				return getmms_usage(stderr, -1);
			}
			output_format_type = i;
			if (!optarg) {
				return getsms_usage(stderr, -1);
			}
			snprintf(filename, sizeof(filename), "%s", optarg);
			fprintf(stderr, _("Saving into %s\n"), filename);
			break;
		default:
			return getmms_usage(stderr, -1);
		}
	}
	if (argc - optind > 3) {
		/* There are too many arguments that don't start with '-' */
		return getmms_usage(stderr, -1);
	}

	folder.folder_id = 0;
	data->sms_folder = &folder;
	data->sms_folder_list = &folderlist;
	/* Now retrieve the requested entries. */
	for (count = start_message; count <= end_message; count++) {

		error = gn_mms_alloc(&message);
		if (error != GN_ERR_NONE)
			break;
		message->memory_type = gn_str2memory_type(memory_type_string);
		message->number = count;
		message->buffer_format = output_format_type;
		data->mms = message;

		error = gn_mms_get(data, state);
		switch (error) {
		case GN_ERR_NONE:
			if (*filename) {
				/* writebuffer() will set mode to "append" */
				mode = writebuffer(filename, data->mms->buffer, data->mms->buffer_length, mode);
			} else {
				error = fprint_mms(stdout, message);
				fprintf(stdout, "\n");
			}
			if (del && mode != GNOKII_APP_MODE_Cancel) {
				if (GN_ERR_NONE != gn_mms_delete(data, state))
					fprintf(stderr, _("(delete failed)\n"));
				else
					fprintf(stderr, _("(message deleted)\n"));
			}
			break;
		default:
			if ((error == GN_ERR_INVALIDLOCATION) && (end_message == INT_MAX) && (count > start_message)) {
				error = GN_ERR_NONE;
				/* Force exit */
				mode = GNOKII_APP_MODE_Cancel;
				break;
			}
			fprintf(stderr, _("Getting MMS failed (location %d from memory %s)! (%s)\n"), count, memory_type_string, gn_error_print(error));
			if (error == GN_ERR_INVALIDMEMORYTYPE) {
				fprintf(stderr, _("Unknown memory type %s (use ME, SM, IN, OU, ...)!\n"), optarg);
				fprintf(stderr, _("Run gnokii --showsmsfolderstatus for a list of supported memory types.\n"));
			}
			if (error == GN_ERR_EMPTYLOCATION)
				error = GN_ERR_NONE;
			break;
		}
		gn_mms_free(message);
		if (mode == GNOKII_APP_MODE_Cancel)
			break;
	}

	return error;
}
Пример #11
0
/* Reads profile from phone and displays its' settings */
gn_error getprofile(int argc, char *argv[], gn_data *data, struct gn_statemachine *state)
{
	int max_profiles;
	int start, stop, i;
	gn_profile p;
	gn_ringtone_list rl;
	gn_error error = GN_ERR_NOTSUPPORTED;

	/* Hopefully is 64 larger as FB38_MAX* / FB61_MAX* */
	char model[64] = "";
	bool raw = false;
	struct option options[] = {
		{ "raw",    no_argument, NULL, 'r'},
		{ NULL,     0,           NULL, 0}
	};

	while ((i = getopt_long(argc, argv, "r", options, NULL)) != -1) {
		switch (i) {
		case 'r':
			raw = true;
			break;
		default:
			return getprofile_usage(stderr, -1); /* FIXME */
		}
	}

	gn_data_clear(data);
	data->model = model;
	while (gn_sm_functions(GN_OP_GetModel, data, state) != GN_ERR_NONE)
		sleep(1);

	p.number = 0;
	memset(&rl, 0, sizeof(gn_ringtone_list));
	gn_data_clear(data);
	data->profile = &p;
	data->ringtone_list = &rl;
	error = gn_sm_functions(GN_OP_GetProfile, data, state);

	switch (error) {
	case GN_ERR_NONE:
		break;
	default:
		fprintf(stderr, _("Error: %s\n"), gn_error_print(error));
		return error;
	}

	max_profiles = 7; /* This is correct for 6110 (at least my). How do we get
			     the number of profiles? */

	/* For N5110 */
	/* FIXME: It should be set to 3 for N5130 and 3210 too */
	if (!strcmp(model, "NSE-1"))
		max_profiles = 3;

	if (argc > optind) {
		start = gnokii_atoi(argv[optind]);
		if (errno || start < 0)
			return getprofile_usage(stderr, -1);
		stop = (argc > optind + 1) ? gnokii_atoi(argv[optind + 1]) : start;
		if (errno || stop < 0)
			return getprofile_usage(stderr, -1);

		if (start > stop) {
			fprintf(stderr, _("Starting profile number is greater than stop\n"));
			return GN_ERR_FAILED;
		}

		if (start < 0) {
			fprintf(stderr, _("Profile number must be value from 0 to %d!\n"), max_profiles - 1);
			return GN_ERR_FAILED;
		}

		if (stop >= max_profiles) {
			fprintf(stderr, _("This phone supports only %d profiles!\n"), max_profiles);
			return GN_ERR_FAILED;
		}
	} else {
		start = 0;
		stop = max_profiles - 1;
	}

	gn_data_clear(data);
	data->profile = &p;
	data->ringtone_list = &rl;

	for (i = start; i <= stop; i++) {
		p.number = i;

		if (p.number != 0) {
			error = gn_sm_functions(GN_OP_GetProfile, data, state);
			if (error != GN_ERR_NONE) {
				fprintf(stderr, _("Cannot get profile %d\n"), i);
				fprintf(stderr, _("Error: %s\n"), gn_error_print(error));
				return error;
			}
		}

		if (raw) {
			fprintf(stdout, "%d;%s;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d\n",
				p.number, p.name, p.default_name, p.keypad_tone,
				p.lights, p.call_alert, p.ringtone, p.volume,
				p.message_tone, p.vibration, p.warning_tone,
				p.caller_groups, p.automatic_answer);
		} else {
			/* Translators: %d is the profile number, %s is the profile name. Example: 1. "Outdoors" */
			fprintf(stdout, _("%d. \"%s\"\n"), p.number, p.name);
			if (p.default_name == -1) fprintf(stdout, _(" (name defined)\n"));
			fprintf(stdout, _("Incoming call alert: %s\n"), gn_profile_callalert_type2str(p.call_alert));
			fprintf(stdout, _("Ringing tone: %s (%d)\n"), get_ringtone_name(p.ringtone, data, state), p.ringtone);
			fprintf(stdout, _("Ringing volume: %s\n"), gn_profile_volume_type2str(p.volume));
			fprintf(stdout, _("Message alert tone: %s\n"), gn_profile_message_type2str(p.message_tone));
			fprintf(stdout, _("Keypad tones: %s\n"), gn_profile_keyvol_type2str(p.keypad_tone));
			fprintf(stdout, _("Warning and game tones: %s\n"), gn_profile_warning_type2str(p.warning_tone));

			/* FIXME: Light settings is only used for Car */
			if (p.number == (max_profiles - 2)) fprintf(stdout, _("Lights: %s\n"), p.lights ? _("On") : _("Automatic"));
			fprintf(stdout, _("Vibration: %s\n"), gn_profile_vibration_type2str(p.vibration));

			/* FIXME: it will be nice to add here reading caller group name. */
			if (max_profiles != 3) fprintf(stdout, _("Caller groups: 0x%02x\n"), p.caller_groups);

			/* FIXME: Automatic answer is only used for Car and Headset. */
			if (p.number >= (max_profiles - 2)) fprintf(stdout, _("Automatic answer: %s\n"), p.automatic_answer ? _("On") : _("Off"));
			fprintf(stdout, "\n");
		}
	}

	return error;
}