Sponsored Content
Top Forums Shell Programming and Scripting Detect sprintf and fprintf bad use Post 302397449 by albertogarcia on Monday 22nd of February 2010 07:39:04 AM
Old 02-22-2010
Detect sprintf and fprintf bad use

Hello again,

I don't know about regexp so I throw this question here:

How can I detect files where, for example:
Code:
sprintf (var1, "hello %s %s", sub1);

The problem here is that we have 2 %s and only a variable.

Or... the inverse:
Code:
sprintf (var1, "hello %s %s", sub1, sub2, sub3,...subn);

And...the sentences can be in more than one line:
Code:
sprintf (var1, 
"hello %s %s", 
sub1);

I know that this is not inmediate, I'll try a solution this afternoon, but if somebody can tell me a clue where I can start....


Thank you very much

Last edited by pludi; 02-22-2010 at 09:01 AM.. Reason: code tags, please...
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

how to write to file using fprintf in find command...

:D I once again am looking through the man pages and am still working on the find command to fully comprehend all its attributes.. i am a little stuck on a problem with how many options to -print there are and the only two I know how to use are printf and -print.. i can not make heads or tails of... (2 Replies)
Discussion started by: moxxx68
2 Replies

2. Programming

sprintf function

Hi, Can someone help me to figure out whether this code is to write file to /tmp/TIMECLOCK directory or just to asign a variable with "/tmp/TIMECLOCK/name.log_copy.pid" as the string? I am looking into an old C program and could not figure out where in the code that creates... (1 Reply)
Discussion started by: whatisthis
1 Replies

3. Shell Programming and Scripting

ksh scripting sprintf

is there any sprintf function in korn shell scripting, or anything similar to sprintf? (2 Replies)
Discussion started by: gfhgfnhhn
2 Replies

4. Programming

equivalent of sprintf in C++

Hi My requirement is to convert the following to C++ char buffer; sprintf(buffer,"%s %-50s %6s %-6d %s\n",a.substr(0,5),a.substr(10,20)) Since the buffer is of varying length, i cannot hardcode the value as 90. i would like to convert the buffer to string object so that it can receive any... (1 Reply)
Discussion started by: dhanamurthy
1 Replies

5. Programming

fprintf

Could someone explain me the following fprintf format: fprintf (stderr, _("Try `%s --help' for more information.\n"), program_name); Why just not use: fprintf(stderr, "ry `%s --help' for more information.\n", program_name) I mean what is _() does? (1 Reply)
Discussion started by: mirusnet
1 Replies

6. Shell Programming and Scripting

sprintf result on perl

Hello, In perl lang, I have create a string (@str) by sprintf but unfortunately when program printed it out, only I could saw a number like 1. Certainly printf doesn't problem. How I can convert a string that are result of sprintf to a common string format??! Thanks in advance. PLEASE HELP ME. (2 Replies)
Discussion started by: Zaxon
2 Replies

7. Shell Programming and Scripting

printf vs sprintf - perl

I would like to assign the output of printf to a variable in perl , it give me back a "1" instead of the time. How can I stuff the variable with what printf returns? Here is my code: #!/usr/bin/perl $time = localtime(time);... (3 Replies)
Discussion started by: Dabheeruz
3 Replies

8. Programming

Problem with Sprintf

Hi, I have the below sample code to hash the input number read from file. File will have 16 to 19 digit number and executable hash the number using some logic and returns the hashed value. Each digit in the 16 digit number is converted to a 4 byte value. That if the input is 16digit integer, the... (6 Replies)
Discussion started by: ramkrix
6 Replies

9. Programming

fprintf() gives segmentation fault

Hi, I am using fprintf to write few strings toa file which has been opened in write mode. The syntax is as follows: printf("Testing 7A.\n"); fprintf(out_screen,"%s|%s|%s|%s|%s|\n",var1,var2,var3,var4,var5); printf("Testing 8.\n"); When I execute the code It prints "Testing 7A." then... (2 Replies)
Discussion started by: siba.s.nayak
2 Replies

10. Shell Programming and Scripting

Fprintf issue

i had to send a mail an attachment which i got from find command. But i did not get mail but could see the following line in the logs "aliased to fprintf.c". Can someone help me to understand what does it mean?..As this issue is not occuring now, i could not replicate the problem now.Thanks. (1 Reply)
Discussion started by: jesu
1 Replies
IRSEND(1)							   User Commands							 IRSEND(1)

NAME
irsend - basic LIRC program to send infra-red commands SYNOPSIS
irsend [options] DIRECTIVE REMOTE CODE [CODE...] DESCRIPTION
Asks the lircd daemon to send one or more CIR (Consumer Infra-Red) commands. This is intended for remote control of electronic devices such as TV boxes, HiFi sets, etc. DIRECTIVE can be: SEND_ONCE - send CODE [CODE ...] once SEND_START - start repeating CODE SEND_STOP - stop repeating CODE LIST - list configured remote items SET_TRANSMITTERS - set transmitters NUM [NUM ...] SIMULATE - simulate IR event REMOTE is the name of a remote, as described in the lircd configuration file. CODE is the name of a remote control key of REMOTE, as it appears in the lircd configuration file. NUM is the transmitter number of the hardware device. For the LIST DIRECTIVE, REMOTE and/or CODE can be empty: LIST "" "" - list all configured remote names LIST REMOTE "" - list all codes of REMOTE LIST REMOTE CODE - list only CODE of REMOTE The SIMULATE command only works if it has been explicitly enabled in lircd. -h --help display usage summary -v --version display version -d --device use given lircd socket [/var/run/lirc/lircd] -a --address=host[:port] connect to lircd at this address -# --count=n send command n times EXAMPLES
irsend LIST DenonTuner "" irsend SEND_ONCE DenonTuner PROG-SCAN irsend SEND_ONCE OnkyoAmpli VOL-UP VOL-UP VOL-UP VOL-UP irsend SEND_START OnkyoAmpli VOL-DOWN ; sleep 3 irsend SEND_STOP OnkyoAmpli VOL-DOWN irsend SET_TRANSMITTERS 1 irsend SET_TRANSMITTERS 1 3 4 irsend SIMULATE "0000000000000476 00 OK TECHNISAT_ST3004S" FILES
/etc/lirc/lircd.conf Default lircd configuration file. It should contain all the remotes, their infra-red codes and the corresponding timing and wave- form details. DIAGNOSTICS
If lircd is not running (or /var/run/lirc/lircd lacks write permissions) irsend aborts with the following diagnostics: "irsend: could not connect to socket" "irsend: Connection refused" (or "Permission denied"). SEE ALSO
The documentation for lirc is maintained as html pages. They are located under html/ in the documentation directory. lircd(8), mode2(1), smode2(1), xmode2(1), irrecord(1), irw(1), http://www.lirc.org. irsend 0.9.0-pre1 October 2010 IRSEND(1)
All times are GMT -4. The time now is 10:35 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy