File: reclp_main.c

package info (click to toggle)
gramofile 1.6-11
  • links: PTS
  • area: main
  • in suites: buster, stretch
  • size: 1,436 kB
  • ctags: 1,125
  • sloc: ansic: 11,252; makefile: 60
file content (57 lines) | stat: -rw-r--r-- 1,030 bytes parent folder | download | duplicates (2)
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
50
51
52
53
54
55
56
57
/* Record from LP

 * Copyright (C) 1998 J.A. Bezemer
 *
 * Licensed under the terms of the GNU General Public License.
 * ABSOLUTELY NO WARRANTY.
 * See the file `COPYING' in this directory.
 */

#include "reclp_main.h"
#include "reclp_filenm.h"
#include "errorwindow.h"
#include <stdlib.h>
#include <stdio.h>
#ifndef OLD_CURSES
#include <ncurses.h>
#else
#include <curses.h>
#endif

#define BRECCMD "/usr/lib/gramofile/brec_gramo"

void
record_from_lp (char *startdir)
{
  char filename[250];
  char shellcmd[500], *tmp;
  int ret, len;

  if (!record_from_lp_get_filename (startdir, filename))
    return;

  def_prog_mode ();		/* save terminal state */

  tmp = shellcmd;
  len = 500;

retry:  
  ret = snprintf (tmp, 500, BRECCMD " -S -s 44100 -b 16 -t 6000 -w \"%s\"",
	          filename);

  if (ret > len)
    {
       tmp = alloca(ret);
       len = ret;
       if (tmp)
         goto retry;
       return;
    }

  if (ret == -1)
    return;
  
  system (shellcmd);

  reset_prog_mode ();		/* reset terminal state */
}