c
Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
| Nächste Überarbeitung | Vorhergehende Überarbeitung | ||
| c [2016-04-12 22:49:59] – Externe Bearbeitung 127.0.0.1 | c [2021-11-06 20:00:14] (aktuell) – david | ||
|---|---|---|---|
| Zeile 19: | Zeile 19: | ||
| === stdin2syslogd === | === stdin2syslogd === | ||
| - | | + | <code c> |
| - | #define SYSLOG_NAMES | + | #include < |
| - | #include < | + | #define SYSLOG_NAMES |
| - | #include < | + | #include < |
| - | #include < | + | #include < |
| - | + | #include < | |
| - | | + | |
| - | int main(int argc, const char *argv[]) | + | int main(int argc, const char *argv[]) |
| - | { | + | { |
| if (3 != argc) | if (3 != argc) | ||
| { | { | ||
| - | | + | |
| - | exit (1); | + | exit (1); |
| } | } | ||
| - | | + | |
| const char *priority_name = argv[1]; | const char *priority_name = argv[1]; | ||
| const char *tag_name = argv[2]; | const char *tag_name = argv[2]; | ||
| Zeile 42: | Zeile 42: | ||
| for (i = 0; prioritynames[i].c_name; | for (i = 0; prioritynames[i].c_name; | ||
| { | { | ||
| - | | + | |
| - | { | + | { |
| - | priority = prioritynames[i].c_val; | + | priority = prioritynames[i].c_val; |
| - | break; | + | break; |
| - | } | + | } |
| } | } | ||
| | | ||
| if (priority < 0) | if (priority < 0) | ||
| { | { | ||
| - | | + | |
| - | priority_name); | + | priority_name); |
| - | exit (1); | + | exit (1); |
| } | } | ||
| | | ||
| Zeile 64: | Zeile 64: | ||
| while (NULL != fgets(buffer, | while (NULL != fgets(buffer, | ||
| { | { | ||
| - | | + | |
| } | } | ||
| return 0; | return 0; | ||
| - | | + | } |
| + | </ | ||
| # gcc -o / | # gcc -o / | ||
| Zeile 113: | Zeile 114: | ||
| Mit diesem kleinen Programm kann jeder seine Plattform selber kontrollieren. | Mit diesem kleinen Programm kann jeder seine Plattform selber kontrollieren. | ||
| - | | + | <code c> |
| - | int main() | + | # |
| - | { | + | |
| - | printf( "\n char belegt %d Bytes", | + | int main() |
| - | printf( "\n int belegt %d Bytes", | + | { |
| - | printf( "\n short belegt %d Bytes", | + | printf(" |
| - | printf( "\n long belegt %d Bytes", | + | printf(" |
| - | printf( "\n unsigned char belegt %d Bytes", | + | printf(" |
| - | printf( "\n unsigned int belegt %d Bytes", | + | printf(" |
| - | printf( "\n unsigned short belegt %d Bytes", | + | printf(" |
| - | printf( "\n unsigned long belegt %d Bytes", | + | printf(" |
| - | printf( "\n float belegt %d Bytes", | + | printf(" |
| - | printf( "\n double belegt %d Bytes\n", | + | printf(" |
| - | return 0; | + | printf(" |
| - | } | + | printf(" |
| + | return 0; | ||
| + | } | ||
| + | </ | ||
| siehe: [[http:// | siehe: [[http:// | ||
/home/http/wiki/data/attic/c.1460501399.txt · Zuletzt geändert: von 127.0.0.1
