LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 09-20-2007, 08:58 AM   #1
tony_stevens
LQ Newbie
 
Registered: Apr 2004
Posts: 14

Rep: Reputation: 0
music on console patch


Hi,

I would like to apply this patch

Index: playlist_file.c
===================================================================
--- playlist_file.c (revision 1951)
+++ playlist_file.c (revision 1952)
@@ -30,6 +30,8 @@
#include "interface.h"
#include "decoder.h"

+#define MAX(a,b) ((a) > (b) ? (a) : (b))
+
int is_plist_file (const char *name)
{
const char *ext = ext_pos (name);
@@ -199,12 +201,15 @@
char *line = NULL;
int in_section = 0;
char *value = NULL;
+ int key_len;

if (fseek(file, 0, SEEK_SET)) {
error ("File fseek() error: %s", strerror(errno));
return NULL;
}

+ key_len = strlen (key);
+
while ((line = read_line(file))) {
if (line[0] == '[') {
if (in_section) {
@@ -248,7 +253,8 @@
break;
}

- if (!strncasecmp(line, key, t2 - line + 1)) {
+ if (!strncasecmp(line, key,
+ MAX(t2 - line + 1, key_len))) {
value = t + 1;

while (isblank(value[0]))

which is to fix the problem that moc only loads the first 9 entries on a playlist but I have no idea how to do this.

Any help appreciated

Tony
 
Old 09-20-2007, 10:22 AM   #2
matthewg42
Senior Member
 
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

Rep: Reputation: 65
You need to use the patch program.

The trick with patch is working out how deep the patch applies. That is, the patch file might refer to source files in sub-directories within a source tree, and if they do, you need to tell patch how deep in the tree to apply the patch.

Lucky for you, your patch applies in the current working directory. You can tell this by looking at the part which identifies the files to modify - the "Index:" line. In your case there are no leading directory names, so you want to run the patch program from the same directory where the playlist_file.c file resides.

I don't know this moc project, so this is an example with you will probably need to modify. Say you have this file playlist_file.c in your [home]/moc/src directory. Save the patch file to this directory. Lets say it's called "my.patch".

Start a terminal and change directory to [home]/moc/src:
Code:
cd ~/moc/src
Backup the original file!
Code:
cp playlist_file.c playlist_file.c.backup
Then apply the patch like this:
Code:
patch < my.patch
If all goes well you will just see a message saying, "patching file playlist_file.c".

Note that if the patch file was created from a file which was different to the version you havem you will get some warnings. Often patch can work around minor differences (e.g. small edits in parts of the file not overlapping the patched part), but sometimes it will not be able to help. YMMV.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Do you play music in console? konsolebox Linux - General 35 08-09-2006 09:01 PM
Patch for underlined text on Console? hammernail Linux - Kernel 1 05-09-2006 07:37 PM
Good console music player capable of streams? Moses420ca Linux - Software 1 10-26-2005 05:05 AM
music player console Longinus Linux - Software 5 05-09-2004 05:58 AM
How to Apply patch for Mass Storage device to work? (uss725-2.4.20-rc2.patch) cevjr Linux - Hardware 3 04-21-2004 12:14 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 05:22 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration