File: sound.c

package info (click to toggle)
fookb 4.1-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, sid
  • size: 568 kB
  • sloc: sh: 1,241; ansic: 416; makefile: 15
file content (51 lines) | stat: -rw-r--r-- 763 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
/*
 * File: sound.c
 *
 * (c) 1998-2004 Alexey Vyskubov <alexey@mawhrin.net>
 */

#include <unistd.h>		/* fork() */
#include <sys/types.h>		/* pid_t */
#include <stdlib.h>		/* system */
#include <errno.h>
#include <stdio.h>		/* puts() */
#include <string.h>


#include "sound.h"
#include "params.h"

void drip()
{

	pid_t pid;

	pid = fork();

	if (pid == (pid_t) (-1)) {
		puts("Cannot fork!");
		switch (errno) {
		case ENOMEM:
			puts("Not enough memory!");
			exit(22);
			break;
		case EAGAIN:
			puts("To many processes!");
			exit(23);
			break;
		default:
			puts("Unknown error, please report!");
		}
	}

	if (pid == (pid_t) 0) {
		return;
	}

	if (!strcmp(read_param("Sound"), "Yes")) {
		exit(system(read_param("Command")));
	} else {
		exit(0);
	}

}