File: args.c

package info (click to toggle)
termrec 0.19-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,148 kB
  • sloc: ansic: 8,430; makefile: 181; perl: 16; sh: 15
file content (49 lines) | stat: -rw-r--r-- 1,323 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include "sys/error.h"
#include "gettext.h"
#include "ttyrec.h"
#include "common.h"

extern char *optarg;

void get_w_format(const char **format)
{
    int i;
    const char *fn, *fe;

    if (*format)
        die(_("You can use only one format at a time.\n"));
    if (!(*format=ttyrec_w_find_format(optarg, 0, 0)))
    {
        fprintf(stderr, _("No such format: %s\n"), optarg);
        fprintf(stderr, _("Valid formats:\n"));
        for (i=0;(fn=ttyrec_w_get_format_name(i));i++)
            if ((fe=ttyrec_w_get_format_ext(fn)))
                fprintf(stderr, " %-15s (%s)\n", fn, fe);
            else
                fprintf(stderr, " %-15s\n", fn);
        exit(1);
    }
}

void get_r_format(const char **format)
{
    int i;
    const char *fn, *fe;

    if (*format)
        die(_("You can use only one format at a time.\n"));
    if (!(*format=ttyrec_r_find_format(optarg, 0, 0)))
    {
        fprintf(stderr, _("No such format: %s\n"), optarg);
        fprintf(stderr, _("Valid formats:\n"));
        for (i=0;(fn=ttyrec_r_get_format_name(i));i++)
            if ((fe=ttyrec_r_get_format_ext(fn)))
                fprintf(stderr, " %-15s (%s)\n", fn, fe);
            else
                fprintf(stderr, " %-15s\n", fn);
        exit(1);
    }
}