trouble understanding file option and command line arguments
Hi,
I am creating a program with the C language that simulates the WC command in Unix. My program needs to count lines, bytes and words. I have not added the code to count bytes and words yet. I am having trouble understanding what the file option/flag '-' does. I can not visualize how it moves through program code. argc and argv look at one line at a time and they only look at what is on the command line. I am not sure how a program is broken up into files for WC to read.
this is the code I have so far:
Right now I have code to just count the lines. I am testing the program on a hello world program below:
when I test the program, I get 0 for line count.
California State University, Northridge, USA, Prof Gabrovsky, Comp 322
Couple of questions as I try to decipher someones code who left...
What would something coded like this do?
IFS=:
grep FIELD1 /Path/Path2/Param.fle | read LBL1 LBL2 USRID EADR SUBJ SERVERNAME CFGTBL DIR
ERR=0
Param.fle contents..
FIELD1:FEI::FIELD2:dATAFIELD BATCH:MAIN SERVER......etc.. (2 Replies)
hi, can someone how to accept command line arguments as a variable using in script?
like: ./scriptname arguments
by accept arguments, I can use it in my script?
thx! (1 Reply)
Sometimes it works for me and sometimes I get this error:
syntax error on line 1, teletype
Basically I've got no idea whats going on, especially at the end of the command: bc
Any help is appreciated (1 Reply)
I have a C++ program. I read command line arguments, but if the value is not supplied, I default or make a calculation. Let's say I set it to a default value.
I can code this in several ways. Here I show three ways. What would be the best way for maintaining this code? The program will get very... (2 Replies)
What are the commands to manage ports from my command line.
Example:
Opening Ports, Closing Ports, Viewing their status, etc.
I am having a hard time finding this answer. I'm trying to trouble shoot some networking problems and it would be very helpful if I could just do this from the... (1 Reply)
Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
1. The problem statement, all variables and given/known data:
1) The script is executed in the Korn shell.
2) Name the shell script file is asg6s.
3) The asg6s file is... (7 Replies)
:wall:killall -wHi
i need to understand how the -w option works in terms of processes.
If this command is issued does it literally terminate all running processes ..wait for them all to be terminated and then return to standard output ?
Thanks in advance (2 Replies)
I am looking for help in processing of those options: '-n' or '-p'
I understand what they do and how to use them.
But, I would like to use them with more than one file (and without any shell-loop; loading the 'perl' once.)
I did try it and -n works on 2 files.
Question is:
- is it possible to... (6 Replies)
Ok, thank you. Again I'm new to the programming thing, I'm just trying to figure out what exactly it is I need to do. How would I cash out bits? Numerous questions. I'm a dreamer. AI attempts to communicate with me regularly especially through unfinished apps that I'm assuming is my responsibility... (1 Reply)
Discussion started by: C-lo
1 Replies
LEARN ABOUT DEBIAN
pospell
pospell(1) User Manuals pospell(1)NAME
pospell - Run a program on the translation strings of a .po-file
SYNOPSIS
pospell [-l language ] [-fsv] -n pofile -p program [-- [ arguments... ]]
DESCRIPTION
pospell copies the translations from the pofile to a temporary file (called the spellfile) and then calls program with its arguments. pro-
gram is supposed to somehow change the spellfile. It is typically a spell checker. Afterwards the possibly changed translations in spell-
file is copied back into the pofile.
If pofile is specified as - then pospell will act as a filter, i.e. standard input and standard output will be used.
%f in the arguments will be expanded to the name of the spellfile, or - if the -f option is used. Use %% for a real % character.
All comment lines in the pofile are replaced with lines with "#" as the only character in the spellfile. The msgid strings with original
text in the pofile are replaced with lines with ">" and "]" as the only characters in the spellfile. The msgstr strings with file headers
(i.e. strings without corresponding msgid strings) are replaced with lines with ")" and "]" as the only characters in the spellfile. Don't
change or remove these lines from the spellfile - they are used when the spellfile and the pofile are merged together after running the
program.
The normal msgstr strings are copied to the spellfile with some changes: 1) The word msgstr and everything else before the string is
replaced by a "+" character. 2) Strings with C escape sequences followed by a letter like "one two" are split to parts like "one "
"two". 3) Leading whitespace in continuation lines is removed. The changes of kind 1) and 2) are undone when the spellfile is copied back
into the pofile, but removed whitespace will not be restored.
OPTIONS -f The called program is a filter so don't make a temporary file, but pipe the spellfile to its standard input and read it back from
its standard output.
-l language
Only translations with the indicated language code are copied to the spellfile.
-s Quit with an error message if unrecognized items are found in the pofile or spellfile.
-v Print the version and exit.
FILES
pospell uses one or two temporary files with names given by the mkstemp(3) or the tmpnam(3) function.
BUGS
If some system call gives an unexpected error pospell will stop immediately with an error message leaving its temporary files.
AUTHOR
Byrial Jensen <byrial@image.dk>
SEE ALSO
The GNU gettext utilities.
newsbody(1).
Unix APRIL 2000 pospell(1)