HP 9000 User Manual page 124

Computers
Hide thumbs Also See for 9000:
Table of Contents

Advertisement

The conversion of an existing program to use messages can be automated to a
substantial degree. Consequently, even when writing a new program you may
find it easier to write the program without messages and, when it is working,
convert it to use messages.
The conversion process is:
1. Find all quoted strings in the source program. Such strings may be
messages.
2. Review the list of quoted strings and remove any that are not messages.
3. Assign a message number to each message string and replace the string in
the source program by an appropriate call to
catgets.
4. Generate a message catalog from the numbered message strings.
HP -UX commands are available that make this process fairly easy.
Step 1. Finding Strings in a Program
Use the
findstr
routine to extract strings and write them to an external file.
main( )
• •
C program
printfC Please enter your birthday (in the form MM/DD/VV:\n
II);
7
• •
num_read=scanf( lI%d/%d/%d
ll
,&month,&day,&year);
V
file
'Please enter your birthday (in the form MM/DD/YV) \ nil
lI%d/%d/%d
ll
Figure 7·5. Using findstr to Locate String Constants
The Message Catalog System 7·17

Advertisement

Table of Contents
loading

Table of Contents