comparison cmd.c @ 15:3380c8fd9776

Show all record fields except the password by default
author Guido Berhoerster <guido+pwm@berhoerster.name>
date Mon, 07 Aug 2017 19:11:56 +0200
parents a01899a6e4bb
children a07665727c19
comparison
equal deleted inserted replaced
14:a01899a6e4bb 15:3380c8fd9776
718 { 718 {
719 unsigned int id; 719 unsigned int id;
720 struct record *record; 720 struct record *record;
721 int i; 721 int i;
722 enum field_type type; 722 enum field_type type;
723 int fields[COUNTOF(field_namev) - 1] = { 0 }; 723 int fields[COUNTOF(field_namev) - 1] = {
724 [FIELD_GROUP] = 1,
725 [FIELD_TITLE] = 1,
726 [FIELD_USERNAME] = 1,
727 [FIELD_PASSWORD] = 0,
728 [FIELD_NOTES] = 1,
729 [FIELD_URL] = 1,
730 [FIELD_MTIME] = 1,
731 [FIELD_CTIME] = 1
732 };
724 733
725 if (argc < 2) { 734 if (argc < 2) {
726 return (CMD_USAGE); 735 return (CMD_USAGE);
727 } 736 }
728 737
729 if (parse_id(argv[1], &id) != 0) { 738 if (parse_id(argv[1], &id) != 0) {
730 fprintf(stderr, "invalid id %s\n", argv[1]); 739 fprintf(stderr, "invalid id %s\n", argv[1]);
731 return (CMD_ERR); 740 return (CMD_ERR);
741 }
742
743 if (argc > 2) {
744 /* show only explicitly given field names */
745 memset(fields, 0, sizeof (fields));
732 } 746 }
733 747
734 for (i = 2; i < argc; i++) { 748 for (i = 2; i < argc; i++) {
735 type = parse_arg(argv[i], field_namev, '\0', NULL); 749 type = parse_arg(argv[i], field_namev, '\0', NULL);
736 if (type < 0) { 750 if (type < 0) {