comparison pwm.c @ 23:1b89066d992c

Add read-only mode
author Guido Berhoerster <guido+pwm@berhoerster.name>
date Sun, 17 Sep 2017 18:45:05 +0200
parents ec01c579024a
children 722a45b4028b
comparison
equal deleted inserted replaced
22:ec01c579024a 23:1b89066d992c
47 #include "util.h" 47 #include "util.h"
48 48
49 static void 49 static void
50 usage(void) 50 usage(void)
51 { 51 {
52 fprintf(stderr, "usage: %s [-P file] [filename]\n", getprogname()); 52 fprintf(stderr, "usage: %s [-P file] [-R] [filename]\n", getprogname());
53 } 53 }
54 54
55 void 55 void
56 pwm_err(struct pwm_ctx *ctx, char *fmt, ...) 56 pwm_err(struct pwm_ctx *ctx, char *fmt, ...)
57 { 57 {
342 goto out; 342 goto out;
343 } 343 }
344 344
345 ctx.is_interactive = isatty(STDIN_FILENO); 345 ctx.is_interactive = isatty(STDIN_FILENO);
346 346
347 while (!errflag && (c = getopt(argc, argv, "P:h")) != -1) { 347 while (!errflag && (c = getopt(argc, argv, "P:Rh")) != -1) {
348 switch (c) { 348 switch (c) {
349 case 'P': 349 case 'P':
350 master_password_filename = optarg; 350 master_password_filename = optarg;
351 break;
352 case 'R':
353 ctx.is_readonly = 1;
351 break; 354 break;
352 case 'h': 355 case 'h':
353 usage(); 356 usage();
354 status = EXIT_SUCCESS; 357 status = EXIT_SUCCESS;
355 goto out; 358 goto out;