/[sleep-setproctitle]/trunk/sleep-setproctitle.c
ViewVC logotype

Annotation of /trunk/sleep-setproctitle.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1 - (hide annotations) (download)
2011-03-18T13:13:25Z (13 years, 8 months ago) by trond
Content type: text/plain
File size: 646 byte(s)
Førstegangsregistrering.

1 trond 1 // $Ximalas$
2    
3     #include <sys/param.h>
4     #include <sys/types.h>
5    
6     #include <stdio.h>
7     #include <stdlib.h>
8     #include <sysexits.h>
9     #include <unistd.h>
10    
11     int main(int argc, char **argv)
12     {
13     int sleeptime;
14    
15     setproctitle("starting");
16    
17     if (argc < 2) {
18     setproctitle("invalid usage");
19    
20     fprintf(stderr, "Usage: %s <sleeptime-in-seconds>\n", argv[0]);
21     return EX_USAGE;
22     } // if
23    
24     sleeptime = atoi(argv[1]);
25    
26     while (sleeptime > 0) {
27     setproctitle("sleeping for %d second%s", sleeptime, (sleeptime == 1) ? "" : "s");
28     sleep(1);
29     sleeptime--;
30     } // while
31    
32     setproctitle("finished");
33     return EX_OK;
34     } // main()
35    
36     // sleep-setproctitle.c

Properties

Name Value
svn:eol-style native
svn:keywords Ximalas=%H
svn:mime-type text/plain

svn@ximalas.info
ViewVC Help
Powered by ViewVC 1.3.0-dev